import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType
import random
tok = 'токен'
forward_messages = "365620"
sess = vk_api.VkApi(token= tok)
vk = sess.get_api()
longpoll = VkLongPoll(sess)
message_id = "365620"
admins = [айди]
ad = ""
print('Бот запущен!')
print(admins)
def write_msg(peer_id, message):
vk.messages.send(
peer_id=peer_id,
message=message,
random_id = random.randint(0, 2048),
)
def send(id, text):
sess.method('messages.send', {'peer_id' : id, 'message' : text, 'random_id' : 0})
def reply(e):
x = vk.method('messages.getById', {'message_ids': e})
reply = x["items"][0]["reply_message"]
return reply
for event in longpoll.listen():
if event.type == VkEventType.MESSAGE_NEW:
msg = event.text.lower()
id = event.peer_id
msg_id = event.message_id
try:
if event.raw[6]['mentions']:
vk_id = str(event.raw[6]['mentions'][0])
else:
vk_id = str(reply(msg_id)['from_id'])
except:
pass
if msg == 'raid':
while True:
write_msg(id, message_id)
проблема в этих строках write_msg(id, message_id)
. пишет ID смс а не пересылает