예제 #1
0
        public async Task Help()
        {
            var commands     = _commandService.Commands.Where(cmd => cmd.Module.Name.Equals(GroupName)).Where(cmd => !string.IsNullOrEmpty(cmd.Summary));
            var embedBuilder = new EmbedBuilder();

            foreach (var command in commands)
            {
                if (command.Preconditions.Any(pc => pc.GetType() == typeof(RequiresBotAdminAttribute)))
                {
                    if (!_administrationService.IsUserAdmin(Context.User))
                    {
                        continue;
                    }
                }
                var embedFieldText = command.Summary;
                embedBuilder.AddField(command.Name, embedFieldText);
            }
            await ReplyAsync("Here's a list of commands and their descriptions: ", false, embedBuilder.Build());
        }