fix support for citation for ptb and canary with new domain
This commit is contained in:
parent
6afa48fc13
commit
ad1360d3ea
1 changed files with 8 additions and 5 deletions
13
src/main.py
13
src/main.py
|
@ -52,18 +52,21 @@ async def on_message(message):
|
||||||
await ctx.send(f">>> Coucou !\nMon préfix est `{prefix}` et ma commande d'aide est `{prefix}help`")
|
await ctx.send(f">>> Coucou !\nMon préfix est `{prefix}` et ma commande d'aide est `{prefix}help`")
|
||||||
|
|
||||||
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)
|
||||||
|
httpsString = "https://"
|
||||||
|
channelsString = "discord.com/channels/"
|
||||||
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/") or urls[i].startswith("https://canary.discordapp.com/"):
|
if urls[i].startswith(f"{httpsString}{channelsString}") or urls[i].startswith(f"{httpsString}ptb.{channelsString}") or urls[i].startswith(f"{httpsString}canary.{channelsString}"):
|
||||||
link = urls[i]
|
link = urls[i]
|
||||||
linkURL = link
|
linkURL = link
|
||||||
if link.startswith("https://discord.com/"):
|
if link.startswith(f"{httpsString}{channelsString}"):
|
||||||
link = f'000{link}'
|
link = f'000{link}'
|
||||||
if link.startswith("https://ptb.discordapp.com/"):
|
if link.startswith(f"{httpsString}ptb.{channelsString}"):
|
||||||
|
link = link[1:]
|
||||||
|
if link.startswith(f"{httpsString}canary.{channelsString}"):
|
||||||
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)
|
||||||
|
print(link)
|
||||||
try:
|
try:
|
||||||
if int(link[32:-38]) == message.guild.id:
|
if int(link[32:-38]) == message.guild.id:
|
||||||
msgID = await client.get_channel(int(link[51:-19])).fetch_message(int(link[70:]))
|
msgID = await client.get_channel(int(link[51:-19])).fetch_message(int(link[70:]))
|
||||||
|
|
Reference in a new issue