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)
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)
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
def get_config_value(self, *args, **kwargs): return config.get_config_value(self.config, *args, **kwargs)