From 6afa48fc1390737b53f59f13052e180f6f7d37c5 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Mon, 31 May 2021 16:21:32 +0200 Subject: [PATCH] adding canary links to the citation --- src/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.py b/src/main.py index 3739f62..73473bd 100644 --- a/src/main.py +++ b/src/main.py @@ -53,13 +53,15 @@ async def on_message(message): urls = re.findall(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', message.content) for i in range(len(urls)): - if urls[i].startswith("https://discordapp.com/channels/") or urls[i].startswith("https://discord.com/channels/") or urls[i].startswith("https://ptb.discordapp.com/"): + if urls[i].startswith("https://discordapp.com/channels/") or urls[i].startswith("https://discord.com/channels/") or urls[i].startswith("https://ptb.discordapp.com/") or urls[i].startswith("https://canary.discordapp.com/"): link = urls[i] linkURL = link - if link.startswith("https://discord.com/channels/"): + if link.startswith("https://discord.com/"): link = f'000{link}' if link.startswith("https://ptb.discordapp.com/"): link = link[4:] + if link.startswith("https://canary.discordapp.com/"): + link = link[7:] if "@me" in urls[i]: return await message.channel.send("Je ne cite pas les messages privés.", delete_after = 5) try: