public Task HandleCommand() { string listOfInfoCommands = string.Join('\n', CommandRegistry.infoCommands !); string listOfFunCommands = string.Join('\n', CommandRegistry.funCommands !); BaseEmbed embed = new BaseEmbed(Context.User) { Title = "Command Help", Description = "The following is a list of all bot commands." + $"\nAll of these should be prefixed with {BotStartup.Prefix}." + "\n`<>`: required" + "\n`[]`: optional", Fields = new List <EmbedFieldBuilder> { new EmbedFieldBuilder { IsInline = false, Name = "Informative Commands", Value = string.IsNullOrEmpty(listOfInfoCommands) ? "N/A" : listOfInfoCommands }, new EmbedFieldBuilder { IsInline = false, Name = "Fun Commands", Value = string.IsNullOrEmpty(listOfFunCommands) ? "N/A" : listOfFunCommands } } }; return(ReplyAsync(embed: embed.Build())); }
public Task HandleCommand() { string channelPerms = ""; string guildPerms; SocketGuild?neededGuild = BotStartup.Client?.Guilds.FirstOrDefault(x => x == Context.Guild) ?? null; if (neededGuild != null) { guildPerms = neededGuild.CurrentUser.GuildPermissions.ToList() .Aggregate("", (current, gPerm) => current + $"\n * {gPerm}"); if (Context.Channel is IGuildChannel guildChannel) { channelPerms = neededGuild.CurrentUser.GetPermissions(guildChannel).ToList() .Aggregate("", (current, cPerm) => current + $"\n * {cPerm}"); } else { channelPerms = "unable to fetch current channel"; } } else { guildPerms = "unable to fetch guild"; } BaseEmbed embed = new BaseEmbed(Context.User) { Title = "Permissions", Fields = new List <EmbedFieldBuilder> { new EmbedFieldBuilder { IsInline = true, Name = "Guild Permissions", Value = guildPerms }, new EmbedFieldBuilder { IsInline = true, Name = "Channel Permissions", Value = channelPerms } } }; return(ReplyAsync(embed: embed.Build())); }
public Task HandleCommand() { BaseEmbed embed = new BaseEmbed(Context.User) { Title = "Basic Bot Info", Description = "`Tomat` is a general-use bot by `convicted tomatophile#0001`." + "\n<pending> (features)" + "\n\nFor command help, use `tomat!help`" + "\nIf you have any other questions, give Stevie a DM." + "\nInvite: ||<https://discord.com/api/oauth2/authorize?client_id=800480899300065321&permissions=8&scope=bot>||" }; return(ReplyAsync(embed: embed.Build())); }
public async Task HandleCommand() { Stopwatch stopwatch = Stopwatch.StartNew(); IUserMessage?toDelete = await ReplyAsync("Calculating..."); stopwatch.Stop(); await toDelete.DeleteAsync(); BaseEmbed embed = new BaseEmbed(Context.User) { Title = "Ping", Description = $"Latency - `{Context.Client.Latency}ms`" + $"\nResponse Time - `{stopwatch.ElapsedMilliseconds}ms`" }; await ReplyAsync(embed : embed.Build()); }
public Task HandleCommand([Remainder] [Summary("The command.")] string command = "") { command = command.ToLower(); // TODO: alias support HelpCommandData data = CommandRegistry.helpCommandData !.FirstOrDefault(x => x.command == command || x.aliases != null && x.aliases.Contains(command)); if (!CommandRegistry.helpCommandData !.Contains(data)) { data = new HelpCommandData("error", $"no command with the name {command} found."); } string description = ""; if (data.parameters != null) { description += $"Parameters: {data.parameters}\n"; } description += data.description; string name = data.command; if (data.aliases != null) { name += $" ({string.Join(", ", data.aliases)})"; } BaseEmbed embed = new BaseEmbed(Context.User) { Title = name, Description = description }; return(ReplyAsync(embed: embed.Build())); }