import nextcord
from nextcord import File, ButtonStyle
from nextcord.ext import commands
from nextcord.ui import Button, View
import dotenv
import aiosqlite
import datetime
import os
from os import environ as env
import wavelink
dotenv.load_dotenv()
def get_time():
return datetime.datetime.now().strftime("%H:%M:%S")
intents=nextcord.Intents.all()
intents.message_content = True
bot = commands.Bot(command_prefix='!',intents=intents,help_command=None)
@bot.event
async def on_ready():
print(f"whazdup")
db = await aiosqlite.connect("database.db")
bot.loop.create_task(node_connect())
@bot.event
async def on_wavelink_node_ready(node: wavelink.Node):
print(f"{node.identifier} is ready")
async def node_connect():
await bot.wait_until_ready()
await wavelink.NodePool.create_node(bot=bot, host='lavalinkinc.ml', port=443, password='incognito', https=True)
@bot.command()
async def play(ctx: commands.Context, *, search: wavelink.YouTubeTrack):
if not ctx.voice_client:
vc: wavelink.Player = await ctx.author.voice.channel.connect(cls=wavelink.Player)
elif not getattr(ctx.author.voice, 'channel', None):
return await ctx.send("Добавьте для начала голосовой канал.")
else:
vc: wavelink.Player = ctx.voice_client
await vc.play(search)
await ctx.send(f"Сейчас играет: {search.title}")
bot.run(env['TOKEN'])