more tests
Some checks failed
Safety Check / safety-check (push) Successful in -1s
Build and Push Docker Image / build (push) Successful in -10s
Code Quality Check / quality-check (push) Failing after 14s

This commit is contained in:
wirehack7 2025-05-01 13:53:14 +02:00
parent a288d06345
commit f530071bb2
Signed by: wirehack7
GPG Key ID: C9F4CF85BA505ADC

View File

@ -1,5 +1,6 @@
import io
import os
import sys
import random
import zipfile
import logging
@ -12,14 +13,13 @@ NOVELAI_API_TOKEN = os.getenv("NOVELAI_API_TOKEN")
BOT_TOKEN = os.getenv("DISCORD_BOT_TOKEN")
ALLOWED_CHANNEL_ID = int(os.getenv("DISCORD_CHANNEL_ID", "0")) # falls nicht gesetzt → 0
root = logging.getLogger()
root.setLevel(logging.INFO)
logging.basicConfig(
stream=sys.stdout,
level=logging.INFO,
format="%(asctime)s - %(levelname)s - %(message)s"
)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
root.addHandler(handler)
logger = logging.getLogger(__name__)
if not all([NOVELAI_API_TOKEN, BOT_TOKEN, ALLOWED_CHANNEL_ID]):
raise ValueError("Environment-Variablen NOVELAI_API_TOKEN, DISCORD_BOT_TOKEN und DISCORD_CHANNEL_ID müssen gesetzt sein.")
@ -160,7 +160,7 @@ async def generate(
)
if response.status_code == 200:
antlas = get_available_antlas(NOVELAI_API_TOKEN)
antlas = await get_available_antlas(NOVELAI_API_TOKEN)
logging.info("Generated image, current antlas: {antlas}")
response_bytes = response.content