Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import vk_api
- class bot:
- count = 0
- def __init__(self, token, id, name):
- self.token = token
- self.id = id
- self.session = vk_api.VkApi(token = self.token)
- self.vk = self.session.get_api()
- self.name = name
- bot.count += 1
- self.count = bot.count
- def SendMsg(self, chat_id, message = '', reply_to='', attachments = '', random_id = 0):
- self.vk.messages.send(
- chat_id = chat_id,
- message = message,
- reply_to = reply_to,
- attachemnts = attachments,
- random_id = random_id
- )
- def getcount(self):
- return self.count
- admin_bot = bot('token', id1, 'Valeria Banschikova')
- first_bot = bot('token2', id2)
- second_bot = bot('token3', id3)
- admin_bot.SendMsg(
- chat_id = event.chat_id,
- message = 'Test',
- )
- second_bot.SendMsg(
- chat_id = event.chat_id,
- message = 'Test2',
- )
- print(second_bot.count) # 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement