【问题标题】:how would i make this send as an embedded message我将如何将此作为嵌入式消息发送
【发布时间】:2021-11-07 20:50:03
【问题描述】:

我正在制作一个自我机器人并拥有这个

@knife.command()        #
async def howgay(ctx, member:discord.Member):
    await ctx.message.delete()
    await ctx.send(f"{member.mention} is {random.randint(0,101)}% gay")

我想把它作为嵌入发送消息

【问题讨论】:

    标签: python discord embed


    【解决方案1】:

    要使用机器人发送嵌入,您需要使用 embed() 函数。 embed() 函数中有 4 个参数:title、url、description 和 color。 一个例子:

    @client.command()
    async def embed(ctx):
        embed=discord.Embed(title="Sample Embed", url="https://stackoverflow.com/", description="This is an embed that will show how to build an embed and the different components", color=0xFF5733)
        await ctx.send(embed=embed)
    

    如您所见,上面的语法中依次使用了 4 个参数。

    标题:第一行文字

    Url:点击标题,会跳转到输入的网址

    说明:下面的文字

    颜色:颜色十六进制代码

    顺便说一句,要使用自定义颜色,您可以从网站复制十六进制代码并粘贴。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-25
      • 2021-03-21
      • 2013-08-10
      • 2019-04-27
      • 2020-10-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多