如何将本地导入的缩略图和本地导入的图像附加到discord.py上的嵌入内容?

时间:2020-05-06 21:12:39

标签: python python-3.x discord.py discord.py-rewrite

我是python的新手,我正在学习制作不和谐的机器人。我正在制作一个内存罐机器人,并且在检索内存时正在使用嵌入程序。沿着邮件以及与嵌入到邮件的邮件相关联的任何图像,它还会在集合中为嵌入的缩略图选择随机照片。但是,与消息关联的图像和用于缩略图的图像都是本地导入的。有没有办法将这两个图像都附加到同一嵌入?

memory,date,file_name = memory 
mem_file_info = File("C:\\*\\Desktop\\Discord Bots\\Memory Jar Bot\\" + file_name,filename = file_name)
embed = Embed (title = '\u2619' + date, description = '\U0001F495' + memory + '\U0001F495', colour = Colour.red()) 
embed.set_image(url="attachment://" + file_name)
embed.set_author (name = author_name, icon_url = author_profil_pic_url)  
embed.set_footer(text = f'''Memory pulled by {context.message.author}''') 
thumbnail_file = File("C:\\*\\Discord Bots\\Memory Jar Bot\\" + rand_thumbnail_pic,filename = rand_thumbnail_pic)
embed.set_thumbnail(url="attachment://" + rand_thumbnail_pic)

async with context.channel.typing(): 
    await context.message.add_reaction('\u2665') 
    await(await context.channel.send (file = mem_file_info, embed = embed)).delete (delay = 300)  
await context.message.delete (delay = 4) 

注意:*替换任何个人信息

0 个答案:

没有答案