Я пытаюсь создать автоматическую систему регистрации, которая помещает все отправленные и удаленные сообщения, но время от времени я получаю эту ошибку:
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Python38\lib\site-packages\discord\client.py", line 312, in _run_event
await coro(*args, **kwargs)
File "D:\Documents\Bots\DS BOT\cog\logger.py", line 25, in on_message
print(f"User: {c.author} said --- {c.content} --- in #{c.channel}");
OSError: [WinError 87] The parameter is incorrect
Это полностью разрушает весь процесс и зацикливает ошибку, это очень раздражает перезапуск программы каждый раз, когда я сталкиваюсь с этим
Я помещаю команду в cog btw
Вот мой код:
from discord.ext import commands
# https://youtu.be/BoVOzm1uhUA
class logger(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_message(self, c):
if(c.guild):
if c.guild.name == "Sniper's lounge":
if c.author.bot == True:
print(f"Bot: {c.author} said --- {c.clean_content} --- in #{c.channel.name}");
pass;
else:
print(f"User: {c.author} said --- {c.clean_content} --- in #{c.channel.name}");
pass;
elif c.guild.name == "New GAR":
if c.author.bot == True:
print(f"Bot: {c.author} said --- {c.clean_content} --- in #{c.channel.name}");
pass;
else:
print(f"User: {c.author} said --- {c.clean_content} --- in #{c.channel.name}");
pass;
else:
pass;
@commands.Cog.listener()
async def on_message_delete(self, c):
if(c.guild):
if c.guild.name == "Sniper's lounge":
if c.author.bot == True:
print(f"Bot: {c.author} deleted --- {c.clean_content} --- in #{c.channel.name}");
pass;
else:
print(f"User: {c.author} deleted --- {c.clean_content} --- in #{c.channel.name}");
pass;
elif c.guild.name == "New GAR":
if c.author.bot == True:
print(f"Bot: {c.author} deleted --- {c.clean_content} --- in #{c.channel.name}");
pass;
else:
print(f"User: {c.author} deleted --- {c.clean_content} --- in #{c.channel.name}");
pass;
else:
pass;
#print(f"{c.created_at} || Bot: {c.author} deleted --- {c.clean_content} --- in #{c.channel.name}");
def setup(bot):
bot.add_cog(logger(bot))