예제 #1
0
 /// <summary>Checks whether meta commands are denied in the relevant channel. If denied, will return 'true' and show a rejection message.</summary>
 /// <param name="message">The message being replied to.</param>
 /// <returns>True if they are denied.</returns>
 public static bool CheckMetaDenied(IUserMessage message)
 {
     if (!DenizenMetaBot.MetaCommandsAllowed(message.Channel))
     {
         SendErrorMessageReply(message, "Command Not Allowed Here",
                               "Meta documentation commands are not allowed in this channel. Please switch to a bot spam channel, or a Denizen channel.");
         return(true);
     }
     return(false);
 }
        /// <summary>User command to get help (shows a list of valid bot commands).</summary>
        public void CMD_Help(CommandData command)
        {
            StringBuilder infoCmds = new(CmdsInfo);

            if (!DenizenMetaBot.ProjectToDetails.IsEmpty())
            {
                infoCmds.Append("`update [project ...]` shows an update link for the named project(s)\n")
                .Append("`github [project ...]` shows a GitHub link for the named project(s)\n")
                .Append("`issues [project ...]` shows an issue posting link for the named project(s)\n");
            }
            if (!DenizenMetaBot.InformationalData.IsEmpty())
            {
                infoCmds.Append("`info <name ...>` shows a prewritten informational notice reply\n");
            }
            if (!DenizenMetaBot.Rules.IsEmpty())
            {
                infoCmds.Append("`rule [rule ...]` shows the identified rule\n");
            }
            if (!DenizenMetaBot.Quotes.IsEmpty())
            {
                infoCmds.Append("`quote [quote]` shows a random quote that matches the search (if any)");
            }
            EmbedBuilder embed = new EmbedBuilder().WithTitle("Bot Command Help");

            embed.AddField("**Available Informational Commands:**", infoCmds);
            embed.AddField("**Available Utility Commands:**", CmdsUtility);
            if (DenizenMetaBot.MetaCommandsAllowed(command.Message.Channel))
            {
                embed.AddField("**Available Meta Docs Commands:**", CmdsMeta);
            }
            if (DenizenMetaBot.IsBotCommander(command.Message.Author as SocketGuildUser))
            {
                embed.AddField("**Available Admin Commands:**", CmdsAdmin);
            }
            SendReply(command.Message, embed.Build());
        }