24 lines
692 B
Python
24 lines
692 B
Python
import discord
|
||
from discord.ext import commands
|
||
|
||
from utils.cat import fetch_cat
|
||
|
||
|
||
class Cat(commands.Cog):
|
||
"""Команда !cat — случайный котик"""
|
||
|
||
@commands.command(name="cat")
|
||
async def cat(self, ctx):
|
||
"""Получить случайного котика"""
|
||
url = await fetch_cat()
|
||
if url is None:
|
||
await ctx.send("Не удалось получить котика. Попробуйте позже.")
|
||
return
|
||
|
||
embed = discord.Embed(
|
||
title="Котик для тебя!",
|
||
color=discord.Color.orange()
|
||
)
|
||
embed.set_image(url=url)
|
||
await ctx.send(embed=embed)
|