Example #1
0
        /// <summary>
        /// Registers the commands.
        /// </summary>
        /// <returns>
        /// The <see cref="IEnumerable{Command}" />.
        /// </returns>
        public override IEnumerable<Command> RegisterCommands()
        {
            var weatherCommand = new Command("!weather", GetWeather)
            {
                LevelRequired = AccessLevel.None,
                Description = "Provides access to detailed up to date weather information",
                Accepts = MessageType.Both,
                Examples = new []
                {
                    "!weather --forecast --conditions --zipcode 310310 --country UK --City London",
                    "!weather --conditions --postcode sm5 2ht",
                    "!weather sm5 2ht",
                    "!weather --lang FR --postcode sm5 2ht",
                }
            };

            weatherCommand.CreateArgument("forecast");
            weatherCommand.CreateArgument("conditions");
            weatherCommand.CreateArgument("postcode");
            weatherCommand.CreateArgument("country");
            weatherCommand.CreateArgument("city");
            weatherCommand.CreateArgument("webcams");
            weatherCommand.CreateArgument("lang");

            return new[] { weatherCommand };
        }
Example #2
0
        /// <summary>
        /// Registers the commands.
        /// </summary>
        /// <returns>
        /// The <see cref="IEnumerable{Command}" />.
        /// </returns>
        public override IEnumerable<Command> RegisterCommands()
        {
            var join = new Command("!join", this.JoinChannel)
                           {
                               Description = "Commands the bot to join a channel on the network.",
                               LevelRequired = AccessLevel.None,
                               Accepts = MessageType.Both
                           };

            join.CreateArgument("channel");
            join.CreateArgument("key");

            var admins = new Command("!admins", this.ListAdmins)
                             {
                                 LevelRequired = AccessLevel.None,
                                 Accepts = MessageType.Both,
                                 Description = "Lists information about the admins of the bot",
                             };

            return new[] { join, admins };
        }
Example #3
0
        /// <summary>
        /// Registers the commands.
        /// </summary>
        /// <returns>
        /// The <see cref="IEnumerable{Command}" />.
        /// </returns>
        public override IEnumerable<Command> RegisterCommands()
        {
            var listModules = new Command("!modules", this.ListModules)
                                      {
                                          Description = "Provides information about the modules of the bot.",
                                          Examples = new [] { "!modules --list", "!modules --root", "!modules --examples" },
                                          LevelRequired = AccessLevel.None
                                      };

            IEnumerable<AccessLevel> accessLevels = Enum.GetValues(typeof(AccessLevel)).Cast<AccessLevel>();
            accessLevels.Do((level, i) => listModules.CreateArgument(level.ToString(), null));

            listModules.CreateArgument("examples");

            var listCommands = new Command("!module", this.ListCommands)
                                       {
                                           Description = "Lists the commands of a given module.",
                                           LevelRequired = AccessLevel.None,
                                           Accepts = MessageType.Both,
                                           Examples = new[]
                                                          {
                                                              "!module --module info",
                                                              "!module --module info --dice --weather",
                                                              "!module --dice"
                                                          }
                                       };

            foreach (var module in this.IrcClient.Modules)
            {
                listCommands.CreateArgument(module.Name, null);
            }

            listModules.CreateArgument("name");

            return new[] { listModules, listCommands };
        }
Example #4
0
        /// <summary>
        /// Registers the commands.
        /// </summary>
        /// <returns>
        /// The <see cref="IEnumerable{Command}" />.
        /// </returns>
        public override IEnumerable<Command> RegisterCommands()
        {
            var start = new Command("!bj start", (user, channel, type, format, message, arguments) => this.StartCommand(user, channel))
            {
                Accepts = MessageType.Both,
                Examples = new[] { "To start the game, use !bj --start" },
                Description = "Starts a new blackjack game in the current channel.",
                LevelRequired = AccessLevel.User,
            };

            var stop = new Command("!bj stop", (user, channel, type, format, message, arguments) => this.StopCommand(user, channel))
            {
                Accepts = MessageType.Both,
                Description = "Stops the blackjack game.",
                Examples = new[] { "Stops the blackjack game in the current channel." },
                LevelRequired = AccessLevel.User,
            };

            var hit = new Command("!hit", (user, channel, type, format, message, arguments) => this.HitCommand(user, channel))
            {
                Accepts = MessageType.Both,
                Description = "Performs a hit, instructing the dealer to deal you another card.",
                LevelRequired = AccessLevel.None,
                Examples = new[] { "!hit" },
            };

            var stand = new Command("!stand", (user, channel, type, format, message, arguments) => this.StandCommand(user, channel))
            {
                Accepts = MessageType.Both,
                Description = "Performs a stand, instructing the dealer that you are standing on your current cards",
                Examples = new[] { "!stand" },
                LevelRequired = AccessLevel.None,
            };

            var join = new Command("!join", (user, channel, type, format, message, arguments) => this.JoinCommand(user, channel))
            {
                Accepts = MessageType.Both,
                LevelRequired = AccessLevel.Guest,
                Description = "Instructs the dealer that you join the table.",
                Examples = new[] { "!join" },
            };

            return new[] { start, stop, hit, stand, join };
        }