adding canary links to the citation

This commit is contained in:
Mylloon 2021-05-31 16:21:32 +02:00
parent e96fad8bf1
commit 6afa48fc13

View file

@ -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) 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)): 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] link = urls[i]
linkURL = link linkURL = link
if link.startswith("https://discord.com/channels/"): if link.startswith("https://discord.com/"):
link = f'000{link}' link = f'000{link}'
if link.startswith("https://ptb.discordapp.com/"): if link.startswith("https://ptb.discordapp.com/"):
link = link[4:] link = link[4:]
if link.startswith("https://canary.discordapp.com/"):
link = link[7:]
if "@me" in urls[i]: if "@me" in urls[i]:
return await message.channel.send("Je ne cite pas les messages privés.", delete_after = 5) return await message.channel.send("Je ne cite pas les messages privés.", delete_after = 5)
try: try: