class AdminConfig(PluginConfig): confirm_actions = Field(bool, default=True) # Role saving information persist = Field(PersistConfig, default=None) # Aliases to roles, can be used in place of IDs in commands role_aliases = DictField(unicode, snowflake) # Group roles can be joined/left by any user group_roles = DictField(lambda value: unicode(value).lower(), snowflake) group_confirm_reactions = Field(bool, default=False) # Locked roles cannot be changed unless they are unlocked w/ command locked_roles = ListField(snowflake)
class AdminConfig(PluginConfig): confirm_actions = Field(bool, default=True) # Role saving information persist = Field(PersistConfig, default=None) # Aliases to roles, can be used in place of IDs in commands role_aliases = DictField(unicode, snowflake) # Group roles can be joined/left by any user group_roles = DictField(unicode, snowflake) # The mute role mute_role = Field(snowflake, default=None) reason_edit_level = Field(int, default=int(CommandLevels.ADMIN))
class RedditConfig(PluginConfig): # TODO: validate they have less than 3 reddits selected subs = DictField(str, SubRedditConfig) def validate(self): if len(self.subs) > 3: raise Exception('Cannot have more than 3 subreddits configured')
class ModLogConfig(PluginConfig): resolved = Field(bool, default=False, private=True) ignored_users = ListField(snowflake) ignored_channels = ListField(snowflake) custom = DictField(str, CustomFormat) channels = DictField(ChannelField, ChannelConfig) new_member_threshold = Field(int, default=(15 * 60)) _custom = DictField(dict, private=True) _channels = DictField(ChannelConfig, private=True) @cached_property def subscribed(self): return reduce(operator.or_, (i.subscribed for i in self.channels.values())) if self.channels else set()
class SpamConfig(PluginConfig): roles = DictField(str, SubConfig) levels = DictField(int, SubConfig) def compute_relevant_rules(self, member, level): if self.roles: if '*' in self.roles: yield self.roles['*'] for rid in member.roles: if rid in self.roles: yield self.roles[rid] rname = member.guild.roles.get(rid) if rname and rname.name in self.roles: yield self.roles[rname.name] if self.levels: for lvl in list(self.levels.keys()): if level <= lvl: yield self.levels[lvl]
class StarboardConfig(PluginConfig): channels = DictField(ChannelField, ChannelConfig) # TODO: validate that each source channel has only one starboard mapping def get_board(self, channel_id): # Starboards can't work recursively if channel_id in self.channels: return (None, None) for starboard, config in self.channels.items(): if not config.sources or channel_id in config.sources: return (starboard, config) return (None, None)
class InfractionsConfig(PluginConfig): # Whether to confirm actions in the channel they are executed confirm_actions = Field(bool, default=True) confirm_actions_reaction = Field(bool, default=False) confirm_actions_expiry = Field(int, default=0) # Whether to notify users on actions notify_actions = Field(bool, default=False) # The mute role mute_role = Field(snowflake, default=None) # Level required to edit reasons reason_edit_level = Field(int, default=int(CommandLevels.ADMIN)) # Aliases to roles, can be used in place of IDs in commands role_aliases = DictField(unicode, snowflake)
class CensorConfig(PluginConfig): levels = DictField(int, CensorSubConfig) channels = DictField(ChannelField, CensorSubConfig)
class GuildConfig(SlottedModel): nickname = Field(text) commands = Field(CommandsConfig, default=None, create=False) levels = DictField(int, int) plugins = Field(PluginsConfig.parse)
class CensorConfig(PluginConfig): levels = DictField(int, CensorSubConfig) channels = DictField(snowflake, CensorSubConfig)
class CensorConfig(PluginConfig): levels = DictField(int, CensorSubConfig) channels = DictField(ChannelField, CensorSubConfig) ignored_users = ListField(snowflake, default=[])
class TwitchConfig(PluginConfig): streams = ListField(str) config = DictField(str, StreamConfig)
class CensorConfig(PluginConfig): levels = DictField(int, CensorSubConfig) filters = ListField(CensorSubConfig, default=[])
class LevelPluginConfig(PluginConfig): actions = Field(LevelUpActionConfig) rewards = DictField(int, snowflake) pass