Fix twitter fix
All checks were successful
Build and Publish / build_and_publish (push) Successful in 53s
All checks were successful
Build and Publish / build_and_publish (push) Successful in 53s
This commit is contained in:
parent
8264680e21
commit
8a72ea7ddd
1 changed files with 16 additions and 13 deletions
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue