S
S
Sasha Bower2020-01-19 16:35:38
Python
Sasha Bower, 2020-01-19 16:35:38

How to make a bot in a VK conversation write without administrator rights?

from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
import vk_api
import random #various
responses
a = ("hello","you're sick of it","what's up again?","please don't touch me:((","I'm tired leave me alone")
#code
vk = vk_api.VkApi(token="")
vk._auth_token()
vk.get_api()
longpoll = VkBotLongPoll(vk, )
while True:
for event in longpoll.listen():
if event.type == VkBotEventType. MESSAGE_NEW:
if event.object.peer_id != event.object.from_id:
if event.object.text.lower() in ("hello bot","hey bot","bot","alo bot"):
vk.method("messages.send", {"peer_id": event.object.peer_id, "message": random.choice(a),
"random_id": 0 })
if event.object.text.lower() in ("schedule","what are the lessons tomorrow?","what are the lessons tomorrow"):
vk.method("messages.send", {"peer_id": event.object.peer_id, "message": "Pon-eng,algebra , russian, biologist, geographer, Litra Vtor-OBZh, physics, geometry, russian, chemistry, inform, eng. ,geometry,history Friday-liter,drawing,algebra,physics,historian,muses",
"random_id":0 })
if event.object.text.lower() == "commands":
vk.method("messages.send", {"peer_id": event.object.peer_id, "message": "Teams - schedule and to be continued",
"random_id":

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Minovsky, 2020-01-19
@Darkcan

If you know the id of the conversation, then you can write to it without administrator rights. But there are two ways to receive messages from there without admin rights:
1) your bot should be contacted, for example @bot / menu
2) administrators should give the bot the ability to read correspondence

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question