Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add in ability to give negative points. #13 #22

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open

Add in ability to give negative points. #13 #22

wants to merge 18 commits into from

Conversation

JacobJerrell
Copy link

@JacobJerrell JacobJerrell commented Nov 14, 2017

Added NEG_POINTS = 'ALLOW' / 'DISALLOW' environment variable.
If set to allow, it will expect the NEGATIVE_EMOJI, and NEGATIVE_POINTS environment variables.

  • Added _extract_type to FireballMessage which will return EMOJI or NEGATIVE_EMOJI

  • Added kind to check_user_points_remaining functions ( check_user_points_remaining(user_id, num, kind==EMOJI) ). Instead of coding another function to check negative points. Can we do things this way, or make separate functions for everything?

  • Added command handling to the bot

  • Work out leaderboard issues

  • Add negative points support to check_points bot commands

  • Add functionality to Azure/Redis storage

  • Other things I didn't think of

Basically hoping for a code review to make sure I'm headed in the right direction

kylesykes and others added 18 commits November 9, 2017 23:51
Fixed leaderboard errors. Removed user tagging in leaderboards.
Fixing colors indexing error.
Added username validation. Fixed leaderboard truncation.
Adding functions/methods to prevent the bot from sending PM's. Currently working for InMemoryStorage
Added PM Preferences methods to AzureStorage(storage) class
Added methods to RedisStorage to make use of the PM Preference setting. (left commented out)
Preparing to work new issue
-Added negative points to list of accepted commands/commands_with_target
-Added logic to _extract_count for negative_emoji
-Added neg_points methods to the base storage class
-Coded out neg_points methods in the InMemoryStorage class
-Making lint happy
- Added logic to determine whether :NEGATIVE-EMOJI: or :EMOJI: was passed.
-get_user_neg_points_remaining(user_id) coded out
- 'allneg' command handling
- determine whether give or giveneg was implied
- Added `kind` to 'get points remaining' functions/methods
- Added handling for give negative points commands
It's unnecessary to check for NEG_POINTS == 'ALLOW'.
If NEG_POINTS != 'ALLOW', the NEGATIVE_EMOJI, and NEGATIVE_POINTS environment variables won't be loaded so any check against one of those variables should return false
@@ -19,25 +19,33 @@
BOT_ID = os.environ.get("BOT_ID")
EMOJI = os.environ.get('EMOJI')
POINTS = os.environ.get('POINTS')
SELF_POINTS = os.environ.get('SELF_POINTS', "DISALLOW")
SELF_POINTS = os.environ.get('SELF_POINTS', "ALLOW")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the default should be DISALLOW.

@@ -19,25 +19,33 @@
BOT_ID = os.environ.get("BOT_ID")
EMOJI = os.environ.get('EMOJI')
POINTS = os.environ.get('POINTS')
SELF_POINTS = os.environ.get('SELF_POINTS', "DISALLOW")
SELF_POINTS = os.environ.get('SELF_POINTS', "ALLOW")
NEG_POINTS = os.environ.get('NEG_POINTS', "ALLOW")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the default should be DISALLOW.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I must have forgotten to switch those off when I was done testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants