【问题标题】:Im looking for a way to delete the bot command after the bot has posted in Discord code written in Discord.net在机器人发布在 Discord.net 中编写的 Discord 代码后,我正在寻找一种删除 bot 命令的方法
【发布时间】:2021-03-12 17:47:35
【问题描述】:

下面是发布嵌入消息后的代码我希望机器人删除它为发布嵌入而给出的命令。另外,如果有人知道如何在此嵌入中添加页脚,那就太棒了

if (raid == "gos")
{
   if (day == "Sun")
   {
       var filename = "gos_Sun.png";

       var embed = new EmbedBuilder()
       {
           Title = "Garden of Salvation",
           Description = "```" + day + ", " + date + " @ " + time + " " + ampm + " " + "\n" + description + "```" + description2,
           ImageUrl = $"attachment://{filename}",
       }.Build();

       SentEmbed = await Context.Channel.SendFileAsync(filename, embed: embed);

       await SentEmbed.AddReactionsAsync(myReactions);
   }
}

【问题讨论】:

  • 只需在 Context.Message 上调用 DeleteAsync。嵌入构建器也有一个页脚属性
  • 是的,但是当我执行 Footer = "React below" 时,我得到一个错误
  • 无法将类型字符串隐式转换为 Discord.EmbedFooterBuilder,因此它不像描述或标题剂量那样工作,并且通过我的所有研究,我无法获得使用页脚属性的示例
  • 好吧,这样使用时它不是字符串。这是一个页脚构建器或类似的东西。所以你必须创建并传递其中一个

标签: c# discord embed discord.net


【解决方案1】:
   var footer = new EmbedFooterBuilder().WithText("React Below");


        if (raid == "gos")
        {
            if (day == "Sun")
            {
                var filename = "gos_Sun.png";


                var embed = new EmbedBuilder()
                {
                    Title = "Garden of Salvation",
                    Description = "```" + day + ", " + date + " @ " + time + " " + ampm + " " + "\n" + description + "```" + description2,
                    ImageUrl = $"attachment://{filename}",

                }.WithFooter(footer).Build();

【讨论】:

    猜你喜欢
    • 2018-07-21
    • 2019-12-14
    • 2020-04-28
    • 1970-01-01
    • 2011-01-07
    • 1970-01-01
    • 2018-11-25
    • 1970-01-01
    • 2022-11-26
    相关资源
    最近更新 更多