Fix auto-pin

This commit is contained in:
EEKIM10 2022-10-10 18:15:48 +01:00
parent 34fd911e63
commit 907f16763e

View file

@ -58,13 +58,13 @@ class Events(commands.Cog):
@commands.Cog.listener()
async def on_message(self, message: discord.Message):
if message.channel.name == "pinboard":
try:
await message.pin(reason="Automatic pinboard pinning")
except discord.HTTPException as e:
return await message.reply(f"Failed to auto-pin: {e}", delete_after=10)
if message.type == discord.MessageType.pins_add:
await message.delete(delay=0.01)
if message.type == discord.MessageType.pins_add:
await message.delete(delay=0.01)
else:
try:
await message.pin(reason="Automatic pinboard pinning")
except discord.HTTPException as e:
return await message.reply(f"Failed to auto-pin: {e}", delete_after=10)
def setup(bot):