Advertisement
Toliak

test bot

Feb 14th, 2019
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. import random
  2.  
  3. import vk_api
  4. from vk_api.bot_longpoll import VkBotLongPoll
  5.  
  6.  
  7. def main():
  8.     vk_session = vk_api.VkApi(
  9.         token='ee2b7f501e5868dab530d208726d5ffc07829aefdad9b6d111b80b3c79293c87ae4f280364b527528fc12'
  10.     )
  11.  
  12.     vk = vk_session.get_api()
  13.  
  14.     for i in range(12, 13):
  15.         try:
  16.             vk.messages.send(peer_id=2000000000 + i, message=f'ля чорт {i}', random_id=random.randint(0, 100000))
  17.         except Exception as e:
  18.             print('ERROR', e)
  19.  
  20.     longpoll = VkBotLongPoll(vk_session, '157052529')
  21.  
  22.     for event in longpoll.listen():
  23.         print(event)
  24.  
  25.  
  26. if __name__ == '__main__':
  27.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement