Example #1
0
        public Embed BuildLockableList(ICommandContext context, CommandSetDetails commandSet)
        {
            var embed = new EmbedBuilder()
            {
                Color       = configParser.EmbedColor,
                Title       = $"{configParser.EmbedPrefix}{configParser.ParseTitle("lockable", LockableTitle)}",
                Description = configParser.ParseDescription("lockable", LockableDesc),
            };

            foreach (ModuleDetails module in commandSet)
            {
                /*StringBuilder str = new StringBuilder();
                 * foreach (CommandDetails command in module) {
                 *      string commandLocked = FormatCommandLocked(lockContext, command);
                 *      if (!string.IsNullOrEmpty(moduleLocked) || !string.IsNullOrEmpty(commandLocked)) {
                 *              str.AppendLine($"{commandLocked}{command.Alias}");
                 *      }
                 * }*/
                string lockedCommands = FormatLockableCommandList(module.IsLockable, module);
                if (lockedCommands.Length > 0)
                {
                    embed.AddField($"{FormatLockable(module)}{module.Name}", lockedCommands);
                }
            }
            return(embed.Build());
        }
Example #2
0
        public async Task <Embed> BuildLockedListAsync(ICommandContext context, CommandSetDetails commandSet)
        {
            IDbLockableContext lockContext = await Contexting.FindDbLockableContextAsync(context).ConfigureAwait(false);

            var embed = new EmbedBuilder()
            {
                Color       = configParser.EmbedColor,
                Title       = $"{configParser.EmbedPrefix}{configParser.ParseTitle("locked", LockedTitle)}",
                Description = configParser.ParseDescription("locked", LockedDesc),
            };

            foreach (ModuleDetails module in commandSet)
            {
                bool moduleLocked = module.IsModuleLocked(lockContext);

                /*StringBuilder str = new StringBuilder();
                 * foreach (CommandDetails command in module) {
                 *      string commandLocked = FormatCommandLocked(lockContext, command);
                 *      if (!string.IsNullOrEmpty(moduleLocked) || !string.IsNullOrEmpty(commandLocked)) {
                 *              str.AppendLine($"{commandLocked}{command.Alias}");
                 *      }
                 * }*/
                string lockedCommands = FormatLockedCommandList(lockContext, moduleLocked, module);
                if (lockedCommands.Length > 0)
                {
                    embed.AddField($"{FormatModuleLocked(moduleLocked)}{module.Name}", lockedCommands);
                }
            }
            return(embed.Build());
        }
Example #3
0
        public async Task <Embed> BuildHelpListAsync(ICommandContext context, CommandSetDetails commandSet)
        {
            string prefix = await Contexting.GetPrefixAsync(context).ConfigureAwait(false);

            var embed = new EmbedBuilder()
            {
                Color       = configParser.EmbedColor,
                Title       = $"{configParser.EmbedPrefix}{configParser.ParseTitle("help", HelpTitle)}",
                Description = FormatDescription(prefix),
            };

            foreach (ModuleDetails module in commandSet)
            {
                List <CommandDetails> usableCommands = module.GetUsableCommands(context).ToList();
                if (usableCommands.Any())
                {
                    embed.AddField(module.Name, FormatCommandList(usableCommands));
                }
            }

            //embed.WithThumbnailUrl(Client.CurrentUser.GetAvatarUrl());

            return(embed.Build());
        }