mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
publish: 5.8.14
This commit is contained in:
parent
a81f3bd980
commit
3fe7e94834
5 changed files with 35 additions and 5 deletions
6
poetry.lock
generated
6
poetry.lock
generated
|
@ -709,7 +709,7 @@ description = "YouTube video downloader"
|
||||||
name = "youtube-dl"
|
name = "youtube-dl"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = "*"
|
python-versions = "*"
|
||||||
version = "2020.5.29"
|
version = "2020.6.6"
|
||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
content-hash = "9245b7ae163a3746554cd31e3b20294d26aa3534cc78303a419ac54850db55cb"
|
content-hash = "9245b7ae163a3746554cd31e3b20294d26aa3534cc78303a419ac54850db55cb"
|
||||||
|
@ -1181,6 +1181,6 @@ yarl = [
|
||||||
{file = "yarl-1.4.2.tar.gz", hash = "sha256:58cd9c469eced558cd81aa3f484b2924e8897049e06889e8ff2510435b7ef74b"},
|
{file = "yarl-1.4.2.tar.gz", hash = "sha256:58cd9c469eced558cd81aa3f484b2924e8897049e06889e8ff2510435b7ef74b"},
|
||||||
]
|
]
|
||||||
youtube-dl = [
|
youtube-dl = [
|
||||||
{file = "youtube_dl-2020.5.29-py2.py3-none-any.whl", hash = "sha256:2d45840772ecc57e151b0be78dd89e9772b6aa29295746be38abb9c30dad5bb3"},
|
{file = "youtube_dl-2020.6.6-py2.py3-none-any.whl", hash = "sha256:813310fb7ab265c379e9aebb2bd6cde6995f9a8f22a06d2ff81c05dfab7da864"},
|
||||||
{file = "youtube_dl-2020.5.29.tar.gz", hash = "sha256:1a3d84afa851dce2fccc2dfc0f9ffa0e22314ffba6d528b34b4a7fe3e0cf2264"},
|
{file = "youtube_dl-2020.6.6.tar.gz", hash = "sha256:74e6cc7395060fc39f0b8e21c1e4707486da904c96145bd875187bda2da83b04"},
|
||||||
]
|
]
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "royalpack"
|
name = "royalpack"
|
||||||
version = "5.8.13"
|
version = "5.8.14"
|
||||||
description = "A Royalnet command pack for the Royal Games community"
|
description = "A Royalnet command pack for the Royal Games community"
|
||||||
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
|
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
|
||||||
license = "AGPL-3.0+"
|
license = "AGPL-3.0+"
|
||||||
|
|
|
@ -60,6 +60,7 @@ from .pug import PugCommand
|
||||||
from .magicktreasure import MagicktreasureCommand
|
from .magicktreasure import MagicktreasureCommand
|
||||||
from .treasure import TreasureCommand
|
from .treasure import TreasureCommand
|
||||||
from .givetreasure import GivetreasureCommand
|
from .givetreasure import GivetreasureCommand
|
||||||
|
from .cat import CatCommand
|
||||||
|
|
||||||
# Enter the commands of your Pack here!
|
# Enter the commands of your Pack here!
|
||||||
available_commands = [
|
available_commands = [
|
||||||
|
@ -124,6 +125,7 @@ available_commands = [
|
||||||
MagicktreasureCommand,
|
MagicktreasureCommand,
|
||||||
TreasureCommand,
|
TreasureCommand,
|
||||||
GivetreasureCommand,
|
GivetreasureCommand,
|
||||||
|
CatCommand,
|
||||||
]
|
]
|
||||||
|
|
||||||
# Don't change this, it should automatically generate __all__
|
# Don't change this, it should automatically generate __all__
|
||||||
|
|
28
royalpack/commands/cat.py
Normal file
28
royalpack/commands/cat.py
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
from typing import *
|
||||||
|
import royalnet.commands as rc
|
||||||
|
import aiohttp
|
||||||
|
import io
|
||||||
|
|
||||||
|
|
||||||
|
class CatCommand(rc.Command):
|
||||||
|
name: str = "cat"
|
||||||
|
|
||||||
|
description: str = "Invia un gatto casuale in chat."
|
||||||
|
|
||||||
|
syntax: str = ""
|
||||||
|
|
||||||
|
aliases = ["catto", "kat", "kitty", "kitten", "gatto", "miao", "garf", "basta"]
|
||||||
|
|
||||||
|
async def run(self, args: rc.CommandArgs, data: rc.CommandData) -> None:
|
||||||
|
async with aiohttp.ClientSession() as session:
|
||||||
|
async with session.get("https://api.thecatapi.com/v1/images/search") as response:
|
||||||
|
if response.status >= 400:
|
||||||
|
raise rc.ExternalError(f"Request returned {response.status}")
|
||||||
|
result = await response.json()
|
||||||
|
assert len(result) == 1
|
||||||
|
cat = result[0]
|
||||||
|
assert "url" in cat
|
||||||
|
url = cat["url"]
|
||||||
|
async with session.get(url) as response:
|
||||||
|
img = await response.content.read()
|
||||||
|
await data.reply_image(image=io.BytesIO(img))
|
|
@ -1 +1 @@
|
||||||
semantic = "5.8.13"
|
semantic = "5.8.14"
|
||||||
|
|
Loading…
Reference in a new issue