<commit_before>import aioredis
import datetime
import logging
import discord
import traceback
from discord.ext import commands
import dog_config as cfg

logger = logging.getLogger(__name__)


class DogBot(commands.Bot):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.boot_time = datetime.datetime.utcnow()

    async def on_ready(self):
        logger.info('owner id: %s', cfg.owner_id)
        logger.info('logged in as %s', self.user.id)
        print('logged in')
        print(f' name: {self.user.name}#{self.user.discriminator}')
        print(f' id:   {self.user.id}')

        # redis
        self.redis = await aioredis.create_redis(
            (cfg.redis_url, 6379), loop=self.loop)

        # helpful game
        short_prefix = min(self.command_prefix, key=len)
        help_game = discord.Game(name=f'{short_prefix}help')
        await self.change_presence(game=help_game)

    async def config_is_set(self, guild, name):
        logger.info('checking config: %d:%s', guild.id, name)
        value = await self.redis.get(f'{guild.id}:{name}')
        return value is not None

    async def on_command_error(self, ex, ctx):<commit_msg>bot: use redis.exists instead of redis.get is None<commit_after>import aioredis
import datetime
import logging
import discord
import traceback
from discord.ext import commands
import dog_config as cfg

logger = logging.getLogger(__name__)


class DogBot(commands.Bot):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.boot_time = datetime.datetime.utcnow()

    async def on_ready(self):
        logger.info('owner id: %s', cfg.owner_id)
        logger.info('logged in as %s', self.user.id)
        print('logged in')
        print(f' name: {self.user.name}#{self.user.discriminator}')
        print(f' id:   {self.user.id}')

        # redis
        self.redis = await aioredis.create_redis(
            (cfg.redis_url, 6379), loop=self.loop)

        # helpful game
        short_prefix = min(self.command_prefix, key=len)
        help_game = discord.Game(name=f'{short_prefix}help')
        await self.change_presence(game=help_game)

    async def config_is_set(self, guild, name):
        logger.info('checking config: %d:%s', guild.id, name)
        return await self.redis.exists(f'{guild.id}:{name}')

    async def on_command_error(self, ex, ctx):
{'fraction_non_alphanumeric': 0.12666666666666668, 'fraction_numerical': 0.0033333333333333335, 'mean_word_length': 3.139655172413793, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7000747', 'n_tokens_mistral': 805, 'n_tokens_neox': 778, 'n_words': 179}