public async Task ChangePrefixCommand(string newPrefix) { BotConfigService.SetPrefix(newPrefix); await Respond.SendResponse(Context, $"My new prefix is now: `{newPrefix}`!"); }
public async Task ShutdownCommand() { await Respond.SendResponse(Context, ":thumbsup:"); Environment.Exit(1); }
public async Task InviteCommand() { await Respond.SendResponse(Context, "https://discordapp.com/api/oauth2/authorize?client_id=401994184602681344&permissions=8&scope=bot"); }
public async Task RandomCommand(int one, int two) { await Respond.SendResponse(Context, new Random().Next(one, two).ToString()); }
public async Task FlipCoinCommand() { var _r = new Random().Next(0, 1); await Respond.SendResponse(Context, $"{(_r == 0 ? "Heads" : "Tails")}."); }
public async Task PingCommand() => await Respond.SendResponse(Context, $"Pong! `{Context.Client.Latency}ms`");
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}"); } }