I am making a Skype bot in C# but I'm having a problem. It isn't reading my own commands, only the commands received by others.
When I add something like "!Resolve (username)" it makes the code all bugged up by bugged up i mean it just crashes the tool when i start it.
Could somebody please look and see if there are any major issues.
private Skype skype;
private const string trigger = "!";
private const string nick = "The OG Bot";
And this
private string ProcessCommand(string str)
{
string result;
switch (str)
{
case "resolve":
result = "Currently Not Working Will Fix Soon.";
break;
case "help":
result = "Here are some commands you can run. \n !resolve \n !date \n !time \n !who \n !swag \n !ip";
break;
case "date":
result = "Current Date is: " + DateTime.Now.ToLongDateString();
break;
case "time":
result = "Current Time is: " + DateTime.Now.ToLongTimeString();
break;
case "who":
result = "This API was created by TehMerkMods";
break;
case "ip":
result = new WebClient().DownloadString("http://icanhazip.com");
break;
case "swag":
result = "(mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) (mm) ";
break;
default:
result = "Sorry, I do not recognize your command";
break;
}
return result;
}
And last of all
private void skype_MessageStatus(ChatMessage msg, TChatMessageStatus status)
{
if (TChatMessageStatus.cmsRead == status)
{
return;
}
if (msg.Body.IndexOf(trigger) == 0 && TChatMessageStatus.cmsReceived == status)
{
string command = msg.Body.Remove(0, trigger.Length).ToLower();
skype.SendMessage(msg.Sender.Handle, nick + " : " + ProcessCommand(command));
}
}