forked from jocadbz/os-release-bot
				
			Compare commits
	
		
			2 Commits 
		
	
	
		
			4d19b76a65
			...
			975fabf7eb
		
	
	| Author | SHA1 | Date | 
|---|---|---|
|  BodgeMaster | 975fabf7eb | |
|  BodgeMaster | ae203e2ad3 | 
							
								
								
									
										17
									
								
								bot.py
								
								
								
								
							
							
						
						
									
										17
									
								
								bot.py
								
								
								
								
							|  | @ -2,7 +2,7 @@ | ||||||
| # Code revised by BodgeMaster | # Code revised by BodgeMaster | ||||||
| # Code Licensed under GPL 3.0 | # Code Licensed under GPL 3.0 | ||||||
| 
 | 
 | ||||||
| import sys, time, json | import sys, time, json, datetime | ||||||
| 
 | 
 | ||||||
| import discord | import discord | ||||||
| from discord import app_commands | from discord import app_commands | ||||||
|  | @ -16,8 +16,8 @@ config_file = open("config.json", "r") | ||||||
| config = json.loads(config_file.read()); | config = json.loads(config_file.read()); | ||||||
| config_file.close() | config_file.close() | ||||||
| 
 | 
 | ||||||
| def seconds_elapsed(): | def uptime(): | ||||||
|     return int(time.time() - BOOT_TIME) |     return str(datetime.timedelta(seconds=int(time.time() - BOOT_TIME))) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class MyClient(discord.Client): | class MyClient(discord.Client): | ||||||
|  | @ -100,13 +100,12 @@ async def report_message(interaction: discord.Interaction, message: discord.Mess | ||||||
| 
 | 
 | ||||||
| @client.tree.command(name="status") | @client.tree.command(name="status") | ||||||
| async def status(interaction: discord.Interaction): | async def status(interaction: discord.Interaction): | ||||||
|     embed = discord.Embed(title='System Stats') |     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="System:", value=sys.platform, inline=True) |     embed.add_field(name="Version:", value=config["bot version"], inline=True) | ||||||
|     embed.add_field(name="Version:", value="v1.2.0", inline=True) |     embed.set_footer(text=config["bot issues"]) | ||||||
|     url_view = discord.ui.View() |     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='View source...', style=discord.ButtonStyle.url, url=config["bot source url"])) | ||||||
|     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) |     await interaction.response.send_message(embed=embed, view=url_view) | ||||||
|     print("Status queried.") |     print("Status queried.") | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -4,5 +4,9 @@ | ||||||
|         "assign0": 1063506453308125274, |         "assign0": 1063506453308125274, | ||||||
|         "assign1": 1063506544962064414 |         "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" | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue