Skip to content

Commit

Permalink
/version command
Browse files Browse the repository at this point in the history
  • Loading branch information
nonamenix committed Feb 8, 2018
1 parent eacf6b5 commit 27da981
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
10 changes: 10 additions & 0 deletions bot/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 27da981

Please sign in to comment.