public void RecievePublicMessage(User from, string to, string message) { string[] msg = message.Split(' '); // Parse as a command if (msg[0].StartsWith("-")) { // -ExternalCommand Params IrcReply.FormatMessage(string.Format("[{0}] <{1}> {2}", this.channel, from.Nick, message), ConsoleColor.Magenta); string command = msg[0].Substring(1); object[] arguments = msg.Length > 1 ? string.Join(" ", msg, 1, msg.Length - 1).Split(' ') : new object[] { }; parent.IssueCommand(this, from, command, arguments); } else if (msg[0].StartsWith("+")) { IrcReply.FormatMessage(string.Format("[{0}] <{1}> {2}", this.channel, from.Nick, message), ConsoleColor.Yellow); string command = msg[0].Substring(1); object[] arguments = msg.Length > 0 ? string.Join(" ", msg, 1, msg.Length - 1).Split(' ') : new object[] { }; CoreCommands.Execute(command, this.parent, this, from.Nick, arguments); } else // Just display the message in a specified colour { IrcReply.FormatMessage(string.Format("[{0}] <{1}> {2}", this.channel, from.Nick, message), ConsoleColor.Green); } }
private void Irc_OnPrivateMessage(User from, string to, string message) { string[] msg = message.Split(' '); if (msg[0].StartsWith(".")) { // This is a private command, We won't display messages here string command = msg[0].Substring(1); object[] arguments = msg.Length > 1 ? string.Join(" ", msg, 1, msg.Length - 1).Split(' ') : new object[] { }; CoreCommands.Execute(command, this, null, from.Nick, arguments); } else { Format("<{0}> {1}", ConsoleColor.DarkRed, from.Nick, message); } }
private static void Main(string[] args) { if (!SanityCheck( )) { Console.WriteLine("The bot has failed to complete its sanity check...\r\nPlease press any key to exit the Bot..."); Console.ReadKey(true); return; } // Start the timer on ground zero global::BlizzetaZero.Kernel.Global.BeginUptime( ); // Auth.Authenticate(); Thread t = new Thread ( new ThreadStart ( LaunchGamePanel ) ); // t.Start ( ); Console.Title = Global.Title; Console.WindowWidth += 60; _settings = new Settings( ); CoreCommands.IncludeBuiltInCommands( ); SetCharSet( ); CarpeDiem( ); Irc irc = new Irc(Global.Nick, Global.Realname, Global.Username, "", Global.IrcServer, Global.ServerPassword, Global.Port, RFC1459.ReplyCode.ERR_UNKNOWNMODE, ConsoleColor.Green, "#blizzardothegreat", "", "blizzardothegreat", "#blizzetabot", ""); try { irc.OnMotd += irc_OnMotd; irc.Connect(irc.Host); } catch (Exception e) { Console.WriteLine(e.Message); } }
private static void Main(string[] args) { Console.WindowWidth += 60; CoreCommands.IncludeBuiltInCommands( ); SetCharSet( ); Irc irc = new Irc("BlizzetaZero", "Blizzeta Zero Bot 7.0", "Blizzeta", "#Blizzeta"); try { irc.Colour = ConsoleColor.Green; irc.OnMotd += irc_OnMotd; irc.Connect("irc.ringoflightning.net"); } catch (Exception e) { Console.WriteLine(e.Message); } }