public async Task HelpAsync() { var commandService = (ICommandService)Context.Bot; var modules = commandService.GetAllModules(); var moduleStringJoiner = new StringJoiner(", "); foreach (var module in modules) { moduleStringJoiner.Append(Markdown.Code(module.Name)); } var helpEmbedBuilder = new LocalEmbedBuilder { Color = Constants.EspeonColour, Title = "Espeon's Help", Author = new LocalEmbedAuthorBuilder { IconUrl = Context.Member.GetAvatarUrl(), Name = Context.Member.DisplayName }, ThumbnailUrl = Context.Guild.CurrentMember.GetAvatarUrl(), Footer = new LocalEmbedFooterBuilder { Text = $"Execute \"{GetPrefix()} module\" to view help for that module" }, Fields = { new LocalEmbedFieldBuilder { Name = "Modules", Value = moduleStringJoiner.ToString() } } }; var delete = new DeleteOnReaction(Context.User.Id, async() => await ReplyAsync(embed: helpEmbedBuilder.Build())); await Context.Channel.StartMenuAsync(delete); }
private static string CreateSubmoduleString(IEnumerable <Module> executableSubmodules) { var subModuleStringJoiner = new StringJoiner(", "); foreach (var submodule in executableSubmodules) { subModuleStringJoiner.Append(Markdown.Code(submodule.Name)); } var submoduleString = subModuleStringJoiner.ToString(); return(submoduleString); }
private LocalEmbedBuilder CreateEmbedForCommandHelp(Command command) { string GetCommandSignature() { var commandSignatureJoiner = new StringJoiner(" "); commandSignatureJoiner.Append(command.FullAliases.First()); foreach (var parameter in command.Parameters) { var paramString = GetParameterString(parameter); commandSignatureJoiner.Append(Markdown.Code(paramString)); } return(commandSignatureJoiner.ToString()); } var helpEmbedBuilder = new LocalEmbedBuilder { Color = Constants.EspeonColour, Title = $"{command.Name} Help", Author = new LocalEmbedAuthorBuilder { IconUrl = Context.Member.GetAvatarUrl(), Name = Context.Member.DisplayName }, ThumbnailUrl = Context.Guild.CurrentMember.GetAvatarUrl(), Description = command.Description, Footer = new LocalEmbedFooterBuilder { Text = $"You can't go deeper 👀, \"{GetPrefix()} command\" to execute a command" }, Fields = { new LocalEmbedFieldBuilder { Name = "Module", Value = Markdown.Code(command.Module.Name) }, new LocalEmbedFieldBuilder { Name = "Command Signature", Value = GetCommandSignature() } } }; AddCommandAliases(command, helpEmbedBuilder); AddCommandFullAliases(command, helpEmbedBuilder); AddParameterExamples(command, helpEmbedBuilder); return(helpEmbedBuilder); }
private static (string, string) CreateCommandStrings(IEnumerable <Command> executableCommands) { var commandNameStringJoined = new StringJoiner(", "); var commandAliasStringJoiner = new StringJoiner(", "); foreach (var command in executableCommands) { commandNameStringJoined.Append(Markdown.Code(command.Name)); if (command.Aliases.Count > 0) { commandAliasStringJoiner.Append(Markdown.Code(command.Aliases.First())); } } return(commandNameStringJoined.ToString(), commandAliasStringJoiner.ToString()); }