added db functions and join/leave vc

This commit is contained in:
2023-05-24 09:23:30 +01:00
parent 2cd080bf02
commit 94584f1028
4 changed files with 177 additions and 4 deletions

View File

@@ -1,23 +1,41 @@
import discord
from discord.ext import commands
from discord.ext.commands.context import Context
import cogs.music.util as util
import datetime
import pytz
from cogs.music.help import music_help
class music(commands.Cog):
def __init__(self, client):
self.client = client
self.name = "🎶 Music"
self.emoji = "🎶"
self.client = client
help_command = music_help()
help_command.cog = self
self.help_command = help_command
@commands.command(
help="Displays latency from the bot",
aliases=['delay'])
async def ping(self, e: Context):
async def ping(self, ctx: Context):
start_time = datetime.datetime.now(pytz.utc)
end_time = e.message.created_at
end_time = ctx.message.created_at
delay = int((end_time - start_time).total_seconds() * 1000)
await e.send(f"Pong! `{delay}MS`")
await ctx.send(f"Pong! `{delay}MS`")
@commands.command(
help="Connects to your current voice channel",
aliases=['connect'])
async def join(self, ctx: Context):
await util.join_vc(ctx)
await ctx.message.add_reaction('👍')