我最近创建了一个非常简单的不和谐机器人,它会根据命令给你一个随机的选项引用。我也想做同样的事情,但使用 GIF。格式一样吗?
第一个代码是我的报价机器人编码,第二个是我尝试嵌入 gif,但我不知道如何将 .random.choice() 合并到这个......
@client.command(brief='-positivity', description='will give you a positive quote!')
async def positivity(ctx):
quotes = [#choice1, #choice2, ...., choice#25]
await ctx.send(f'**{random.choice(quotes)}**')
\\
@client.command(brief='-hug', desription="Will give you a warm hug")
async def hug(ctx):
gif = discord.Embed(title = 'A hug has been sent!', description = 'warm, fuzzy and comforting <3', color = 0x83B5E3)
gif.set_image(url = 'https://media.giphy.com/media/fvN5KrNcKKUyX7hNIA/giphy.gif')
await ctx.channel.send(embed=gif)