mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Adding more stability to Searcher
This commit is contained in:
@@ -32,44 +32,6 @@ class Utils:
|
||||
return False
|
||||
|
||||
|
||||
def is_connected(ctx):
|
||||
try:
|
||||
voice_channel = ctx.guild.voice_client.channel
|
||||
|
||||
if not ctx.guild.voice_client.is_connected():
|
||||
return None
|
||||
else:
|
||||
return voice_channel
|
||||
except:
|
||||
return None
|
||||
|
||||
|
||||
def format_time(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
|
||||
)
|
||||
|
||||
|
||||
def is_url(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
|
||||
|
||||
|
||||
class Timer:
|
||||
def __init__(self, callback):
|
||||
self.__callback = callback
|
||||
|
||||
Reference in New Issue
Block a user