removed antlas request
This commit is contained in:
parent
f530071bb2
commit
413bc52594
21
src/main.py
21
src/main.py
@ -27,18 +27,6 @@ if not all([NOVELAI_API_TOKEN, BOT_TOKEN, ALLOWED_CHANNEL_ID]):
|
||||
intents = discord.Intents.default()
|
||||
bot = commands.Bot(command_prefix=commands.when_mentioned, intents=intents)
|
||||
|
||||
async def get_available_antlas(api_token):
|
||||
headers = {
|
||||
"Authorization": f"Bearer {api_token}"
|
||||
}
|
||||
response = requests.get("https://api.novelai.net/user/info", headers=headers)
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
return data.get("imageAnlas", 0)
|
||||
else:
|
||||
logging.error(f"Fehler beim Abrufen der Antlas: {response.status_code}")
|
||||
return None
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
print(f"Bot started as {bot.user}")
|
||||
@ -87,6 +75,12 @@ async def generate(
|
||||
return
|
||||
|
||||
await interaction.response.defer(thinking=True)
|
||||
logger.info(
|
||||
"User %s (%s, %s) requested image",
|
||||
interaction.user.display_name,
|
||||
interaction.user.name,
|
||||
interaction.user.id
|
||||
)
|
||||
|
||||
# Auflösung wählen
|
||||
if orientation.lower() == "landscape":
|
||||
@ -160,8 +154,6 @@ async def generate(
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
antlas = await get_available_antlas(NOVELAI_API_TOKEN)
|
||||
logging.info("Generated image, current antlas: {antlas}")
|
||||
response_bytes = response.content
|
||||
|
||||
param_text = f"""```Prompt: {prompt}
|
||||
@ -214,5 +206,4 @@ Model: nai-diffusion-4-full```"""
|
||||
|
||||
await interaction.followup.send(error_message)
|
||||
|
||||
|
||||
bot.run(BOT_TOKEN)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user