Upgrading PlayController and Spotify Connection

This commit is contained in:
Rafael Vargas
2022-03-26 17:42:49 -04:00
parent f30513f710
commit 4c66c64041
15 changed files with 213 additions and 163 deletions

12
Utils/Sender.py Normal file
View File

@@ -0,0 +1,12 @@
from discord.ext.commands import Context
from discord import Embed
class Sender:
@classmethod
async def send_embed(cls, ctx: Context, embed: Embed) -> None:
pass
@classmethod
async def send_message(cls, ctx: Context, message: Embed) -> None:
pass

View File

@@ -5,6 +5,33 @@ from functools import wraps, partial
config = Configs()
class Utils:
@classmethod
def format_time(cls, duration) -> str:
if not duration:
return "00:00"
hours = duration // 60 // 60
minutes = duration // 60 % 60
seconds = duration % 60
return "{}{}{:02d}:{:02d}".format(
hours if hours else "",
":" if hours else "",
minutes,
seconds)
@classmethod
def is_url(cls, string) -> bool:
regex = re.compile(
"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+")
if re.search(regex, string):
return True
else:
return False
def is_connected(ctx):
try:
voice_channel = ctx.guild.voice_client.channel