Start New Discussion within our Software Development Community
// teachers I have problems with this code, when I sent !q the bot sent all questions and all choices, Please I want someone edit this bot when I sent !q sends only the first question, and when I sent !q again sends the second question . notice * I want the same command and not different * 


if (data.ToLower().StartsWith("!q"))              
             {
                 con.SendRoomTextMessage(targetid, "What is the most expensive metals in the world?");
                 con.SendRoomTextMessage(targetid, "A - Gold \nB - iron \nC - radium .");
             }
             else if (data.ToLower().StartsWith("radium") == true)
             {
                 con.SendRoomTextMessage(targetid, "true answer :d");
             }
             else 
             {
                 con.SendRoomTextMessage(targetid, "False answer :p");
             }
if (data.ToLower().StartsWith("!q"))
             {
                 con.SendRoomTextMessage(targetid, "What is the universal language ?");
                 con.SendRoomTextMessage(targetid, "A - English \nB - Arabic \nC - French .");
             }
             else if (data.ToLower().StartsWith("engilsh") == true)
             {
                 con.SendRoomTextMessage(targetid, "true answer :d");
             }
             else 
             {
                 con.SendRoomTextMessage(targetid, "False answer :p");
             }           

You have to update your condition. Currently you are checking on if the message is !q you are sending all the questions as the conditions are all true. You might like to use a Queue; and make this decisions a bit Dynamic than now.

This article has been dead for over six months. Start a new discussion instead.