forked from jocadbz/os-release-bot
Compare commits
No commits in common. "975fabf7eb56b0a2134dac8ee555ed2bed869ffb" and "4d19b76a65eb46a5f9747c6239a123db7ba5bd05" have entirely different histories.
975fabf7eb
...
4d19b76a65
17
bot.py
17
bot.py
|
@ -2,7 +2,7 @@
|
|||
# Code revised by BodgeMaster
|
||||
# Code Licensed under GPL 3.0
|
||||
|
||||
import sys, time, json, datetime
|
||||
import sys, time, json
|
||||
|
||||
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 uptime():
|
||||
return str(datetime.timedelta(seconds=int(time.time() - BOOT_TIME)))
|
||||
def seconds_elapsed():
|
||||
return int(time.time() - BOOT_TIME)
|
||||
|
||||
|
||||
class MyClient(discord.Client):
|
||||
|
@ -100,12 +100,13 @@ 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=uptime(), inline=True)
|
||||
embed.add_field(name="Version:", value=config["bot version"], inline=True)
|
||||
embed.set_footer(text=config["bot issues"])
|
||||
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)
|
||||
url_view = discord.ui.View()
|
||||
url_view.add_item(discord.ui.Button(label='View source...', style=discord.ButtonStyle.url, url=config["bot source url"]))
|
||||
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"))
|
||||
await interaction.response.send_message(embed=embed, view=url_view)
|
||||
print("Status queried.")
|
||||
|
||||
|
|
|
@ -4,9 +4,5 @@
|
|||
"assign0": 1063506453308125274,
|
||||
"assign1": 1063506544962064414
|
||||
},
|
||||
"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"
|
||||
"report channel": 1063507041697677312
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue