diff --git a/royalpack/commands/__init__.py b/royalpack/commands/__init__.py index cc63c0eb..9ce8b05e 100644 --- a/royalpack/commands/__init__.py +++ b/royalpack/commands/__init__.py @@ -43,7 +43,7 @@ from .ping import PingCommand from .play import PlayCommand from .playmode import PlaymodeCommand from .pmots import PmotsCommand -from .pug import PugCommand +from .dog import DogCommand from .queue import QueueCommand from .rage import RageCommand from .reminder import ReminderCommand @@ -110,7 +110,7 @@ available_commands = [ PlayCommand, PlaymodeCommand, PmotsCommand, - PugCommand, + DogCommand, QueueCommand, RageCommand, ReminderCommand, diff --git a/royalpack/commands/pug.py b/royalpack/commands/dog.py similarity index 64% rename from royalpack/commands/pug.py rename to royalpack/commands/dog.py index 6846212b..cd80ff52 100644 --- a/royalpack/commands/pug.py +++ b/royalpack/commands/dog.py @@ -4,18 +4,22 @@ import aiohttp import io -class PugCommand(rc.Command): - name: str = "pug" +class DogCommand(rc.Command): + name: str = "dog" - description: str = "Invia un carlino casuale in chat." + description: str = "Invia un cane della razza specificata in chat." - syntax: str = "" - - aliases = ["carlino", "carlo", "mallllco"] + syntax: str = "[razza]" async def run(self, args: rc.CommandArgs, data: rc.CommandData) -> None: + breed = args.joined() + if breed: + url = f"https://dog.ceo/api/breed/{breed}/images/random" + else: + url = f"https://dog.ceo/api/breeds/image/random" + async with aiohttp.ClientSession() as session: - async with session.get("https://dog.ceo/api/breed/pug/images/random") as response: + async with session.get(url) as response: if response.status >= 400: raise rc.ExternalError(f"Request returned {response.status}") result = await response.json()