@Snowdevil

NameError: name 'user_id' is not defined — Где ошибка?

import vk_api
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType

vk_session = vk_api.VkApi(token = '1adbd73f02bcfa805971facdaf130387d5df1a176dc37fdb07eff4b7c97af7b409643e9c706c5f')
longpoll = VkBotLongPoll(vk_session, 20575886)

def sender(id, text):
    vk_session.method('messages.send', {'chat_id': id, 'message': text, 'random_id': 0})

def main():
    for event in longpoll.listen():
        if event.type == VkBotEventType.MESSAGE_NEW:
            if event.from_chat:

                id = event.chat_id
                msg = event.object.message['text'].lower()
                try:
                    dey = event.message.action['type']
                    invite_id = event.message.action['member_id']
                except:
                    dey = ""
                    invite_id = -100

                if dey == 'chat_invite_user' or dey == 'chat_invite_user_by_link':
                    sender(id, 'Лох')

        

                if msg == 'привет':
                    sender(id, '123')

                if user_id == admin_id and msg == 'кик':
                    vk_session.method('messages.removeChatUser', {'chat_id' : id, 'user_id' : user_id, 'member_id': member_id})

if __name__ == '__main__':
    main()
  • Вопрос задан
  • 362 просмотра
Пригласить эксперта
Ответы на вопрос 1
Вот здесь
if user_id == admin_id
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы