Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import vk_api
- import vk
- from vk_api.longpoll import VkLongPoll, VkEventType
- token = ''
- vk_auth_token = vk_api.VkApi(token=token)
- longpoll = VkLongPoll(vk_auth_token)
- session = vk.Session(access_token=token)
- call = vk.API(session, v = "5.777")
- my_id = call.users.get()[0]['id']
- for event in longpoll.listen():
- try:
- if event.type == VkEventType.MESSAGE_NEW:
- target_id = event.raw[6].get('mentions')
- from_id = int(event.raw[6].get('from'))
- if from_id == my_id and target_id:
- if event.text.startswith('.кик') :
- call.messages.send(peer_id=event.peer_id, message=f"кик нахой @id{target_id[0]}", disable_mentions=1, random_id=0)
- call.messages.removeChatUser(chat_id=event.peer_id-2000000000, member_id=target_id[0])
- elif event.text.startswith('.верни'):
- call.messages.send(peer_id=event.peer_id, message=f"верни нахой @id{target_id[0]}", disable_mentions=1, random_id=0)
- call.messages.addChatUser(chat_id=event.peer_id-2000000000, user_id=target_id[0])
- except Exception as error:
- print(error)
Add Comment
Please, Sign In to add comment