Exemple #1
0
            public async Task ChangePrefixCommand(string newPrefix)
            {
                BotConfigService.SetPrefix(newPrefix);

                await Respond.SendResponse(Context, $"My new prefix is now: `{newPrefix}`!");
            }
Exemple #2
0
            public async Task ShutdownCommand()
            {
                await Respond.SendResponse(Context, ":thumbsup:");

                Environment.Exit(1);
            }
Exemple #3
0
 public async Task InviteCommand()
 {
     await Respond.SendResponse(Context, "https://discordapp.com/api/oauth2/authorize?client_id=401994184602681344&permissions=8&scope=bot");
 }
Exemple #4
0
 public async Task RandomCommand(int one, int two)
 {
     await Respond.SendResponse(Context, new Random().Next(one, two).ToString());
 }
Exemple #5
0
        public async Task FlipCoinCommand()
        {
            var _r = new Random().Next(0, 1);

            await Respond.SendResponse(Context, $"{(_r == 0 ? "Heads" : "Tails")}.");
        }
Exemple #6
0
 public async Task PingCommand()
 => await Respond.SendResponse(Context, $"Pong! `{Context.Client.Latency}ms`");
Exemple #7
0
        public async Task HelpCommand(string module = "")
        {
            if (module == "")
            {
                // List modules
                var _pages = new List <PagedEmbed.EmbedPage>
                {
                    new PagedEmbed.EmbedPage()
                };

                int _currentPage    = 0;
                int _perPageCounter = 0;
                foreach (var _module in CommandHandlingService.commands.Modules)
                {
                    if (_perPageCounter == 7)
                    {
                        _perPageCounter = 0;
                        _currentPage++;

                        _pages.Add(new PagedEmbed.EmbedPage());
                    }

                    _perPageCounter++;

                    _pages[_currentPage].Fields.Add(_module.Name, _module.Summary ?? "No description provided.");
                }

                new PagedEmbed(Context, _pages.ToArray(), "Help - All modules");
            }
            else
            {
                // Try to find module
                var _module = CommandHandlingService.commands.Modules.First(s => s.Name.ToLower() == module);
                if (_module == null)
                {
                    await Respond.SendResponse(Context,
                                               $"I could not find a module by the name `{module}`. You can use `>help` to get a full list of modules.");

                    return;
                }

                // List commands
                var _pages = new List <PagedEmbed.EmbedPage>
                {
                    new PagedEmbed.EmbedPage()
                };

                int _currentPage    = 0;
                int _perPageCounter = 0;
                foreach (var command in _module.Commands)
                {
                    if (_perPageCounter == 7)
                    {
                        _perPageCounter = 0;
                        _currentPage++;

                        _pages.Add(new PagedEmbed.EmbedPage());
                    }

                    _perPageCounter++;

                    // Build parameters
                    StringBuilder _paramsBuilder = new StringBuilder();
                    foreach (var param in command.Parameters)
                    {
                        _paramsBuilder.Append($" <{param.Name}>");
                    }

                    _pages[_currentPage]
                    .Fields
                    .Add($"{command.Name} {_paramsBuilder.ToString()}", command.Summary ?? "No description provided.");
                }

                new PagedEmbed(Context, _pages.ToArray(), $"Help - {_module.Name}");
            }
        }