editing date format
This commit is contained in:
@@ -90,12 +90,15 @@ async def display_server_queue(ctx: Context, songs, n):
|
||||
|
||||
# Converts seconds into more readable format
|
||||
def format_time(seconds):
|
||||
minutes, seconds = divmod(seconds, 60)
|
||||
hours, minutes = divmod(minutes, 60)
|
||||
try:
|
||||
minutes, seconds = divmod(seconds, 60)
|
||||
hours, minutes = divmod(minutes, 60)
|
||||
|
||||
if hours > 0:
|
||||
return f"{hours}:{minutes:02d}:{seconds:02d}"
|
||||
elif minutes > 0:
|
||||
return f"{minutes}:{seconds:02d}"
|
||||
else:
|
||||
return f"{seconds} seconds"
|
||||
if hours > 0:
|
||||
return f"{hours}:{minutes:02d}:{seconds:02d}"
|
||||
elif minutes > 0:
|
||||
return f"{minutes}:{seconds:02d}"
|
||||
else:
|
||||
return f"{seconds} seconds"
|
||||
except:
|
||||
return ""
|
||||
|
||||
15
main.py
15
main.py
@@ -1,4 +1,5 @@
|
||||
import discord
|
||||
from discord.ext import tasks
|
||||
from bot import Astro
|
||||
import config
|
||||
import help
|
||||
@@ -6,4 +7,16 @@ import help
|
||||
client = Astro(command_prefix=config.get_prefix(), intents=discord.Intents.all())
|
||||
client.help_command = help.AstroHelp()
|
||||
|
||||
client.run(config.get_login("dev"))
|
||||
@client.event
|
||||
async def on_voice_state_update(member, before, after):
|
||||
if member == client.user:
|
||||
return #ignore self actions
|
||||
|
||||
# get the vc
|
||||
voice_client = discord.utils.get(client.voice_clients, guild=member.guild)
|
||||
|
||||
# if the bot is the only connected member, leave
|
||||
if voice_client and len(voice_client.channel.members) == 1:
|
||||
await voice_client.disconnect()
|
||||
|
||||
client.run(config.get_login("live"))
|
||||
|
||||
Reference in New Issue
Block a user