コード例 #1
0
ファイル: ContentModule.cs プロジェクト: C4rtesius/CozyBot
        /// <summary>
        /// Generates content addition commands from specified list of allowed role IDs.
        /// </summary>
        /// <param name="perms">List of Roles IDs which are allowed to use Add commands.</param>
        protected virtual void GenerateAddCommands(List <ulong> perms)
        {
            List <ulong> allPerms = new List <ulong>(_adminIds);

            allPerms.AddRange(perms);
            Rule addRule = RuleGenerator.HasRoleByIds(allPerms) & RuleGenerator.PrefixatedCommand(_prefix, "add");

            IBotCommand addCmd = new BotCommand($"{StringID}-addcmd", addRule, AddCommand);

            _addCommands = new List <IBotCommand> {
                addCmd
            };
        }
コード例 #2
0
ファイル: ContentModule.cs プロジェクト: C4rtesius/CozyBot
        /// <summary>
        /// Generates content deletion commands from specified list of allowed role IDs.
        /// </summary>
        /// <param name="perms">List of Roles IDs which are allowed to use Delete commands.</param>
        protected virtual void GenerateDelCommands(List <ulong> perms)
        {
            List <ulong> allPerms = new List <ulong>(_adminIds);

            allPerms.AddRange(perms);
            Rule delRule = RuleGenerator.HasRoleByIds(allPerms) & RuleGenerator.PrefixatedCommand(_prefix, "del");

            IBotCommand delCmd = new BotCommand($"{StringID}-delcmd", delRule, DeleteCommand);

            _delCommands = new List <IBotCommand> {
                delCmd
            };
        }
コード例 #3
0
ファイル: ContentModule.cs プロジェクト: C4rtesius/CozyBot
        /// <summary>
        /// Generates module configuration commands from specified list of allowed role IDs.
        /// </summary>
        /// <param name="perms">List of Roles IDs which are allowed to use Config commands.</param>
        protected virtual void GenerateCfgCommands(List <ulong> perms)
        {
            List <ulong> allPerms = new List <ulong>(_adminIds);

            allPerms.AddRange(perms);
            Rule cmdRule = RuleGenerator.HasRoleByIds(allPerms) & RuleGenerator.PrefixatedCommand(_prefix, "cfg");

            IBotCommand configCmd = new BotCommand($"{StringID}-configcmd", cmdRule, ConfigCommand);

            _cfgCommands = new List <IBotCommand> {
                configCmd
            };
        }