【发布时间】:2019-06-25 01:46:06
【问题描述】:
您好,如果使用(onmsg 函数)在特定通道 ID 中创建消息,我会尝试获取通知。 (机器人运行时)
我的代码。
If message.Source = MessageSource.Bot Then
'ignore
Else
Dim msg As String = message.Content
If message.Content.Contains("hello") Then
If discord.Channel.id = "123456789" Then
'send message by bot to the channel
'Await message.Channel.SendMessageAsync("Sended in correcctly channel")
'get notification
MessageBox.Show("Sended in correcctly channel")
End If
End If
End If
严重性代码描述项目文件行抑制状态 错误 BC30456 'Channel' 不是 'DiscordSocketClient' 的成员。测试 C:\Users\diana\Desktop\1\Test\Test\Form1.vb 125 活动
【问题讨论】:
-
嗨戴安娜!您能否在帖子中包含您遇到的错误或您遇到的具体问题?
-
@EvanM 完成。 (当我运行机器人时,如果在特定频道 ID“123456789”中找到“你好”,则会显示 message.show,更新帖子
-
您的
discord变量是DiscordSocketClient的一个实例,当您考虑它时,为什么Channel不存在是合乎逻辑的。您如何从客户可能可以访问的数千个频道中获取频道?在这种情况下,您正在寻找message.Channel,而不是discord.Channel。 -
@StillH.,谢谢它的工作,你能把它作为已回答的问题发布,...
标签: .net discord.net