"""Image commands: generation and editing.""" from __future__ import annotations from typing import TYPE_CHECKING from discord.ext import commands from vibe_bot.commands._state import require_app, set_app if TYPE_CHECKING: from discord.ext.commands import Bot from discord.ext.commands import Context as CommandsContext from vibe_bot.app import App def register(bot: commands.Bot, app: App) -> None: """Register the image commands.""" set_app(app) bot.command(name="doodlebob")(doodlebob) bot.command(name="retcon")(retcon) @commands.cooldown(rate=1, per=60, type=commands.BucketType.user) async def doodlebob(ctx: CommandsContext[Bot], *, message: str) -> None: """Convert a message into an image using Doodlebob.""" app = require_app() await app.image.generate(ctx, message=message) async def retcon(ctx: CommandsContext[Bot], *, message: str) -> None: """Edit an attached image based on a text prompt.""" app = require_app() await app.image.edit(ctx, message=message)