internal bot(IRCBot.bot_controller main, BotConfig new_conf) { controller = main; Conf = new_conf; init_bot(); }
private void txtInput_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (txtInput.Text == null || txtInput.Text.Trim() == "") { return; } string text = txtInput.Text.Trim(); string newtext = text; if (txtInput.Text[0] == '#') { newtext = text.Remove(0, 1).Trim(); Player.GlobalMessageOps("Aux Ops -" + Server.DefaultColor + "Console [&a" + Server.ZallState + Server.DefaultColor + "]&f- " + newtext); Server.s.Log("(OPs): Console: " + newtext); IRCBot.Say("Console: " + newtext, true); // WriteLine("(OPs):<CONSOLE> " + txtInput.Text); txtInput.Clear(); } else { Player.GlobalMessage("Console [&a" + Server.ZallState + Server.DefaultColor + "]: &f" + txtInput.Text); IRCBot.Say("Console [" + Server.ZallState + "]: " + txtInput.Text); WriteLine("<CONSOLE> " + txtInput.Text); txtInput.Clear(); } } }
public static void Enqueue(PageEntry entry) { m_List.Add(entry); m_KeyedBySender[entry.Sender] = entry; bool isStaffOnline = false; foreach (NetState ns in NetState.Instances) { Mobile m = ns.Mobile; if (m != null && m.AccessLevel >= AccessLevel.Counselor && m.AutoPageNotify && !IsHandling(m)) { m.SendMessage("A new page has been placed in the queue."); } if (m != null && m.AccessLevel >= AccessLevel.Counselor && m.AutoPageNotify && m.LastMoveTime >= (DateTime.Now - TimeSpan.FromMinutes(10.0))) { isStaffOnline = true; } } IRCBot.NotifyOps(entry); if (!isStaffOnline) { entry.Sender.SendMessage("We are sorry, but no staff members are currently available to assist you. Your page will remain in the queue until one becomes available, or until you cancel it manually."); } if (Email.SpeechLogPageAddresses != null && entry.SpeechLog != null) { SendEmail(entry); } }
public Dictionary <string, User> Users; //Dictionary of users currently being processed public SendQueue(IRCBot launcher) { this.Users = new Dictionary <string, User>(); this.UserQueue = new ConcurrentQueue <User>(); this.tim = new Timer(WorkerTick, null, Timeout.Infinite, 450); this.host = launcher; }
public static void handleChat(string s) { string st = ""; switch (s[0]) { case '!': case '/': handleComm(s.Remove(0, 1)); break; case '@': st = s.Remove(0, 1).Trim(); string[] words = st.Split(new char[] { ' ' }, 2); Player who = Player.Find(words[0]); if (who == null) { Console.WriteLine("Player could not be found!"); handleChat(Console.ReadLine()); return; } who.SendMessage("&bFrom Console: &f" + words[1]); Server.s.Log("(whispers to " + who.name + ") <CONSOLE> " + words[1]); if (!Server.devs.Contains(who.name.ToLower())) { Player.GlobalMessageDevs("To Devs &f-" + Server.DefaultColor + "Console &b[>] " + who.color + who.name + "&f- " + words[1]); } //AllServerChat.Say("(whispers to " + who.name + ") <CONSOLE> " + words[1]); break; case '#': st = s.Remove(0, 1); Player.GlobalMessageOps("To Ops &f-" + Server.DefaultColor + " Console [&a" + Server.ZallState + Server.DefaultColor + "]&f- " + st); Server.s.Log("(OPs): Console: " + st); //Server.s.OpLog("Console: " + text); IRCBot.Say("Console [" + Server.ZallState + "]: " + st, true); //AllServerChat.Say("(OPs) Console [" + Server.ZallState + "]: " + st); break; case ';': st = s.Remove(0, 1); Player.GlobalMessageAdmins("To Admins &f-" + Server.DefaultColor + " Console [&a" + Server.ZallState + Server.DefaultColor + "]&f- " + st); Server.s.Log("(Admins): Console: " + st); //Server.s.OpLog("Console: " + text); //IRCBot.Say("Console [" + Server.ZallState + "]: " + st, true); //AllServerChat.Say("(Admins) Console [" + Server.ZallState + "]: " + st); break; default: Player.GlobalChat(null, "Console [&a" + Server.ZallState + Server.DefaultColor + "]: &f" + s, false); Server.s.Log("<CONSOLE> " + s); IRCBot.Say("Console [" + Server.ZallState + "]: " + s); break; } handleChat(Console.ReadLine()); }
public void StartIRC() { IRCBot bot = new IRCBot("Mona", "irc.freenode.net", 7000); bot.AddChannel("#ubuntu-cn"); bool connect = bot.Connect(); if (connect) { bot.SendGlobalMessage("Hello, world!"); } }
public override void Message(byte type, string message) { message = IRCBot.ConvertMessage(message); if (IRCChannel != null) { Bot.Message(IRCChannel, message); } else { Bot.Pm(IRCNick, message); } }
static void Main() { var ircBot = new IRCBot( userNick: "OsminoqBot", userInfo: "USER CSharpBot 8 *:I'm a C# irc bot", channel: "#root-me_challenge", server: "irc.root-me.org", port: 6667 ); ircBot.Start(receiverNick: "CANDY"); }
public IRCPlayer(string ircChannel, string ircNick, IRCBot bot) : base("IRC") { group = Group.Find(ServerConfig.IRCControllerRank); if (group == null) { group = Group.NobodyRank; } IRCChannel = ircChannel; IRCNick = ircNick; color = "&a"; Bot = bot; if (ircNick != null) { DatabaseID = NameConverter.InvalidNameID("(IRC " + ircNick + ")"); } }
public void Blockchange(Player p, ushort x, ushort y, ushort z, byte type) { try { if (x >= width || y > depth || z >= height) { p.Kick("Building outside boundaries!"); return; } if (y == depth) { return; } byte b = GetTile(x, y, z); if (Block.Convert(b) != Block.Convert(type)) //Should save bandwidth sending identical looking blocks, like air/op_air changes. { Player.GlobalBlockchange(this, x, y, z, type); } if (b == Block.sponge && (Physics == Physics.Normal || Physics == Physics.Advanced) && type != Block.sponge) { PhysSpongeRemoved(PosToInt(x, y, z)); } SetTile(x, y, z, type); //Updates server level blocks if (Physics > 0) { if (Block.Physics(type)) { AddCheck(PosToInt(x, y, z)); } } changed = true; } catch (Exception e) { Logger.Log(p.name + " has triggered a block change error in Map on " + name, LogType.Error); Logger.Log(e.Message, LogType.ErrorMessage); Player.GlobalMessageOps(p.name + " has triggered a block change error in level.cs on " + name); IRCBot.Say(p.name + " has triggered a block change error in level.cs on " + name); } }
public void HandleChat(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { string text = txtInput.Text.Trim(); switch (text[0]) { case '/': if (text == "/") { Log("No command entered."); txtInput.Clear(); return; } HandleCommand(text.Remove(0, 1)); break; case '#': text = text.Remove(0, 1); Player.GlobalMessageOps("To Ops &f-" + Server.DefaultColor + " Console [&a" + Server.ZallState + Server.DefaultColor + "]&f- " + text); //WriteLine("(OPs): Console: " + text); Server.s.Log("(OPs): Console: " + text); //Server.s.OpLog("Console: " + text); IRCBot.Say("Console: " + text, true); //AllServerChat.Say("(OPs) Console [" + Server.ZallState + "]: " + text); MCDawn.Gui.Window.thisWindow.WriteOpLine("<CONSOLE>" + text); break; case ';': text = text.Remove(0, 1); Player.GlobalMessageAdmins("To Admins &f-" + Server.DefaultColor + " Console [&a" + Server.ZallState + Server.DefaultColor + "]&f- " + text); Server.s.Log("(Admins): Console: " + text); //WriteLine("(Admins): Console: " + text); //Server.s.AdminLog("Console: " + text); //IRCBot.Say("Console: " + text, true); //AllServerChat.Say("(Admins) Console [" + Server.ZallState + "]: " + text); MCDawn.Gui.Window.thisWindow.WriteAdminLine("<CONSOLE>" + text); break; case '@': text = text.Remove(0, 1).Trim(); string[] words = text.Split(new char[] { ' ' }, 2); Player who = Player.Find(words[0]); if (who == null) { Server.s.Log("Player could not be found!"); txtInput.Clear(); return; } who.SendMessage("&bFrom Console: &f" + words[1]); Server.s.Log("(whispers to " + who.name + ") <CONSOLE> " + words[1]); //WriteLine("(whispers to " + who.name + ") <CONSOLE> " + words[1]); if (!Server.devs.Contains(who.name.ToLower())) { Player.GlobalMessageDevs("To Devs &f-" + Server.DefaultColor + "Console &b[>] " + who.color + who.name + "&f- " + words[1]); } //AllServerChat.Say("(whispers to " + who.name + ") <CONSOLE> " + words[1]); break; default: if (String.IsNullOrEmpty(text)) { return; } Player.GlobalChat(null, "Console [&a" + Server.ZallState + Server.DefaultColor + "]:&f " + text, false); IRCBot.Say("Console [" + Server.ZallState + "]: " + text); Server.s.Log("<CONSOLE> " + text); //AllServerChat.Say("Console [" + Server.ZallState + "]: " + text); break; } txtInput.Clear(); } } catch (Exception ex) { Server.ErrorLog(ex); } }
public IRCHandlers(IRCBot bot) { this.bot = bot; ircDefault.group = Group.DefaultRank; }
// Update is called once per frame void Update() { //ChatUpdate foreach (string s in toAdd) { SendMessageToChat(s); } toAdd.Clear(); if (messageList.Count >= maxMessages) { Destroy(messageList[0].textObject.gameObject); messageList.RemoveAt(0); } if (Input.GetKeyDown(KeyCode.Return)) { if (isTyping) { if (!inputAlwaysVisible) { inputField.gameObject.SetActive(false); channelInfo.gameObject.SetActive(false); } if (inputField.text == "") { return; } string message = inputField.text; if (message == "/tableflip") { message = "(╯°□°)╯︵ ┻━┻"; } inputField.text = ""; IRCBot.Send(channels[lastChan], message); string chan = channels[lastChan]; if (chan.Length == 7 && chan.ToUpper() == chan) { chan = "Party"; } if (chan.StartsWith("#")) { SendMessageToChat("[" + chan + "] " + username + ": " + message); } else { SendMessageToChat("<color=lightblue>->" + chan + ": " + message + "</color>"); } } else { channelInfo.gameObject.SetActive(true); channelInfo.text = "Send to " + channels[lastChan]; inputField.gameObject.SetActive(true); inputField.Select(); inputField.ActivateInputField(); } isTyping = !isTyping; } if (Input.GetKeyDown(KeyCode.Tab) && isTyping) { lastChan++; if (lastChan >= channels.Count) { lastChan = 0; } channelInfo.text = "Send to " + channels[lastChan]; } }
public static void handleComm(string s) { if (s == "") { goto handle; } switch (s[0]) { case '/': case '!': // Command string cmd = "", msg = ""; s = s.Remove(0, 1); if (s.IndexOf(' ') != -1) { cmd = s.Split(' ')[0]; msg = s.Substring(s.IndexOf(' ') + 1); } else if (s != "") { cmd = s; } else { WriteLine("CONSOLE: Whitespace commands are not allowed"); goto handle; } try { Command c = Command.all.Find(cmd); if (c != null) { if (c.consoleUsable) { c.Use(null, msg); WriteLine("CONSOLE: USED /" + cmd + " " + msg); } else { WriteLine("CONSOLE: Cannot use /" + cmd); } } else { WriteLine("CONSOLE: Command /" + cmd + " not found"); } } catch (Exception e) { Server.ErrorLog(e); WriteLine("CONSOLE: Failed command"); } break; case '#': // OP Chat s = s.Remove(0, 1); Player.GlobalMessageOps("To Ops &f-" + Server.DefaultColor + "Console [&a" + Server.ZallState + Server.DefaultColor + "]&f- " + s); Server.s.Log("(OPs): Console: " + s); IRCBot.Say("Console: " + s, true); break; case ';': // Admin Chat s = s.Remove(0, 1); Player.GlobalMessageAdmins("To Admins &f-" + Server.DefaultColor + "Console [&a" + Server.ZallState + Server.DefaultColor + "]&f- " + s); Server.s.Log("(Admins): Console: " + s); IRCBot.Say("Console: " + s, true); break; case '\\': // Global Chat s = s.Remove(0, 1); Player.GlobalMessageGC(Server.gcColor + "[Global][" + Server.gcNick + "] Console: &f" + s); Server.s.Log("[Global][" + Server.gcNick + "] Console: " + s); GlobalBot.Say("Console: " + s); break; default: // Chat Player.GlobalMessage("Console [&a" + Server.ZallState + Server.DefaultColor + "]: &f" + s); IRCBot.Say("Console [" + Server.ZallState + "]: " + s); WriteLine("<CONSOLE> " + s); break; } handle: handleComm(Console.ReadLine()); // OLD (MCLawl) MESSAGE HANDLING /* * string sentCmd = "", sentMsg = ""; * * if (s.IndexOf(' ') != -1) * { * sentCmd = s.Split(' ')[0]; * sentMsg = s.Substring(s.IndexOf(' ') + 1); * } * else if (s != "") * { * sentCmd = s; * } * else * { * goto talk; * } * * try * { * Command cmd = Command.all.Find(sentCmd); * if (cmd != null) * { * if (cmd.consoleUsable) * { * cmd.Use(null, sentMsg); * WriteLine("CONSOLE: USED /" + sentCmd + " " + sentMsg); * handleComm(Console.ReadLine()); * } * else * { * WriteLine("CONSOLE: Cannot use /" + sentCmd); * handleComm(Console.ReadLine()); * } * return; * } * } * catch (Exception e) * { * Server.ErrorLog(e); * WriteLine("CONSOLE: Failed command."); * handleComm(Console.ReadLine()); * return; * } * * * talk: handleComm("say " + MCSong.Group.findPerm(LevelPermission.Admin).color + "Console: &f" + s); * handleComm(Console.ReadLine()); */ }
public IRCHandlers(IRCBot bot) { this.bot = bot; }
public Channel(IRCBot bot, string channel) { this.bot = bot; this.channel = channel; this.manager = new UserManagement(this); }
public User(IRCBot bot, string user) { this.bot = bot; this.user = user; }