editing date format
This commit is contained in:
@@ -90,6 +90,7 @@ async def display_server_queue(ctx: Context, songs, n):
|
|||||||
|
|
||||||
# Converts seconds into more readable format
|
# Converts seconds into more readable format
|
||||||
def format_time(seconds):
|
def format_time(seconds):
|
||||||
|
try:
|
||||||
minutes, seconds = divmod(seconds, 60)
|
minutes, seconds = divmod(seconds, 60)
|
||||||
hours, minutes = divmod(minutes, 60)
|
hours, minutes = divmod(minutes, 60)
|
||||||
|
|
||||||
@@ -99,3 +100,5 @@ def format_time(seconds):
|
|||||||
return f"{minutes}:{seconds:02d}"
|
return f"{minutes}:{seconds:02d}"
|
||||||
else:
|
else:
|
||||||
return f"{seconds} seconds"
|
return f"{seconds} seconds"
|
||||||
|
except:
|
||||||
|
return ""
|
||||||
|
|||||||
15
main.py
15
main.py
@@ -1,4 +1,5 @@
|
|||||||
import discord
|
import discord
|
||||||
|
from discord.ext import tasks
|
||||||
from bot import Astro
|
from bot import Astro
|
||||||
import config
|
import config
|
||||||
import help
|
import help
|
||||||
@@ -6,4 +7,16 @@ import help
|
|||||||
client = Astro(command_prefix=config.get_prefix(), intents=discord.Intents.all())
|
client = Astro(command_prefix=config.get_prefix(), intents=discord.Intents.all())
|
||||||
client.help_command = help.AstroHelp()
|
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