Renaming modules, removing useless and changing logic of bot initialization

This commit is contained in:
Rafael Vargas
2022-01-06 18:25:17 -04:00
parent 9c327b8dbf
commit 74d91c15f8
22 changed files with 33 additions and 209 deletions

36
vulkan/music/utils.py Normal file
View File

@@ -0,0 +1,36 @@
import re
def is_connected(ctx):
try:
voice_channel = ctx.guild.voice_client.channel
return voice_channel
except:
return None
def format_time(duration):
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
)
def is_url(string) -> bool:
"""Verify if a string is a url"""
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