void MenuToolsCountClick(object sender, System.EventArgs e) { string u = Convert.ToString(pi.countMindMemory()); outputBox.AppendText("Bot's current memory size: " + u + " \n"); presentLine++; }
private static void listenToCommands(IrcEventArgs e) { if (e.Data.MessageArray.Length > 1) { switch (e.Data.MessageArray[1]) { // debug stuff case "list": { string a = "list, gc, set, join, relay, rename, any, flood, part, die, settings, size, met, help"; irc.SendMessage(SendType.Message, e.Data.Nick, a); break; } case "gc": { GC.Collect(); irc.SendMessage(SendType.Message, e.Data.Nick, "I garbage collected..."); break; } case "help": { if (e.Data.MessageArray.Length > 2) { showHelpForCommand(e); } else { string a = "missing parameter. syntax is -> 'cmd: help command'. Try 'cmd: list' to start with..."; irc.SendMessage(SendType.Message, e.Data.Nick, a); } break; } case "rename": { if (e.Data.MessageArray.Length > 2) { string a = "not possible with IRC, my master. Try new Login!"; irc.SendMessage(SendType.Message, e.Data.Nick, a); } else { string a = "missing parameter. syntax is -> 'cmd: rename newname'"; irc.SendMessage(SendType.Message, e.Data.Nick, a); } break; } case "size": { int size = pi.countMindMemory(); irc.SendMessage(SendType.Message, e.Data.Nick, size.ToString()); break; } case "met": { string a = "I met "; IDictionaryEnumerator ide = sl.GetEnumerator(); while (ide.MoveNext()) { a += ide.Key + ","; } irc.SendMessage(SendType.Message, e.Data.Nick, a); break; } // typical commands case "join": { if (e.Data.MessageArray.Length > 2) { irc.RfcJoin(e.Data.MessageArray[2]); } else { string a = "missing parameter. syntax: cmd join channel"; irc.SendMessage(SendType.Message, e.Data.Nick, a); } break; } case "delay": { if (e.Data.MessageArray.Length > 2) { irc.SendDelay = Convert.ToInt32(e.Data.MessageArray[2]); string a = "set delay value to " + irc.SendDelay; irc.SendMessage(SendType.Message, e.Data.Nick, a); } else { string a = "missing parameter. syntax: 'cmd: delay milliseconds'"; irc.SendMessage(SendType.Message, e.Data.Nick, a); } break; } case "part": { if (e.Data.MessageArray.Length > 2) { irc.RfcPart(e.Data.MessageArray[2]); } else { string a = "missing parameter. syntax: cmd part channel"; irc.SendMessage(SendType.Message, e.Data.Nick, a); } break; } case "settings": { showCurrentBotSettings(e); break; } case "set": { setNewBotSettings(e); break; } case "relay": { if (e.Data.MessageArray.Length > 2) { Spy = e.Data.MessageArray[2]; irc.SendMessage(SendType.Message, e.Data.Nick, "successfully set spy: " + Spy); } else { string a = "missing parameter. syntax: cmd: relayto user"; irc.SendMessage(SendType.Message, e.Data.Nick, a); } break; } case "flood": { if (e.Data.MessageArray.Length > 2) { floodChannel = (e.Data.MessageArray[2] == "on" ? true : false); irc.SendMessage(SendType.Message, e.Data.Nick, (floodChannel == true) ? "flood set to 'on'" : "flood set to 'off'"); } else { string a = "missing parameter. syntax: cmd: flood on|off"; irc.SendMessage(SendType.Message, e.Data.Nick, a); } break; } case "any": { if (e.Data.MessageArray.Length > 2) { allowAny = (e.Data.MessageArray[2] == "on" ? true : false); } else { string a = "missing parameter. syntax: cmd: any on|off"; irc.SendMessage(SendType.Message, e.Data.Nick, a); } break; } case "pm": { if (e.Data.MessageArray.Length > 2) { TargetUser = e.Data.MessageArray[2]; irc.RfcPrivmsg(TargetUser, "hi there!"); allowPrivateMessages = true; } else { string a = "You did not specify a target user (like 'cmd: pm user') - " + "so i guess you want to allow pm for anyone. i set it to true. You" + "being already in pm mode, i start chatting with you now!"; allowPrivateMessages = true; allowAny = true; irc.SendMessage(SendType.Message, e.Data.Nick, a); irc.RfcPrivmsg(e.Data.Nick, "hi there, master!"); } break; } case "die": Exit(); break; default: { string a = "available commands are: list, gc, set, " + "join, relay, rename, any, flood, part, die, settings, size, met, help"; irc.SendMessage(SendType.Message, e.Data.Nick, a); break; } } } else { string a = "missing parameter. syntax: 'cmd: command [param]'. type 'cmd: list' for a list of available commands."; irc.SendMessage(SendType.Message, e.Data.Nick, a); } }