-1
Here’s the thing I’ve been looking for how I can make a bot that responds when I receive a message from someone, I found a tutorial but I couldn’t get the bot to respond despite the bot responding in the tutorial.
This is the code I have for the bot to answer.
public void MsgStatus(ChatMessage pMessage, TChatMessageStatus Status)
{
if (Status == TChatMessageStatus.cmsReceived || Status == TChatMessageStatus.cmsSent)
{
string msg = pMessage.Body;
Chat c = pMessage.Chat;
if (msg.StartsWith(Trigger))
{
ListBox.Items.Add(DateTime.Now.ToLongTimeString() + ":" + "command" + "'" + msg + "'" + "from" + pMessage.Sender.Handle);
msg = msg.Remove(0, 1).ToLower();
}
if (msg == Trigger + "help")
{
c.SendMessage("working");
}
else if (msg == "hello")
{
c.SendMessage("hello");
}
else if (msg == "oi" || msg == "ola" || msg == "olá")
{
c.SendMessage("Oi");
}
}
}
That’s how he starts
oSkype.MessageStatus += new SKYPE4COMLib._ISkypeEvents_MessageStatusEventHandler(MsgStatus);
What is the tutorial link? The operating system and skype version of the tutorial are the same as yours?
– rubStackOverflow
@rubStackOverflow yes but I had to convert the entire code from Vb to c# https://www.youtube.com/watch?v=ahkuYT7-wdU
– Pedro
After much research I found this website that explains well and works I hope it helps you.
– Pedro
Hello, welcome to SOPT. This site is not a forum. If you haven’t done it yet, do the [tour] and read [Ask]. So your question would need to have a clear and objective problem. You say the Bot does not answer, but does it run? Have you debugged the code? Is there an error message? Without these details, hardly anyone will be able to help you.
– Luiz Vieira
@Luizvieira has been there for weeks you think I remember. is not the best time to ask this
– Pedro