Answer the question
In order to leave comments, you need to log in
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question