Commited backup

This commit is contained in:
2025-07-10 21:02:34 +03:00
parent 952c1001e3
commit da0b80823e
1310 changed files with 254133 additions and 41 deletions

View File

@@ -0,0 +1,31 @@
# meta developer: @modwini
from .. import loader
import requests
import io
from PIL import Image
@loader.tds
class CatModule(loader.Module):
"""Отправляет случайное фото котика."""
strings = {"name": "Cat"}
async def client_ready(self, client, db):
self.client = client
@loader.owner
async def catcmd(self, message):
"""Отправляет случайное фото котика."""
url = "https://api.thecatapi.com/v1/images/search"
response = requests.get(url)
if response.status_code == 200:
img_url = response.json()[0]['url']
response = requests.get(img_url)
img = Image.open(io.BytesIO(response.content))
if img.mode == 'P':
img = img.convert('RGB')
output = io.BytesIO()
img.save(output, format='JPEG')
output.seek(0)
await self.client.send_file(message.to_id, output, reply_to=message)