forked from jocadbz/os-release-bot
Make uptime readable
parent
b9b2c050c3
commit
a22bbdc1c5
8
bot.py
8
bot.py
|
@ -2,7 +2,7 @@
|
|||
# Code revised by BodgeMaster
|
||||
# Code Licensed under GPL 3.0
|
||||
|
||||
import sys, time, json
|
||||
import sys, time, json, datetime
|
||||
|
||||
import discord
|
||||
from discord import app_commands
|
||||
|
@ -16,8 +16,8 @@ config_file = open("config.json", "r")
|
|||
config = json.loads(config_file.read());
|
||||
config_file.close()
|
||||
|
||||
def seconds_elapsed():
|
||||
return int(time.time() - BOOT_TIME)
|
||||
def uptime():
|
||||
return str(datetime.timedelta(seconds=int(time.time() - BOOT_TIME)))
|
||||
|
||||
|
||||
class MyClient(discord.Client):
|
||||
|
@ -101,7 +101,7 @@ async def report_message(interaction: discord.Interaction, message: discord.Mess
|
|||
@client.tree.command(name="status")
|
||||
async def status(interaction: discord.Interaction):
|
||||
embed = discord.Embed(title='/etc/os-release bot by jocadbz')
|
||||
embed.add_field(name="Uptime:", value=seconds_elapsed(), inline=True)
|
||||
embed.add_field(name="Uptime:", value=uptime(), inline=True)
|
||||
embed.add_field(name="Version:", value=config["bot version"], inline=True)
|
||||
embed.set_footer(text=config["bot issues"])
|
||||
url_view = discord.ui.View()
|
||||
|
|
Loading…
Reference in New Issue