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