mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Migrate /pug to /dog
This commit is contained in:
parent
e6f5170bd7
commit
d70477ec6d
2 changed files with 13 additions and 9 deletions
|
@ -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,
|
||||
|
|
|
@ -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()
|
Loading…
Reference in a new issue