commit 936dfe9e26f4d62b1e35b8b87ba8056d93ba7081 Author: Pulguer Gonzalo Date: Tue Nov 9 19:29:34 2021 -0300 initial commit diff --git a/juanzhi.jpg b/juanzhi.jpg new file mode 100644 index 0000000..1698a33 Binary files /dev/null and b/juanzhi.jpg differ diff --git a/juanzhi_bot.py b/juanzhi_bot.py new file mode 100644 index 0000000..b218980 --- /dev/null +++ b/juanzhi_bot.py @@ -0,0 +1,81 @@ +import inf0 +import discord +import os +from discord.ext import commands +from discord.utils import get +from discord import FFmpegPCMAudio +from discord import TextChannel +from youtube_dl import YoutubeDL + +client = commands.Bot(command_prefix='ç') + +players = {} + + +@client.event +async def on_ready(): + print('Capitán Teemo de servicio!') + + +@client.command() +async def join(ctx): + channel = ctx.message.author.voice.channel + voice = get(client.voice_clients, guild=ctx.guild) + if voice and voice.is_connected(): + await voice.move_to(channel) + else: + voice = await channel.connect() + + +@client.command() +async def play(ctx, url): + YDL_OPTIONS = {'format': 'bestaudio', 'noplaylist': 'True'} + FFMPEG_OPTIONS = { + 'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'} + voice = get(client.voice_clients, guild=ctx.guild) + + if not voice.is_playing(): + with YoutubeDL(YDL_OPTIONS) as ydl: + info = ydl.extract_info(url, download=False) + URL = info['url'] + voice.play(FFmpegPCMAudio(URL, **FFMPEG_OPTIONS)) + voice.is_playing() + await ctx.send('._.') + + else: + await ctx.send("._.") + return + + +@client.command() +async def resume(ctx): + voice = get(client.voice_clients, guild=ctx.guild) + + if not voice.is_playing(): + voice.resume() + await ctx.send('-_-') + + +@client.command() +async def pause(ctx): + voice = get(client.voice_clients, guild=ctx.guild) + + if voice.is_playing(): + voice.pause() + await ctx.send('Pausa3') + + +@client.command() +async def stop(ctx): + voice = get(client.voice_clients, guild=ctx.guild) + + if voice.is_playing(): + voice.stop() + +@client.command() +async def disconnect(ctx): + channel = ctx.message.author.voice.channel + await ctx.send('nv pai') + await ctx.voice_client.disconnect() + +client.run(inf0.dc_data)