Спустя много проверок и тестов дошел до возможного победного конца своего кода, но вдруг что то пошло не так и разбан через tasks не хочет работать.
@tasks.loop(seconds=5.0)
async def check_for_unban():
for guild in client.guilds:
active_ban = database_handler.active_ban_to_revoke(guild.id)
if len(active_ban) > 0:
for row in active_ban:
database_handler.revoke_ban(row["id"])
member = guild.get_member(row["user_id"])
await guild.unban(member)
Ошибка:
Unhandled exception in internal background task 'check_for_unban'.
Traceback (most recent call last):
File "/home/container/.local/lib/python3.9/site-packages/nextcord/ext/tasks/__init__.py", line 156, in _loop
await self.coro(*args, **kwargs)
File "/home/container/pterohost.py", line 161, in check_for_unban
await guild.unban(member)
File "/home/container/.local/lib/python3.9/site-packages/nextcord/guild.py", line 2930, in unban
await self._state.http.unban(user.id, self.id, reason=reason)
AttributeError: 'NoneType' object has no attribute 'id'