7
7
7EVENx2019-11-24 01:46:01
Python
7EVENx, 2019-11-24 01:46:01

Why does the bot only respond to 1 user?

I’m trying on 2 phones:
Depending on which account I’m starting a correspondence with, I get answers to that one (and bot answers from messages with another account), that is, in fact, the first id is saved, how to fix it?

for event in longpoll.listen():
    if event.type == VkBotEventType.MESSAGE_NEW:
        command = event.obj.message['text']

        if command == 'Начать' or command == 'Перевести СС':
            while True:
                try:
                    vk_session.method('messages.send', {'user_id': event.obj.message['from_id'], 'message': 'Введи число','random_id': random.randint(1, 1212124564), 'keyboard': keyboard})
                    num = get_num()
                    vk_session.method('messages.send', {'user_id': event.obj.message['peer_id'], 'message': 'Из какой СС', 'random_id': random.randint(1, 1212124564),'keyboard': keyboard})
                    from_ss = int(get_from_ss())
                    vk_session.method('messages.send', {'user_id': event.obj.message['peer_id'],  'message': 'В какую СС','random_id': random.randint(1, 1212124564),'keyboard': keyboard})
                    to_ss = int(get_to_ss())
                    result = convert_base(num, to_ss, from_ss)
                    vk_session.method('messages.send', {'user_id': event.obj.message['peer_id'], 'message': result,'random_id': random.randint(1, 1212124564),'keyboard': keyboard})

                except ValueError:
                    vk_session.method('messages.send', {'user_id': event.obj.message['peer_id'],'message': 'попробуй заново','random_id': random.randint(1, 1212124564),'keyboard': keyboard})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sergeyfilippov4, 2019-11-30
@sergeyfilippov4

Because under the vile

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question