【发布时间】:2019-07-19 20:47:05
【问题描述】:
我使用 Discord.net (V1.0.1),
尝试转换 (v0.9.6) 但遇到错误。(删除最后一条消息)
(v0.9.6) 代码 Image
我的代码:
Private Async Function onMsg(message As SocketMessage) As Task
If message.Source = MessageSource.Bot Then
'nothing
Else
If message.Content.Contains("clear") Then
Dim mssg() As Discord.MessageSource = Await DeleteMessagesAsync(100)
End If
End If
End Function
错误:严重性代码描述项目文件行抑制状态 错误 BC30451 'DeleteMessagesAsync' 未声明。由于其保护级别,它可能无法访问。
【问题讨论】:
-
您正在寻找的方法在 ITextChannel 下作为 DeleteMessagesAsync。看这个方法的文档here
-
我已经看过了,但还是很难理解哦
-
您需要做的是使用GetMessagesAsync通过文本通道实例获取您希望删除的消息,然后将所述消息传递给
DeleteMessagesAsync方法。
标签: .net discord.net