handle extension file > 3 chars
This commit is contained in:
parent
f4c43eb150
commit
7d547ede67
1 changed files with 4 additions and 4 deletions
|
@ -49,18 +49,18 @@ class Citation(commands.Cog):
|
|||
desc = f"Il y a plusieurs fichiers dans ce message : {listOfFiles}"
|
||||
else:
|
||||
if len(msgFiles) == 1:
|
||||
if msgFiles[0].filename[-4:].split('.')[1] in imageExtensions:
|
||||
if msgFiles[0].filename.split('.')[-1] in imageExtensions: # si le fichier joint est une image
|
||||
if not len(msgID.content) > 0:
|
||||
desc = f"Une image jointe : {msgFiles[0].filename}"
|
||||
else:
|
||||
else: # si le fichier joint n'est pas une image
|
||||
linkFile = msgFiles[0].url
|
||||
if not len(msgID.content) > 0:
|
||||
desc = f"Un fichier joint : {msgFiles[0].filename}"
|
||||
embed = discord.Embed(description = desc, colour = couleur)
|
||||
try:
|
||||
if len(msgFiles) == 1:
|
||||
if msgFiles[0].filename[-4:].split('.')[1] in imageExtensions:
|
||||
embed.set_image(url=msgFiles[0].url)
|
||||
if msgFiles[0].filename.split('.')[-1] in imageExtensions:
|
||||
embed.set_image(url = msgFiles[0].url)
|
||||
else:
|
||||
embed.add_field(name = "Fichier", value = f"[Lien]({linkFile})", inline=True)
|
||||
except:
|
||||
|
|
Reference in a new issue