Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions status/ss13status.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,3 +641,34 @@ async def server_check_loop(self): #This will be used to cache statuses later
next_check = datetime.utcfromtimestamp(now.timestamp() + check_time)
log.debug("Done. Next check at {}".format(next_check.strftime("%Y-%m-%d %H:%M:%S")))
await asyncio.sleep(check_time)

async def byond(self, ctx):
"""
Provides the current byond version
"""
port = await self.config.game_port()
msg = await self.config.offline_message()
server_url = await self.config.server_url()
try:
server = socket.gethostbyname(await self.config.server())
data = await self.query_server(server, port)
except TypeError:
await ctx.send(f"Failed to get the server's status. Check that you have fully configured this cog using `{ctx.prefix}setstatus`.")
return

if not data: #Server is not responding, send the offline message
embed=discord.Embed(title="__Server Status:__", description=f"Failed to get byond version", color=0xff0000)
await ctx.send(embed=embed)

else:
byond_version = data['byond_version']
byond_build = data['byond_build']
embed=discord.Embed(color=0x26eaea)
embed.add_field(name="Version", value=byond_version + "." + byond_build, inline=True)
embed.add_field(name="Downgrade", value= '''Older versions: https://www.byond.com/download/build/''', inline=True)

try:
await self.statusmsg.delete()
self.statusmsg = await ctx.send(embed=embed)
except(discord.DiscordException, AttributeError):
self.statusmsg = await ctx.send(embed=embed)