bot将嵌入的msg发送到特定的频道,然后该bot自动响应以下消息:
例如:“”和“”
发送嵌入消息的按钮[工作正常]
Private Async Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim embed As New EmbedBuilder With {
.ThumbnailUrl = discord.CurrentUser.GetAvatarUrl,
.Title = "Just title.",
.Description = "Enjoy",
.Color = New Discord.Color(255, 0, 0)
}
discord.GetGuild("12345..").GetTextChannel("54321..").SendMessageAsync("", False, embed)
End Sub
现在,我单击按钮将msg发送到频道后如何制作,如何让bot自动添加这2个反应“”和“”
我发现可以使用OnMsg句柄,这是什么 尝试过的。 [不确定其工作原理]
Private Async Function onMsg(message As SocketMessage) As Task
If message.Source = MessageSource.Bot Then
Dim reaction As SocketReaction
Dim rMessage = CType(Await message.Channel.GetMessageAsync(message.Id), RestUserMessage)
If reaction.Emote.Name.Equals("") AndAlso
reaction.Emote.Name.Equals("")
Else
Dim my_emo1 As Emoji = ("")
Dim my_emo2 As Emoji = ("")
rMessage.AddReactionAsync(my_emo1)
rMessage.AddReactionAsync(my_emo2)
End If
End Function
答案 0 :(得分:0)
使用您当前的代码:
Private Async Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim embed As New EmbedBuilder With {
.ThumbnailUrl = discord.CurrentUser.GetAvatarUrl,
.Title = "Just title.",
.Description = "Enjoy",
.Color = New Discord.Color(255, 0, 0)
}
Dim msg = Await discord.GetGuild("12345..").GetTextChannel("54321..").SendMessageAsync(embed:=embed.Build)
Dim my_emo1 As New Emoji("")
Dim my_emo2 As New Emoji("")
Await msg.AddReactionAsync(my_emo1)
Await msg.AddReactionAsync(my_emo2)
End Sub