【问题标题】:How to send embed to private message discord.py bot如何将嵌入发送到私人消息 discord.py bot
【发布时间】:2021-12-25 16:36:48
【问题描述】:

我不知道如何将嵌入发送到私人消息 discord.py 机器人。我有这样的代码:

@bot.command()
@commands.has_any_role(admin, moderator, ghostluko)
async def kick(ctx, member : discord.Member, *, arg):
    reason = arg
    await member.send(f'Вас было кикнуто из сервера ???????????????????? ????????????????:crying_cat_face: \nПричина {reason}')   
    await member.kick(reason=reason)

并希望像这样发送嵌入到私人消息:

    em = discord.Embed(tittle = "Help", description = "**КИК**")
    em.add_field(name = "Вас было кикнуто из сервера ???????????????????? ???????????????? ????", value = "Причина: " + str(reason))
    em.set_thumbnail(url = 'https://i.ibb.co/mvDpBsw/21321312312.png')  

【问题讨论】:

标签: discord discord.py embed


【解决方案1】:

你必须在await member.send(embed=)中设置嵌入,所以:

@bot.command()
@commands.has_any_role(admin, moderator, ghostluko)
async def kick(ctx, member : discord.Member, *, arg):
    reason = arg

    em = discord.Embed(tittle = "Help", description = "**КИК**")
    em.add_field(name = "Вас было кикнуто из сервера ????? ???? ?", value = "Причина: " + str(reason))
    em.set_thumbnail(url = 'https://i.ibb.co/mvDpBsw/21321312312.png')  

    await member.send(embed=em)   
    await member.kick(reason=reason)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-06-16
    • 2021-02-13
    • 2018-08-12
    • 2022-06-11
    • 2019-09-19
    • 2018-09-19
    • 1970-01-01
    • 2021-01-09
    相关资源
    最近更新 更多