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

Added the version command. #297

Merged
merged 2 commits into from
Jan 14, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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