26 lines
828 B
Python
26 lines
828 B
Python
import discord
|
|
from ..utils import helpers
|
|
from discord.ext import commands
|
|
|
|
|
|
class Simp(commands.Cog):
|
|
def __init__(self, bot: discord.Bot):
|
|
self.bot = bot
|
|
|
|
@discord.slash_command(description='Nie, nie jestem pantoflem')
|
|
async def pantofel(self, ctx: discord.ApplicationContext, url: str):
|
|
await ctx.defer()
|
|
|
|
result = helpers.download_video(url)
|
|
|
|
if result['status'] == 'error':
|
|
await ctx.respond(f'Błąd pobierania: {result["message"]}')
|
|
return
|
|
print(f'Wysyłanie {result["title"]} na kanał {ctx.channel.name} ({ctx.guild.name})')
|
|
await ctx.respond(file=discord.File(result['filename']))
|
|
print(f'Wysyłano {result["title"]} na kanał {ctx.channel.name} ({ctx.guild.name})')
|
|
|
|
|
|
def setup(bot: discord.Bot):
|
|
bot.add_cog(Simp(bot))
|