Ejemplo n.º 1
0
        public static void unshun(object o)
        {
            string[] s         = o as string[];
            string   user      = s[0];
            int      sleeptime = Int32.Parse(s[1]);

            System.Threading.Thread.Sleep(sleeptime);
            IrcBot.msg(user, "You are free to speak now.");
        }
Ejemplo n.º 2
0
 public static void threadThink(object o)
 {
     try
     {
         IrcBot.writer.WriteLine("PRIVMSG " + ((string)((List <object>)o)[0]) + " :" + ((ChatterBotSession)((List <object>)o)[1]).Think(((string)((List <object>)o)[2])));
     }
     catch (Exception e)
     {
         IrcBot.msg("#lounge", "Exception at threadthink " + e);
     }
 }
Ejemplo n.º 3
0
 public static void threadBash(object o)
 {
     using (StringReader sr = new StringReader(PingSender.getBash()))
     {
         string result   = "";
         string thisLine = "";
         while ((thisLine = sr.ReadLine()) != null)
         {
             result += thisLine + " ";
         }
         IrcBot.msg((string)o, result);
     }
 }
Ejemplo n.º 4
0
 public static void threadFML(object o)
 {
     IrcBot.msg((string)o, PingSender.getFML());
 }
Ejemplo n.º 5
0
        public static void init1()
        {
            commands.Clear();

            commands.Add("!clever", new CommandPair(new CommandInfo("Talk to cleverbot!", UserLevel.VOICE, 2), delegate(CommandParams cp)
            {
                Utils.initThink(IrcBot.ses, cp.message, cp.channel);
            }));
            commands.Add("!panda", new CommandPair(new CommandInfo("Talk to pandabot!", UserLevel.VOICE, 2), delegate(CommandParams cp)
            {
                Utils.initThink(IrcBot.pan, cp.message, cp.channel);
            }));
            commands.Add("!jabber", new CommandPair(new CommandInfo("Talk to jabberbot!", UserLevel.VOICE, 2), delegate(CommandParams cp)
            {
                Utils.initThink(IrcBot.jab, cp.message, cp.channel);
            }));
            commands.Add("!fml", new CommandPair(new CommandInfo("Feeling down? View an fml!", UserLevel.VOICE), delegate(CommandParams cp)
            {
                Utils.initFML(cp.channel);
            }));
            commands.Add("!bash", new CommandPair(new CommandInfo("those im quotes you don't care about", UserLevel.VOICE), delegate(CommandParams cp)
            {
                Utils.initBash(cp.channel);
            }));
            commands.Add("!join", new CommandPair(new CommandInfo("Join a channel", UserLevel.OP, 2), delegate(CommandParams cp)
            {
                if (!IrcBot.noJoin.Contains(cp.splitted[1].ToLower()))
                {
                    Utils.join(cp.splitted[1]);
                    IrcBot.msg(cp.channel, "Joined " + cp.splitted[1]);
                }
                else
                {
                    IrcBot.msg(cp.channel, cp.splitted[1] + " is on the no join list.");
                }
            }));
            commands.Add("!part", new CommandPair(new CommandInfo("Part a channel", UserLevel.OP, 2), delegate(CommandParams cp)
            {
                Utils.part(cp.splitted[1]);
                IrcBot.msg(cp.channel, "Parted " + cp.splitted[1]);
            }));
            commands.Add("!list", new CommandPair(new CommandInfo("Lists available commands."), delegate(CommandParams cp)
            {
                var e         = from element in commands where cp.invoker >= element.Value.ci.level select element;
                string result = "";
                foreach (var i in e)
                {
                    result += i.Key + ", ";
                }
                IrcBot.msg(cp.channel, result);
            }));
            commands.Add("!help", new CommandPair(new CommandInfo("Gives more info about a command.", UserLevel.NORMAL, 2), delegate(CommandParams cp)
            {
                string cm = "!" + cp.splitted[1];
                if (commands.ContainsKey(cm))
                {
                    if (cp.invoker >= commands[cm].ci.level)
                    {
                        IrcBot.msg(cp.channel, commands[cm].ci.desc);
                    }
                }
            }));
            commands.Add("!google", new CommandPair(new CommandInfo("Returns google link for term(s).", UserLevel.VOICE, 2), delegate(CommandParams cp)
            {
                string repl = cp.message.Replace(" ", "%20");
                IrcBot.msg(cp.channel, "https://www.google.com/search?q=" + repl);
            }));
            commands.Add("!wiki", new CommandPair(new CommandInfo("Returns wikipedia link for term(s).", UserLevel.VOICE, 2), delegate(CommandParams cp)
            {
                string repl = cp.message.Replace(" ", "%20");
                IrcBot.msg(cp.channel, "http://en.wikipedia.org/wiki/" + repl);
            }));
            commands.Add("!report", new CommandPair(new CommandInfo("Report something/someone for a good reason.", UserLevel.NORMAL, 2), delegate(CommandParams cp)
            {
                IrcBot.msg(cp.user, "You have issued a report for the reason '" + cp.message + "'. Opers have been alerted.");
                IrcBot.msg("#lounge", cp.user + " is in need of help for reason '" + cp.message + "'.");
            }));
            commands.Add("!quit", new CommandPair(new CommandInfo("Quit from the server, and close the bot. Requires manual restart, so use with care", UserLevel.ADMIN, 1), delegate(CommandParams cp)
            {
                IrcBot.writer.WriteLine("QUIT");
                Environment.Exit(0);
            }));
            commands.Add("!anjoin", new CommandPair(new CommandInfo("Adds a channel to the no join list. If the bot is currently on the channel, it will part.", UserLevel.ADMIN, 2), delegate(CommandParams cp)
            {
                string chan = cp.splitted[1].ToLower();
                if (chan.StartsWith("#"))
                {
                    IrcBot.noJoin.Add(chan);
                    IrcBot.msg(cp.channel, "Added " + cp.splitted[1] + " to no join list.");
                    Utils.part(chan);
                }
            }));
            commands.Add("!rnjoin", new CommandPair(new CommandInfo("Removes a channel from the no join list. The bot will not auto-join.", UserLevel.ADMIN, 2), delegate(CommandParams cp)
            {
                string chan = cp.splitted[1].ToLower();
                if (chan.StartsWith("#"))
                {
                    IrcBot.noJoin.Remove(chan);
                    IrcBot.msg(cp.channel, "Remove " + cp.splitted[1] + " to no join list.");
                }
            }));
            commands.Add("!lnjoin", new CommandPair(new CommandInfo("Lists current no join channels.", UserLevel.ADMIN), delegate(CommandParams cp)
            {
                string res = "List of no join channels: ";
                foreach (string s in IrcBot.noJoin)
                {
                    res += s + ", ";
                }
                IrcBot.msg(cp.channel, res);
            }));
            commands.Add("!kick", new CommandPair(new CommandInfo("Kicks a user from a channel.", UserLevel.OP, 2), delegate(CommandParams cp)
            {
                string user = cp.splitted[1];
                string chan = cp.channel;
                cp.sr.WriteLine("os KICK " + chan + " " + user + " bot kick");
            }));
            commands.Add("!silence", new CommandPair(new CommandInfo("Silences a user. Syntax is !silence <user> <number of minutes>, if the minutes is not specified it defaults to 5.", UserLevel.OP, 2), delegate(CommandParams cp)
            {
                string user = cp.splitted[1];
                int time    = 5;
                if (cp.splitted.Length > 2)
                {
                    Int32.TryParse(cp.splitted[2], out time);
                }
                IrcBot.msg(user, "You have been silenced for " + time + " minutes. You will not recieve messages or be able to chat until the silence expires.");
                cp.sr.WriteLine("shun " + user + " " + time + "m1s :botsilence");
                Thread t       = new Thread(new ParameterizedThreadStart(unshun));
                t.IsBackground = true;
                t.Start(new string[] { user, (1000 * 60 * time).ToString() });
            }));
        }