Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import vk_api
- from vk_api.utils import get_random_id
- import requests
- token = "123"
- botpod_token = "456"
- user_id = 547098395
- API = "https://api.vk.com/method"
- vk = vk_api.VkApi(token=token).get_api()
- with open("links.txt", "r") as f:
- links = f.read().split()
- for num, link in enumerate(links[15:17]):
- try:
- vk.messages.joinChatByInviteLink(link=link)
- except vk_api.exceptions.ApiError as e:
- print(e)
- continue
- convs = vk.messages.getConversations()
- peer_id = convs["items"][0]["conversation"]["peer"]["id"]
- vk.messages.send(
- peer_id=peer_id,
- message="dd",
- random_id=get_random_id(),
- )
- response = requests.post(f"https://api.vk.com/method/bot.addBotToChat?access_token={botpod_token}",
- data={
- 'peer_id': peer_id,
- 'bot_id': -187188576,
- 'v': 5.92
- })
- vk.messages.removeChatUser(chat_id=peer_id - 2000000000, user_id=user_id)
- print(f"Отправили в конфу №{num}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement