Skip to content
This repository has been archived by the owner on Oct 14, 2019. It is now read-only.

Commit

Permalink
Merge pull request #297 from thecsw/version
Browse files Browse the repository at this point in the history
Added the version command.
  • Loading branch information
thecsw authored Jan 14, 2019
2 parents 76c6ef8 + efe1b06 commit 3f4c35f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/comment_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class CommentWorker():
r"!invest\s+([\d,.]+)\s*(%s)?(?:\s|$)" % "|".join(multipliers),
r"!market",
r"!top",
r"!version",
r"!grant\s+(\S+)\s+(\S+)",
r"!firm",
r"!createfirm\s+(.+)",
Expand Down Expand Up @@ -330,6 +331,12 @@ def grant(self, sess, comment, grantee, badge):
investor.badges = json.dumps(badge_list)
return comment.reply_wrap(message.modify_grant_success(grantee, badge))

def version(self, sess, comment):
"""
Return the date when the bot was deployed
"""
return comment.reply_wrap(message.modify_deploy_version(utils.DEPLOY_DATE))

@req_user
def firm(self, sess, comment, investor):
if investor.firm == 0:
Expand Down
8 changes: 8 additions & 0 deletions src/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,3 +496,11 @@ def modify_firm_tax(tax_amount, firm_name):
return FIRM_TAX_ORG.\
replace("%AMOUNT%", tax_amount).\
replace("%NAME%", firm_name)

DEPLOY_VERSION = """
Current version of the bot is deployed since `%DATE%`
"""

def modify_deploy_version(date):
return DEPLOY_VERSION.\
replace("%DATE%", date)
3 changes: 3 additions & 0 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
import datetime
import traceback
import logging
import time

import prawcore

logging.basicConfig(level=logging.INFO)

DEPLOY_DATE = time.strftime("%c")

def investment_duration_string(duration):
"""
We may change the investment duration in the future
Expand Down

0 comments on commit 3f4c35f

Please sign in to comment.