首页 > 解决方案 > 无法使用 Discord.net 对 Discord 消息做出有问题的反应:错误:服务器响应错误 404:NotFound

问题描述

我已经用 VB 编程一年多了,并决定开始编写 Discord Bots。我目前正在尝试创建一个配置功能,用户可以在其中更改多个设置。虽然后端都没有完成,但我目前在设置菜单的交互部分时遇到问题,特别是让反应应用于输出消息。

客户端中的菜单应该是这样的: 反应是我作为第二个标准 Discord 用户使用“添加反应”按钮输入的。

这是创建如上所示输出的代码(减去反应):

<Command>
Public Async Function Config() As Task
    'Need to create emojis for the options and add them as reactions
    Dim firstEmoji As New Emoji(":one:")
    Dim secondEmoji As New Emoji(":two:")
    Dim thirdEmoji As New Emoji(":three:") '("\u0033")
    Dim fourthEmoji As New Emoji(":four:") '("\u0034")
    Dim closeEmoji As New Emoji("")
    Dim tempEmote As Emote
    Try
        tempEmote = Emote.Parse(":ok:")
    Catch ex As Exception
    End Try
    Dim footerVar As New EmbedFooterBuilder With {
        .Text = "Updated: 04/08/2020",
        .IconUrl = $"{Context.Client.CurrentUser.GetAvatarUrl}"
    }
    Dim authorVar As New EmbedAuthorBuilder With {
        .IconUrl = $"{Context.Client.CurrentUser.GetAvatarUrl}",
        .Name = $"{closeEmoji} {Context.Client.CurrentUser.Username}#{Context.Client.CurrentUser.DiscriminatorValue}"
    }
    Dim fieldVar As New EmbedFieldBuilder With {
        .IsInline = False,
        .Name = "Staff Roles",
        .Value = $"{firstEmoji} This page allows administrators to set what roles are considered Secretaries, Moderators, and Asministrators. These roles' permissions are not considered when setting this bot up. Any role can be made any of the 3 previously stated ranks."
    }
    Dim fieldVar1 As New EmbedFieldBuilder With {
        .IsInline = False,
        .Name = "Punishment Roles",
        .Value = $"{secondEmoji} This page allows administrators to set what roles are considered as the Muted and Trap roles."
    }
    Dim fieldVar2 As New EmbedFieldBuilder With {
        .IsInline = False,
        .Name = "Banned Words List",
        .Value = $"{thirdEmoji} This page allows administrators to set what words are considered banned. Anyone that is not a recognized staff member will be punished according to a value provided during configuration."
    }
    Dim embeddedMessage As New EmbedBuilder With {
        .Title = "Pioneer12 Configuration Menu",
        .Description = "This is the configuration menu for Pioneer12. React with one of the following to continue.",
        .Color = Color.Purple,
        .Footer = footerVar,
        .Author = authorVar,
        .Fields = New List(Of EmbedFieldBuilder) From {fieldVar, fieldVar1, fieldVar2},
        .Timestamp = DateTimeOffset.Now
        }

    Dim intialReply As Task(Of IUserMessage) = ReplyAsync(embed:=embeddedMessage.Build())
    Dim message As IUserMessage = Await intialReply
    'Add reactions after the message is sent.
    'Dim addReactionTask As Task(Of IMessage) = 
    Try
        'Await message.AddReactionAsync(Emote.TryParse())
        Await ReactWithEmote(message, "GWbowsuBlobThonkeng")
    Catch ex As Exception
        Dim errorReplyTask As Task(Of IUserMessage) = ReplyAsync($"Error : {ex.Message}")
    End Try
    'Dim temp = Await addReactionTask
End Function

关于到目前为止所采取的方法,我已经尝试过 Emojis 和 Emotes 并且两次我都遇到了同样的问题。您在代码中看到的很多内容都不是最终的,因为我仍在试图弄清楚它们是如何协同工作的。关于到目前为止我尝试过的支持,我使用了以下网站:https ://www.fileformat.info/info/unicode/char/0031/index.htm https://docs.stillu.cc/ guides/emoji/emoji.html https://discord.foxbot.me/stable/api/Discord.Emote.html 对于 TryParse()、Parse() 和AddReactionAsync() 函数。

如果你觉得非常渴望帮助我,你也可以提出一些想法,让我能够跟踪它们的使用情况,以便在用户做出反应后转换到所需的菜单。

多谢你们!!

标签: vb.netdiscord.net

解决方案


推荐阅读