mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
Version command (#183)
This commit is contained in:
parent
71240e56a0
commit
81409271f5
13
red.py
13
red.py
@ -299,6 +299,19 @@ async def _uptime():
|
|||||||
up = str(datetime.timedelta(seconds=up))
|
up = str(datetime.timedelta(seconds=up))
|
||||||
await bot.say("`Uptime: {}`".format(up))
|
await bot.say("`Uptime: {}`".format(up))
|
||||||
|
|
||||||
|
@bot.command()
|
||||||
|
async def version():
|
||||||
|
"""Shows Red's current version"""
|
||||||
|
loop = asyncio.get_event_loop()
|
||||||
|
response = loop.run_in_executor(None, get_version)
|
||||||
|
result = await asyncio.wait_for(response, timeout=10)
|
||||||
|
await bot.say(result)
|
||||||
|
|
||||||
|
def get_version():
|
||||||
|
getversion = os.popen(r'git show -s HEAD --format="%cr|%s|%h"').read()
|
||||||
|
version = getversion.split('|')
|
||||||
|
return 'Last updated: ``{}``\nCommit: ``{}``\nHash: ``{}``'.format(*version)
|
||||||
|
|
||||||
def user_allowed(message):
|
def user_allowed(message):
|
||||||
|
|
||||||
author = message.author
|
author = message.author
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user