我正在尝试创建一个简单的Skype机器人,当用户发送带有该选项的消息时,它会给出响应。
我的问题是,当用户以"!resolve username"
回复时,它会尝试解析整个字符串。
我如何从响应中选择用户名并将其放在变量中?
ElseIf msg = "resolve" Or msg = "Resolve" Then
'send the usernamer to sever and saves response in var
Dim resolvedIP As String = New System.Net.WebClient().DownloadString(
"http://api.c99.nl/skyperesolver.php?key=korrupted.1020ull&username=" +
pMessage.Body)
'prints IP
c.SendMessage(resolvedIP)
答案 0 :(得分:2)
这是你需要的东西吗?
Dim username = _
Regex _
.Match("!resolve user3812866", "^!resolve (.*)$", RegexOptions.IgnoreCase) _
.Groups(1) _
.Value
现在username
等于"user3812866"
。