Пример #1
0
        public override ApplicationCommandProperties Build()
        {
            var builder = new SlashCommandBuilder()
                          .WithName(this.Name)
                          .WithDescription(this.Description)
                          .WithDefaultPermission(this.DefaultPermissions);

            SlashCommandOptionBuilder optionBuilder = new SlashCommandOptionBuilder()
            {
                Name        = "configure",
                Description = "Gets all match history for a team or teams.",
                Type        = ApplicationCommandOptionType.SubCommand
            };

            optionBuilder.AddOption(
                name: "configuration",
                type: ApplicationCommandOptionType.String,
                description: "The full JSON configuration for the CEA bot.",
                isRequired: true);


            builder.AddOption(optionBuilder);

            return(builder.Build());
        }
Пример #2
0
        public override SlashCommandProperties Build()
        {
            var addCmd = new SlashCommandOptionBuilder()
            {
                Name        = "add",
                Description = "Add your RL tracker for the next season of CEA!",
                Type        = ApplicationCommandOptionType.SubCommand
            };

            addCmd.AddOption("platform",
                             ApplicationCommandOptionType.String,
                             "Platorm you play on",
                             required: true,
                             choices:
                             new ApplicationCommandOptionChoiceProperties[] { new ApplicationCommandOptionChoiceProperties()
                                                                              {
                                                                                  Name = "epic", Value = "Epic"
                                                                              },
                                                                              new ApplicationCommandOptionChoiceProperties()
                                                                              {
                                                                                  Name = "steam", Value = "Steam"
                                                                              },
                                                                              new ApplicationCommandOptionChoiceProperties()
                                                                              {
                                                                                  Name = "playstation", Value = "Playstation"
                                                                              },
                                                                              new ApplicationCommandOptionChoiceProperties()
                                                                              {
                                                                                  Name = "xbox", Value = "Xbox"
                                                                              },
                                                                              new ApplicationCommandOptionChoiceProperties()
                                                                              {
                                                                                  Name = "tracker", Value = "Tracker"
                                                                              } });
            addCmd.AddOption("id", ApplicationCommandOptionType.String, "For steam use your id, others use username, tracker post full tracker", required: true);


            var builder = new SlashCommandBuilder()
                          .WithName(this.Name)
                          .WithDescription(this.Description)
                          .WithDefaultPermission(this.DefaultPermissions)
                          .AddOption(addCmd);

            return(builder.Build());
        }
Пример #3
0
        private SlashCommandOptionBuilder BuildNestedCommandGroup()
        {
            SlashCommandOptionBuilder builder = new SlashCommandOptionBuilder();

            builder.WithName(commandGroupInfo.groupName);
            builder.WithDescription(commandGroupInfo.description);
            builder.WithType(ApplicationCommandOptionType.SubCommandGroup);
            foreach (var command in Commands)
            {
                builder.AddOption(command.BuildSubCommand());
            }
            foreach (var commandGroup in commandGroups)
            {
                builder.AddOption(commandGroup.BuildNestedCommandGroup());
            }

            return(builder);
        }
Пример #4
0
        public static void AddCommonOptionProperties(SlashCommandOptionBuilder optionBuilder, SlashCommandOptions supportedOptions)
        {
            if (supportedOptions.HasFlag(SlashCommandOptions.team))
            {
                optionBuilder.AddOption(SlashCommandOptions.team.ToString(),
                                        ApplicationCommandOptionType.String,
                                        "Filter command option to a specific team name.");
            }

            if (supportedOptions.HasFlag(SlashCommandOptions.org))
            {
                optionBuilder.AddOption(
                    name: SlashCommandOptions.org.ToString(),
                    type: ApplicationCommandOptionType.String,
                    description: "Filter command option to a specific organization (company).");
            }

            if (supportedOptions.HasFlag(SlashCommandOptions.player))
            {
                optionBuilder.AddOption(
                    name: SlashCommandOptions.player.ToString(),
                    type: ApplicationCommandOptionType.String,
                    description: "Filter command option to a specific player.");
            }

            if (supportedOptions.HasFlag(SlashCommandOptions.week))
            {
                optionBuilder.AddOption(
                    name: SlashCommandOptions.week.ToString(),
                    type: ApplicationCommandOptionType.Integer,
                    description: "Display information for a specific week of the bracket.");
            }

            if (supportedOptions.HasFlag(SlashCommandOptions.post))
            {
                optionBuilder.AddOption(
                    name: SlashCommandOptions.post.ToString(),
                    type: ApplicationCommandOptionType.Boolean,
                    description: "Respond publicly instead of ephemerally.");
            }
        }
