vb.net - 无法使用 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() 函数。
如果你觉得非常渴望帮助我,你也可以提出一些想法,让我能够跟踪它们的使用情况,以便在用户做出反应后转换到所需的菜单。
多谢你们!!
解决方案
推荐阅读
- java - 如何使用 jersey 客户端通过带有证书的 https 使用 restful 服务
- python - python seaborn 热图
- ios - 满足条件时通过 NSArray 循环创建新的 UILabel
- aws-lambda - 使用 Amazon Lex 的 inputTranscript 来允许一个敞开的插槽
- javascript - 如何将页面移动到“页面加载”上的锚链接部分?
- javascript - 我怎样才能(有效地)链接我的承诺,它返回一个具有价值而不是承诺的数组?
- c++ - 如何在运行时确定消息的类型?
- java - Multiple layout setVisibility wont show correct layout after getting pressed on certain layout
- ios - 检查按下了哪个手势识别器
- javascript - 如何将 firebase 用户数据保存到 Redux 存储中?反应