Compare commits

...

2 Commits

Author SHA1 Message Date
BodgeMaster 975fabf7eb Make uptime readable 2023-01-21 20:44:50 +01:00
BodgeMaster ae203e2ad3 Remove useless information from status command and make it configurable 2023-01-21 20:44:01 +01:00
2 changed files with 13 additions and 10 deletions

17
bot.py
View File

@ -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):
@ -100,13 +100,12 @@ 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='System Stats')
embed.add_field(name="Uptime:", value=seconds_elapsed(), inline=True)
embed.add_field(name="System:", value=sys.platform, inline=True)
embed.add_field(name="Version:", value="v1.2.0", inline=True)
embed = discord.Embed(title='/etc/os-release bot by jocadbz')
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()
url_view.add_item(discord.ui.Button(label='See the source code', style=discord.ButtonStyle.url, url="https://lostcave.ddnss.de/git/jocadbz/os-release-bot"))
url_view.add_item(discord.ui.Button(label='Report a issue', style=discord.ButtonStyle.url, url="https://lostcave.ddnss.de/git/jocadbz/os-release-bot/issues"))
url_view.add_item(discord.ui.Button(label='View source...', style=discord.ButtonStyle.url, url=config["bot source url"]))
await interaction.response.send_message(embed=embed, view=url_view)
print("Status queried.")

View File

@ -4,5 +4,9 @@
"assign0": 1063506453308125274,
"assign1": 1063506544962064414
},
"report channel": 1063507041697677312
"report channel": 1063507041697677312,
"bot version": "v1.3",
"bot issues": "Please report issues to BodgeMaster or jocadbz.",
"bot source url": "https://lostcave.ddnss.de/git/jocadbz/os-release-bot"
}