diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ca47fc..12c8ad3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ Changelog Format: Note: log only changes which go into release Note: last records on top ---> +### Version 0.5.3 20180208 + +* /version command ### Version 0.5.2 20180208 diff --git a/bot/bot.py b/bot/bot.py index 0ecadbf..8876d3c 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -4,7 +4,7 @@ import motor.motor_asyncio import re -USER_AGENT = 'SPbPython / 0.5.2' +USER_AGENT = 'SPbPython / 0.5.3' class Bot(BaseBot): diff --git a/bot/main.py b/bot/main.py index be55b5c..9aacce8 100644 --- a/bot/main.py +++ b/bot/main.py @@ -18,6 +18,7 @@ logger.addHandler(ch) DEBUG = "DEBUG" in os.environ +VERSION_URL = "https://img.shields.io/github/tag/nonamenix/spb_python_bot.json" def get_moderators(): @@ -68,6 +69,15 @@ def wrapper(*args, **kwargs): return actual_decorator +@bot.command('/version') +async def version(chat, message): + async with aiohttp.ClientSession() as session: + async with session.get(VERSION_URL) as resp: + data = await resp.json() + version = data['value'] + await chat.reply("version: {}".format(version)) + + @bot.moderator_command("/?ping") async def ping(chat, message): await chat.reply("pong")