Skip to content

Commit

Permalink
Function get_approval_comment_body update for dust
Browse files Browse the repository at this point in the history
This is to indicate the user is being rewarded via beneficiary rewards vs an upvote when their flag does not meet our SBD minimum payout threshold. Also, enclosed the code pulling the category in a try - except so that key errors are no longer a bot "show-stopper" (requiring admin intervention to restart).
  • Loading branch information
anthonyadavisii authored Jan 23, 2019
1 parent e99f6bf commit e3b68ca
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions sfrbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,27 @@ def get_abuse_categories(comment_body):
return cats


def get_approval_comment_body(flagger, abuse_categories):
def get_approval_comment_body(flagger, abuse_categories, dust=False):
""" assemble the body for the flag approval comment """
cat_string = ''.join([cfg.CATEGORIES[cat] for cat in abuse_categories])
body = 'Steem Flag Rewards mention comment has been approved! ' \
'Thank you for reporting this abuse, @{}.\n{}\n\n' \
'This post was submitted via our Discord Community channel. ' \
'Check us out on the following link!\n[SFR Discord]({})'.format(
flagger, cat_string, cfg.DISCORD_INVITE)
cat_string = ''
try:
cat_string = ''.join([cfg.CATEGORIES[cat] for cat in abuse_categories])
except KeyError:
print('Key error grabbing category with '+str(abuse_categories))
logging.info('Key error grabbing category with '+str(abuse_categories))
if dust is True:
body = 'Steem Flag Rewards mention comment has been approved ' \
'for flagger beneficiary post rewards! ' \
'Thank you for reporting this abuse, @{}.\n{}\n\n' \
'This post was submitted via our Discord Community channel. ' \
'Check us out on the following link!\n[SFR Discord]({})'.format(
flagger, cat_string, cfg.DISCORD_INVITE)
else:
body = 'Steem Flag Rewards mention comment has been approved! ' \
'Thank you for reporting this abuse, @{}.\n{}\n\n' \
'This post was submitted via our Discord Community channel. ' \
'Check us out on the following link!\n[SFR Discord]({})'.format(
flagger, cat_string, cfg.DISCORD_INVITE)
return body


Expand Down

0 comments on commit e3b68ca

Please sign in to comment.