Example #1
0
        public static void ShowCommands(this CommandModule self)
        {
            var level    = self.Context.Player?.PromoteLevel ?? MyPromoteLevel.Admin;
            var commands = self.GetCommandMethods(level).ToArray();

            if (!commands.Any())
            {
                self.Context.Respond("No accessible commands found");
                return;
            }

            var msgBuilder = new StringBuilder();

            msgBuilder.AppendLine("Commands:");
            foreach (var command in commands)
            {
                var name        = command.Name;
                var description = command.Description.OrNull() ?? "no description";
                msgBuilder.AppendLine($"{name} -- {description}");
            }

            self.Context.Respond(msgBuilder.ToString());
        }