Пример #5
0
        /// <summary>
        ///  Build the command AS A SUBCOMMAND and put it in a state in which we can use to define it to Discord.
        /// </summary>
        public SlashCommandOptionBuilder BuildSubCommand()
        {
            var builder = new SlashCommandOptionBuilder();

            builder.WithName(Name);
            builder.WithDescription(Description);
            builder.WithType(ApplicationCommandOptionType.SubCommand);
            builder.Options = new List <SlashCommandOptionBuilder>();

            foreach (var parameter in Parameters)
            {
                builder.AddOption(parameter);
            }

            return(builder);
        }
Пример #6
0
        public override SlashCommandProperties Build()
        {
            // TODO: Add directly to a team
            var addCmd = new SlashCommandOptionBuilder()
            {
                Name        = "adminadd",
                Description = "Add a user to the recruiting board",
                Type        = ApplicationCommandOptionType.SubCommand
            };

            addCmd.AddOption("username", ApplicationCommandOptionType.User, "Username of user to move", isRequired: true);
            addCmd.AddOption("platform",
                             ApplicationCommandOptionType.String,
                             "Platorm you play on",
                             isRequired: true,
                             choices:
                             new ApplicationCommandOptionChoiceProperties[] { new ApplicationCommandOptionChoiceProperties()
                                                                              {
                                                                                  Name = "epic", Value = "Epic"
                                                                              },
                                                                              new ApplicationCommandOptionChoiceProperties()
                                                                              {
                                                                                  Name = "steam", Value = "Steam"
                                                                              },
                                                                              new ApplicationCommandOptionChoiceProperties()
                                                                              {
                                                                                  Name = "playstation", Value = "Playstation"
                                                                              },
                                                                              new ApplicationCommandOptionChoiceProperties()
                                                                              {
                                                                                  Name = "xbox", Value = "Xbox"
                                                                              },
                                                                              new ApplicationCommandOptionChoiceProperties()
                                                                              {
                                                                                  Name = "tracker", Value = "Tracker"
                                                                              } });
            addCmd.AddOption("id", ApplicationCommandOptionType.String, "For steam use your id, others use username, tracker post full tracker", isRequired: true);
            addCmd.AddOption("team", ApplicationCommandOptionType.String, "Team to add this user to. If left blank, defaults to Free Agents", isRequired: false);

            var moveCmd = new SlashCommandOptionBuilder()
            {
                Name        = "move",
                Description = "Move a tracked user to a team.",
                Type        = ApplicationCommandOptionType.SubCommand
            };

            moveCmd.AddOption("username", ApplicationCommandOptionType.User, "Username of user to move", isRequired: true);
            moveCmd.AddOption("team", ApplicationCommandOptionType.String, "Team to move user to", isRequired: true);
            moveCmd.AddOption("captain", ApplicationCommandOptionType.Boolean, "Is this user the captain of the team?", isRequired: false);

            var removeCmd = new SlashCommandOptionBuilder()
            {
                Name        = "remove",
                Description = "Remove a tracked user.",
                Type        = ApplicationCommandOptionType.SubCommand
            };

            removeCmd.AddOption("username", ApplicationCommandOptionType.User, "Username of user to remove", isRequired: true);

            var deleteTeamCmd = new SlashCommandOptionBuilder()
            {
                Name        = "deleteteam",
                Description = "Remove team.",
                Type        = ApplicationCommandOptionType.SubCommand
            };

            deleteTeamCmd.AddOption("team", ApplicationCommandOptionType.String, "Team to remove", isRequired: true);

            var lookingForPlayersCmd = new SlashCommandOptionBuilder()
            {
                Name        = "lookingforplayers",
                Description = "Mark your team as looking for players or not.",
                Type        = ApplicationCommandOptionType.SubCommand
            };

            lookingForPlayersCmd.AddOption("team", ApplicationCommandOptionType.String, "Team to mark as looking for players", isRequired: true);
            lookingForPlayersCmd.AddOption("looking", ApplicationCommandOptionType.Boolean, "Are you looking for new players", isRequired: true);

            var builder = new SlashCommandBuilder()
                          .WithName(this.Name)
                          .WithDescription(this.Description)
                          .WithDefaultPermission(this.DefaultPermissions)
                          .AddOptions(addCmd, moveCmd, removeCmd, deleteTeamCmd, lookingForPlayersCmd);

            return(builder.Build());
        }