Проблемка с ботом и банами
Здравствуйте дорогие друзья по программированию. Я пишу своего бота для личного проекта на aiogram и у меня возникла проблема в команде бана по ID с последующим постом с причиной бана итд, а так же самим баном по всем чатам которые занесены в список. Появляется такая вот ошибка. Хотя при вводе команды /глобан ID причина;ссылка ничего не нарушалось
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-82' coro=<Dispatcher._process_polling_updates() done, defined at C:\Users\Пользователь\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\dispatcher\dispatcher.py:407> exception=BadRequest('Participant_id_invalid')>
Traceback (most recent call last):
File "C:\Users\Пользователь\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\dispatcher\dispatcher.py", line 415, in _process_polling_updates
for responses in itertools.chain.from_iterable(await self.process_updates(updates, fast)):
File "C:\Users\Пользователь\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\dispatcher\dispatcher.py", line 235, in process_updates
return await asyncio.gather(*tasks)
File "C:\Users\Пользователь\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\dispatcher\handler.py", line 117, in notify
response = await handler_obj.handler(*args, **partial_data)
File "C:\Users\Пользователь\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\dispatcher\dispatcher.py", line 256, in process_update
return await self.message_handlers.notify(update.message)
File "C:\Users\Пользователь\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\dispatcher\handler.py", line 117, in notify
response = await handler_obj.handler(*args, **partial_data)
File "c:\Users\Пользователь\OneDrive\Рабочий стол\Я ебал\main.py", line 85, in local_ban_user
await bot.ban_chat_member(e, ban_id)
File "C:\Users\Пользователь\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\bot\bot.py", line 1838, in ban_chat_member
return await self.request(api.Methods.BAN_CHAT_MEMBER, payload)
File "C:\Users\Пользователь\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\bot\base.py", line 236, in request
return await api.make_request(await self.get_session(), self.server, self.__token, method, data, files,
File "C:\Users\Пользователь\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\bot\api.py", line 140, in make_request
return check_result(method, response.content_type, response.status, await response.text())
File "C:\Users\Пользователь\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\bot\api.py", line 115, in check_result
exceptions.BadRequest.detect(description)
File "C:\Users\Пользователь\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\utils\exceptions.py", line 141, in detect
raise cls(description)
aiogram.utils.exceptions.BadRequest: Participant_id_invalid
Вот мой код/функция/хэндл для бана коку как удобно
@dp.message_handler(commands=['глобан'])
async def ban_user(message: types.Message):
if message.from_user.id in ADMIN2 or message.from_user.id in ADMIN3:
if message.text:
x = message.get_args().split(' ', 1)
y = x[1].split(';', 2)
cur.execute(f"UPDATE users SET block = 1 WHERE user_id = {x[0]}")
conn.commit()
await bot.send_message(SLIV, f'<b>Пользователь забанен!\n<a href="tg://user?id={x[0]}">Открыть профиль</a>\nID:{x[0]}\nПричина: {y[0]}\n<a href="{y[1]}">Открыть доказательство</a></b>', parse_mode='html')
for i in BAZABAN:
await bot.ban_chat_member(i, x[0])