S
S
Sasha Bower2020-05-26 01:11:10
Python
Sasha Bower, 2020-05-26 01:11:10

There is a working conversation bot, but it needs admin rights to respond. How to make it so that he can send messages without admin 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_api.VkApi(token= "low")

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": 0 })

Answer the question

In order to leave comments, you need to log in

2 answer(s)
1
1 1, 2020-05-26
@Gear_up

If I'm not mistaken, since the latest version of vk api, bots can write to conversations, but not manage them.
If this is not the case, then the wrapper (only install from github!) vkwave works in some miraculous way bypassing this limitation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question