Answer the question
In order to leave comments, you need to log in
How to get message after command?
I'm learning python, I wanted to make a page calculator in VK.
I ran into a problem, I don't know how to get an example after '.solve'
import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType
import random
def mathvk():
vk_session = vk_api.VkApi(
token="token")
try:
vk = vk_session.get_api()
except vk_api.AuthError as error_msg:
print(error_msg)
return
longpoll = VkLongPoll(vk_session)
for event in longpoll.listen():
if event.type == VkEventType.MESSAGE_NEW and event.from_user:
peer = str(int(event.user_id))
print(event.text)
if '.реши' in event.text:
try:
vk.messages.send(peer_id=peer, message='ответ на пример здесь.' random_id=str(random.randint(1, 99999)), v=5.124)
except:
vk.account.setOffline()
if __name__ == '__main__':
mathvk()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question