[英]How do I get a discord bot to send a random message inside an embed in python
所以我想使用一個命令,將隨機消息放入一個嵌入中,該嵌入還附有一個隨機 gif,這是我正在使用的代碼:
roastgifs = [
'https://tenor.com/view/roasted-oh-shookt-gif-8269968'
]
@client.command(aliases=['Roast'])
async def roast(ctx, member : discord.Member):
global roasting
global sus
roasting = [line.strip() for line in open('jokes.txt')]
sus = random.choice(roasting)
embed=discord.Embed(title=f"{ctx.author.mention} roasts {member.mention}\n\"" + sus + "\"")
roastgif=random.choice(roastgifs)
embed.set_image(url=roastgif)
embed.set_footer("footer")
await ctx.send(embed=embed)
我在 yt 和 Google 上找不到那么多教程,即便如此,它們可能是 js 而不是 py,所以我再次求助於這里。
另外,如果可以的話,我將非常感謝如何使機器人 ping 具有 ID 的人。
Embed.set_footer
只接受關鍵字 arguments,並且您正在傳遞一個位置參數
embed.set_footer(text="Footer")
還有幾點:
Embed.set_image
中添加圖片
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.