Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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))
Ejemplo n.º 3
0
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')
Ejemplo n.º 4
0
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()
Ejemplo n.º 5
0
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]
Ejemplo n.º 6
0
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)
Ejemplo n.º 7
0
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)
Ejemplo n.º 8
0
class CensorConfig(PluginConfig):
    levels = DictField(int, CensorSubConfig)
    channels = DictField(ChannelField, CensorSubConfig)
Ejemplo n.º 9
0
class GuildConfig(SlottedModel):
    nickname = Field(text)
    commands = Field(CommandsConfig, default=None, create=False)
    levels = DictField(int, int)
    plugins = Field(PluginsConfig.parse)
Ejemplo n.º 10
0
class CensorConfig(PluginConfig):
    levels = DictField(int, CensorSubConfig)
    channels = DictField(snowflake, CensorSubConfig)
Ejemplo n.º 11
0
class CensorConfig(PluginConfig):
    levels = DictField(int, CensorSubConfig)
    channels = DictField(ChannelField, CensorSubConfig)
    ignored_users = ListField(snowflake, default=[])
Ejemplo n.º 12
0
class TwitchConfig(PluginConfig):
    streams = ListField(str)
    config = DictField(str, StreamConfig)
Ejemplo n.º 13
0
class CensorConfig(PluginConfig):
    levels = DictField(int, CensorSubConfig)
    filters = ListField(CensorSubConfig, default=[])
Ejemplo n.º 14
0
class LevelPluginConfig(PluginConfig):
    actions = Field(LevelUpActionConfig)

    rewards = DictField(int, snowflake)
    pass