diff --git a/red.py b/red.py index f53b07670..d95058ba3 100644 --- a/red.py +++ b/red.py @@ -299,6 +299,19 @@ async def _uptime(): up = str(datetime.timedelta(seconds=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): author = message.author @@ -372,7 +385,7 @@ def check_configs(): print("If you're not interested in a bot account, create a normal account on https://discordapp.com") print("Otherwise make one and copy the token from https://discordapp.com/developers/applications/me") print("\nType your email or token:") - + choice = input("> ") if "@" not in choice and len(choice) >= 50: #Assuming token