How to use the pmxbot.karma.Karma function in pmxbot

To help you get started, we’ve selected a few pmxbot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yougov / pmxbot / tests / unit / test_karma.py View on Github external
def mongodb_karma(self, request, mongodb_uri):
        k = karma.Karma.from_URI(mongodb_uri)
        k.db = k.db.database.connection[k.db.database.name + '_test'][k.db.name]
        request.addfinalizer(k.db.drop)
        return k
github yougov / pmxbot / tests / unit / test_commands.py View on Github external
def test_motivate_with_reason(self):
        """
        Test that motivate ignores the reason
        """
        subject = "foo"
        pre = karma.Karma.store.lookup(subject)
        res = commands.motivate(
            channel="#test", rest=" %s\tfor some really incredible reason" % subject
        )
        assert res == "you're doing good work, %s!" % subject
        post = karma.Karma.store.lookup(subject)
        assert post == pre + 1
github yougov / pmxbot / pmxbot / commands.py View on Github external
(
            "Between the coffee break, the smoking break, the lunch break, "
            "the tea break, the bagel break, and the water cooler break, "
            "may I suggest a work break.  It’s when you do some work"
        ),
        "Work faster",
        "I didn’t realize we paid people for doing that",
        "You aren't being paid to believe in the power of your dreams",
    ]
    suggestion = random.choice(suggestions)
    rest = rest.strip()
    if rest:
        karma.Karma.store.change(rest, -1)
        suggestion = suggestion + ', %s' % rest
    else:
        karma.Karma.store.change(channel, -1)
    karma.Karma.store.change(nick, -1)
    return suggestion