Fix twitter fix
All checks were successful
Build and Publish / build_and_publish (push) Successful in 53s

This commit is contained in:
Nexus 2024-07-23 16:52:16 +01:00
parent 8264680e21
commit 8a72ea7ddd
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -500,6 +500,8 @@ class NetworkCog(commands.Cog):
@commands.Cog.listener()
async def on_message(self, message: discord.Message):
if message.author.bot:
return
content = message.content.split()
new_links = []
for section in content:
@ -510,6 +512,7 @@ class NetworkCog(commands.Cog):
if parsed.netloc in ("x.com", "twitter.com"):
parsed = parsed._replace(netloc="fixupx.com")
new_links.append(parsed.geturl())
if new_links:
if len(content) == 1: # just link
await message.delete(delay=0.1, reason="Fixed twitter link")
await message.channel.send(