Beispiel #1
0
 private static void welcomeNewbieOnJoinEvent(User source, string channel)
 {
     NewbieWelcomer.instance().execute(source, channel);
 }
Beispiel #2
0
        /// <summary>
        /// Actual command logic
        /// </summary>
        /// <param name="source">The user who triggered the command.</param>
        /// <param name="channel">The channel the command was triggered in.</param>
        /// <param name="args">The arguments to the command.</param>
        /// <returns></returns>
        protected override CommandResponseHandler execute(User source, string channel, string[] args)
        {
            var ignore = false;

            switch (args[0].ToLower())
            {
            case "enable":
                if (Configuration.singleton()["welcomeNewbie", channel] == "true")
                {
                    return(new CommandResponseHandler(new Message().get("no-change")));
                }
                Configuration.singleton()["welcomeNewbie", channel] = "true";
                return(new CommandResponseHandler(new Message().get("done")));

            case "disable":
                if (Configuration.singleton()["welcomeNewbie", channel] == "false")
                {
                    return(new CommandResponseHandler(new Message().get("no-change")));
                }
                Configuration.singleton()["welcomeNewbie", channel] = "false";
                return(new CommandResponseHandler(new Message().get("done")));

            case "global":
                Configuration.singleton( )["welcomeNewbie", channel] = null;
                return(new CommandResponseHandler(new Message().get("defaultSetting")));

            case "add":
                if (args[1] == "@ignore")
                {
                    ignore = true;
                    GlobalFunctions.popFromFront(ref args);
                }

                NewbieWelcomer.instance().addHost(args[1], ignore);
                return(new CommandResponseHandler(new Message().get("done")));

            case "del":
                if (args[1] == "@ignore")
                {
                    ignore = true;
                    GlobalFunctions.popFromFront(ref args);
                }

                NewbieWelcomer.instance().delHost(args[1], ignore);
                return(new CommandResponseHandler(new Message().get("done")));

            case "list":
                if (args[1] == "@ignore")
                {
                    ignore = true;
                    GlobalFunctions.popFromFront(ref args);
                }

                var      crh  = new CommandResponseHandler();
                string[] list = NewbieWelcomer.instance().getHosts(ignore);
                foreach (string item in list)
                {
                    crh.respond(item);
                }
                return(crh);
            }
            return(new CommandResponseHandler());
        }