mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-24 03:54: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 .play import PlayCommand
|
||||||
from .playmode import PlaymodeCommand
|
from .playmode import PlaymodeCommand
|
||||||
from .pmots import PmotsCommand
|
from .pmots import PmotsCommand
|
||||||
from .pug import PugCommand
|
from .dog import DogCommand
|
||||||
from .queue import QueueCommand
|
from .queue import QueueCommand
|
||||||
from .rage import RageCommand
|
from .rage import RageCommand
|
||||||
from .reminder import ReminderCommand
|
from .reminder import ReminderCommand
|
||||||
|
@ -110,7 +110,7 @@ available_commands = [
|
||||||
PlayCommand,
|
PlayCommand,
|
||||||
PlaymodeCommand,
|
PlaymodeCommand,
|
||||||
PmotsCommand,
|
PmotsCommand,
|
||||||
PugCommand,
|
DogCommand,
|
||||||
QueueCommand,
|
QueueCommand,
|
||||||
RageCommand,
|
RageCommand,
|
||||||
ReminderCommand,
|
ReminderCommand,
|
||||||
|
|
|
@ -4,18 +4,22 @@ import aiohttp
|
||||||
import io
|
import io
|
||||||
|
|
||||||
|
|
||||||
class PugCommand(rc.Command):
|
class DogCommand(rc.Command):
|
||||||
name: str = "pug"
|
name: str = "dog"
|
||||||
|
|
||||||
description: str = "Invia un carlino casuale in chat."
|
description: str = "Invia un cane della razza specificata in chat."
|
||||||
|
|
||||||
syntax: str = ""
|
syntax: str = "[razza]"
|
||||||
|
|
||||||
aliases = ["carlino", "carlo", "mallllco"]
|
|
||||||
|
|
||||||
async def run(self, args: rc.CommandArgs, data: rc.CommandData) -> None:
|
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 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:
|
if response.status >= 400:
|
||||||
raise rc.ExternalError(f"Request returned {response.status}")
|
raise rc.ExternalError(f"Request returned {response.status}")
|
||||||
result = await response.json()
|
result = await response.json()
|
Loading…
Reference in a new issue