Beispiel #1
0
        private void RegisterCommands()
        {
            Log.Logger.Debug("Registering commands");
            var commandsNextConfiguration = new CommandsNextConfiguration
            {
                StringPrefixes = Settings.Prefixes,
                Services       = Services
            };

            CommandsNext = Discord.UseCommandsNext(commandsNextConfiguration);
            CommandsNext.SetHelpFormatter <CustomHelpFormatter>();

            // Registering command classes
            CommandsNext.RegisterCommands <UserCommands>();
            CommandsNext.RegisterCommands <AdminCommands>();
            CommandsNext.RegisterCommands <DemonstrationCommands>();
            CommandsNext.RegisterCommands <RecognizerCommands>();
            CommandsNext.RegisterCommands <FunCommands>();
            CommandsNext.RegisterCommands <OsuCommands>();

            var slashCommandsConfiguration = new SlashCommandsConfiguration()
            {
                Services = Services
            };

            SlashCommands = Discord.UseSlashCommands(slashCommandsConfiguration);

            // Register slash commands modules
            SlashCommands.RegisterCommands <OsuSlashCommands>(WAV_UID);

            // Registering OnCommandError method for the CommandErrored event
            CommandsNext.CommandErrored += OnCommandError;
        }
Beispiel #2
0
 public void ToggleChat()
 {
     IsChatting = !IsChatting;
     if (IsChatting || CurrentChatText.Length <= 0)
     {
         return;
     }
     if (CurrentChatText.StartsWith("/"))             //this is a client command that shouldnt be sent to the server
     {
         SlashCommands.ProcessSlashCommand(CurrentChatText);
     }
     else             //send this text to the server
     {
         new ChatMsg(Game.Player.Id, CurrentChatText).Send();
     }
     CurrentChatText = "";
 }
Beispiel #3
0
        public async Task ResetSlashCommands()
        {
            await SlashCommands.ResetCommandsAsync(_client);

            await ReplyAsync("Slash commands were reset. Please give it some time for the changes to take effect.");
        }