コード例 #1
0
    def get_config(self, refresh=False):
        from rowboat.types.guild import GuildConfig

        if refresh:
            self.config = Guild.select(Guild.config).where(
                Guild.guild_id == self.guild_id).get().config

        if refresh or not hasattr(self, '_cached_config'):
            self._cached_config = GuildConfig(self.config)
        return self._cached_config
コード例 #2
0
ファイル: guild.py プロジェクト: thesuperzapper/rowboat
    def update_config(self, actor_id, raw):
        from rowboat.types.guild import GuildConfig

        parsed = yaml.load(raw)
        GuildConfig(parsed).validate()

        GuildConfigChange.create(
            user_id=actor_id,
            guild_id=self.guild_id,
            before_raw=self.config_raw,
            after_raw=raw)

        self.update(config=parsed, config_raw=raw).where(Guild.guild_id == self.guild_id).execute()
        self.emit('GUILD_UPDATE')
コード例 #3
0
ファイル: guild.py プロジェクト: thesuperzapper/rowboat
    def get_config(self, refresh=False):
        from rowboat.types.guild import GuildConfig

        if refresh:
            self.config = Guild.select(Guild.config).where(Guild.guild_id == self.guild_id).get().config

        if refresh or not hasattr(self, '_cached_config'):
            try:
                self._cached_config = GuildConfig(self.config)
            except:
                log.exception('Failed to load config for Guild %s, invalid: ', self.guild_id)
                return None

        return self._cached_config