fix citation without attachments

This commit is contained in:
Mylloon 2021-02-22 05:30:41 +01:00
parent 36679d08b4
commit dc14278930

View file

@ -116,6 +116,7 @@ async def on_message(message):
couleur = 0x2f3136 couleur = 0x2f3136
msgFiles = msgID.attachments msgFiles = msgID.attachments
imageExtensions = ["jpg", "jpeg", "png", "webp", "gif"] imageExtensions = ["jpg", "jpeg", "png", "webp", "gif"]
desc = msgID.content
if len(msgFiles) > 1: if len(msgFiles) > 1:
listOfFiles = "" listOfFiles = ""
for i in range(0, len(msgFiles)): for i in range(0, len(msgFiles)):
@ -128,15 +129,11 @@ async def on_message(message):
else: else:
if len(msgFiles) == 1: if len(msgFiles) == 1:
if msgFiles[0].filename[-4:].split('.')[1] in imageExtensions: if msgFiles[0].filename[-4:].split('.')[1] in imageExtensions:
if len(msgID.content) > 0: if not len(msgID.content) > 0:
desc = msgID.content
else:
desc = f"Une image jointe : {msgFiles[0].filename}" desc = f"Une image jointe : {msgFiles[0].filename}"
else: else:
linkFile = msgFiles[0].url linkFile = msgFiles[0].url
if len(msgID.content) > 0: if not len(msgID.content) > 0:
desc = msgID.content
else:
desc = f"Un fichier joint : {msgFiles[0].filename}" desc = f"Un fichier joint : {msgFiles[0].filename}"
embed = discord.Embed(description = desc, colour = couleur) embed = discord.Embed(description = desc, colour = couleur)
auteur = "Auteur" auteur = "Auteur"