예제 #1
0
async def success(ctx, suffix=None):
    success = config.get_config_value(config.get_config(),
                                      'success_response',
                                      default=':thumbsup:')
    if suffix:
        success += f": {suffix}"
    await ctx.send(success)
예제 #2
0
파일: storage.py 프로젝트: marvinody/Hourai
    def _create_sql_engine(self, connection_str=None):
        connection_str = connection_str or \
            config.get_config_value(self.config, 'database', type=str)

        connect_args = dict()
        if 'sqlite' in connection_str:
            connect_args['check_same_thread'] = False

        return create_engine(connection_str,
                             poolclass=pool.SingletonThreadPool,
                             client_encoding='utf8',
                             connect_args=connect_args)
예제 #3
0
파일: storage.py 프로젝트: marvinody/Hourai
 async def _init_redis(self):
     try:
         log.info('Initializing connection to Redis...')
         redis_conf = config.get_config_value(self.config,
                                              'redis',
                                              type=str)
         await self._connect_to_redis(redis_conf)
         self.__setup_caches()
         log.info('Redis connection established.')
     except Exception:
         log.exception('Error when initializing Redis:')
         raise
예제 #4
0
 def get_config_value(self, *args, **kwargs):
     return config.get_config_value(self.config, *args, **kwargs)