我正在尝试制作 skypebot,但我一直在检测消息发件人姓名
就像我试图发出命令一样!帮助管理员。并且只有管理员文本框上的人,他们的名字才能使用它,比如他是否给出命令,如果不是,那么它只会打印“无法访问此命令”之类的内容
Private Sub skype_MessageStatus(ByVal msg As ChatMessage, ByVal status As TChatMessageStatus)
Dim Trigger As String = "!"
Dim BotName As String = "@PandyBot"
Dim Message As String
Try
If status = TChatMessageStatus.cmsReceived Or status = TChatMessageStatus.cmsSent Then
Message = msg.Body
If Message.StartsWith(Trigger) Then
Message = Message.Remove(0, 1)
msg.Chat.SendMessage(BotName & ": " & ParseMessage(Message))
End If
End If
Catch ex As Exception
End Try
End Sub
Function ParseMessage(ByVal message As String) As String
Dim msg As String = "Command not regonized!"
Select Case message
Case "test"
msg = "Is working correctly"
Case "help"
msg = "use !help user or !help admin"
Case "help admin"
If
msg = "!poll, !jail, !murder, !ban"
Else
msg = " lol1"
End If
Case "help user"
msg = "!test, !time, !date, !credits, secret"
Case "date"
msg = "Current Date is: " & DateTime.Now.ToLongDateString()
Case "time"
msg = "Current Time is: " & DateTime.Now.ToLongTimeString()
Exit Select
End Select
Return msg
End Function
我已经做的差不多了。