# logging logging.config.fileConfig('logging.conf') logging.Formatter.converter = time.gmtime logging.debug("debug") logging.info("info") logging.warning("warning") logging.error("error") # get basic config bot_id = os.environ.get("YATA_ID", 1) github_token = os.environ.get("GITHUB_TOKEN", "") main_server_id = os.environ.get("MAIN_SERVER_ID", 581227228537421825) logging.info(f'Starting bot: bot id = {bot_id}') # get configurations from YATA's database token, configurations = load_configurations(bot_id) def get_prefix(client, message): if message.guild: prefix = client.configurations.get(message.guild.id, {}).get("admin", {}).get("prefix", "!") # logging.debug(f'[get_prefix] {message.guild}: {prefix}') return prefix else: return "!" # init yata bot bot = YataBot(configurations=configurations,
# sentry if config("ENABLE_SENTRY", default=False, cast=bool): logging.info(f'Sentry: enabled') import sentry_sdk sentry_sdk.init( dsn=config("SENTRY_DSN"), traces_sample_rate=config("SENTRY_SAMPLE_RATE", default=1.0, cast=float), environment=config("SENTRY_ENVIRONMENT"), ) else: logging.info(f'Sentry: disabled') # get configurations from YATA's database token, configurations = load_configurations(bot_id, database) def get_prefix(client, message): if message.guild: prefix = client.configurations.get(message.guild.id, {}).get("admin", {}).get("prefix", "!") return prefix else: return "!" # init yata bot bot = YataBot(configurations=configurations, command_prefix=get_prefix,