Загрузка...

Vk_api not responding in conversation

Thread in Python created by lefall Dec 12, 2019. 943 views

  1. lefall
    lefall Topic starter Dec 12, 2019 Banned 298 Sep 26, 2019
    Дедушке понадобился бот с 1 командой в беседе , решил почеккать гайдики , нашёл шото , сделал все в точности как в видео но чет не хочет воркать в беседе , в лс отвечает . В чем здесь ошибка?

    Code
    from vk_api.longpoll import VkLongPoll, VkEventType
    import vk_api
    from datetime import datetime
    import random
    import time

    token ='****'
    vk_session = vk_api.VkApi(token=token)

    session_api = vk_session.get_api()

    longpoll = VkLongPoll(vk_session)

    def send_message(vk_session, id_type, id, message=None,):
    vk_session.method('messages.send',{id_type: id, 'message': message, 'random_id': random.randint(-2147483648, +2147483648)})

    for event in longpoll.listen():
    if event.type == VkEventType.MESSAGE_NEW:
    print('Сообщение пришло в: ' + str(datetime.strftime(datetime.now(), "%H:%M:%S")))
    print('Текст сообщения: ' + str(event.text))
    print(event.user_id)
    response = event.text.lower()

    if event.from_user and not event.from_me:
    if response == "котики":
    send_message(vk_session, 'user_id', event.user_id, message='Я котик')



    elif event.from_chat :
    if response == "Хай":
    send_message(vk_session, 'chat_id', event.chat_id, message='Хаай')
    print('-' * 30)
     
  2. i911
    i911 Dec 12, 2019 115 Sep 14, 2018
    Скинь ошибку.
     
  3. lefall
    lefall Topic starter Dec 12, 2019 Banned 298 Sep 26, 2019
    i911, Её тупо нет , он даж не видет сообщения в беседе :(
     
  4. i911
    i911 Dec 12, 2019 115 Sep 14, 2018
    В командой строке Python выводит лог ошибки.
     
  5. TEXT_inactive232046
    TEXT_inactive232046 Dec 12, 2019 Banned 67 Dec 13, 2017
    видно сразу, что твой дедушка очень любит котиков
    а еще очень дружелюбный)
     
  6. lefall
    lefall Topic starter Dec 12, 2019 Banned 298 Sep 26, 2019
    [IMG]
    Это если в ЛС писать , он ошибок не выдает . Если написать в беседе "Хай" или еще шото то ему пофиг , так скажем не слышит беседу
    The post was merged to previous Dec 12, 2019
    TEXT_inactive232046, :da:
     
  7. Hupopo
    Hupopo Dec 21, 2019 3 Feb 21, 2018
    Извини,а у тебя в 8 строке в коде так и написано?? token = '***'
    The post was merged to previous Dec 21, 2019
    @linjoy, нормальная у него библиотека
     
  8. lefall
    lefall Topic starter Dec 21, 2019 Banned 298 Sep 26, 2019
    Hupopo, нет , там токен мой)
     
  9. Hupopo
    Hupopo Dec 21, 2019 3 Feb 21, 2018
    Понял уже) lefall,
     
Loading...
Top