#!/usr/bin/env python3
"""Generates the bot's banners and avatar (SVG -> PNG via rsvg-convert). Run from this directory."""
import subprocess
MARK = ''
DEFS = """
"""
def banner(name, title, sub, tag):
w, h = 1000, 280
svg = f""""""
open(f"{name}.svg", "w").write(svg)
subprocess.run(["rsvg-convert", "-w", str(w), f"{name}.svg", "-o", f"{name}.png"], check=True)
banner("ticket", "SUPPORT", "open a private ticket - staff will reply", "LOKI DEV / TICKETS")
banner("verify", "VERIFY", "react to unlock the server", "LOKI DEV / ACCESS")
banner("welcome", "WELCOME", "good to have you here", "LOKI DEV / COMMUNITY")
banner("help", "COMMANDS", "everything the bot can do", "LOKI DEV / HELP")
def poster(name, title, sub, tag):
"""Vertical 3:4 poster for help category pages; title size shrinks to fit the width."""
w, h = 900, 1200
size = min(150, int(760 / (0.66 * len(title))))
defs = DEFS.replace('"W"', f'"{w}"').replace('"H"', f'"{h}"').replace('cx="82%" cy="50%"', 'cx="50%" cy="36%"')
svg = f""""""
open(f"{name}.svg", "w").write(svg)
subprocess.run(["rsvg-convert", "-w", str(w), f"{name}.svg", "-o", f"{name}.png"], check=True)
poster("help-information", "INFORMATION", "server & bot info", "LOKI DEV / INFORMATION")
poster("help-moderation", "MODERATION", "mod tools - requires perms", "LOKI DEV / MODERATION")
poster("help-tickets", "TICKETS", "support tickets & blacklist", "LOKI DEV / TICKETS")
poster("help-utility", "UTILITY", "polls, reminders, blog", "LOKI DEV / UTILITY")
avatar = f""""""
open("avatar.svg", "w").write(avatar)
subprocess.run(["rsvg-convert", "-w", "1024", "avatar.svg", "-o", "avatar.png"], check=True)