Beispiel #1
0
 public IrcFunctions(CSharpBot bot)
 {
     this.CSharpBot = bot;
 }
Beispiel #2
0
 void CSharpBot_Kicked(CSharpBot bot, string source, string channel)
 {
     if (bot.RejoinOnKick)
         bot.Functions.Join(channel);
 }
Beispiel #3
0
 void CSharpBot_NumericReplyReceived(CSharpBot bot, IrcNumericReplyLine reply)
 {
     if (reply.ReplyCode == IrcReplyCode.ERR_NEEDTOBEREGISTERED) // Error code from GeekShed IRC Network
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Functions.Log("Private messaging is not available, since we need to identify ourself successfully.");
         Console.ForegroundColor = ConsoleColor.Yellow;
     }
     else if (reply.ReplyCode == IrcReplyCode.RPL_MOTD)
     {
         motdlines.Add(reply.Message);
     }
     else if (reply.ReplyCode == IrcReplyCode.RPL_ENDOFMOTD)
     {
         if (DebuggingEnabled)
         {
             Console.ForegroundColor = ConsoleColor.Yellow;
             Functions.Log("MOTD received.");
             Console.ResetColor();
         }
         Functions.Log("Applying optimal flags...");
         Functions.WriteData("MODE " + NICK + " +B"); // We are a bot
         Functions.WriteData("MODE " + NICK + " +w"); // We want to get wallops, if any
         Functions.WriteData("MODE " + NICK + " -i"); // We don't want to be invisible
         Functions.Log("Joining " + CHANNEL + "...");
         Functions.WriteData("JOIN " + CHANNEL);
         currentchan = CHANNEL;
         if (config.ServerPassword != "")
             Functions.Pass(config.ServerPassword);
         if (config.NickServPassword != "")
         {
             Functions.Log("Identifying through NickServ...");
             if (config.NickServAccount != "")
             {
                 Functions.PrivateMessage("NickServ", "IDENTIFY " + config.NickServAccount + " " + config.NickServPassword);
             }
             else
             {
                 Functions.PrivateMessage("NickServ", "IDENTIFY " + config.NickServPassword);
             }
         }
     }
 }
Beispiel #4
0
        /// <summary>
        /// Our entry point for execution.
        /// </summary>
        /// <param name="args">Command line parameters</param>
        static void Main(string[] args)
        {
            Console.ResetColor();
            Console.WriteLine("CSharpBot v" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
            Console.WriteLine("\t(c) Merbo August 3, 2011-Present");
            Console.WriteLine("\t(c) Icedream August 5, 2011-Present");
            Console.WriteLine("\t(c) peapodamus August 7, 2011-Present");
            Console.WriteLine();

            // The bot itself
            bot = new CSharpBot();
            bot.ParseArguments(args);
            bot.Run();

            Console.WriteLine("Bot is now running.");
            Console.WriteLine();

            Application.EnableVisualStyles();
            Application.Run(cwin);
        }