How to use the pmxbot.karma.Karma.store.lookup 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_commands.py View on Github external
def test_imotivate(self):
        """
        Test that ironic/sarcastic motivate actually works.
        """
        subject = "foo"
        pre = karma.Karma.store.lookup(subject)
        res = commands.imotivate(rest=subject, channel="#test")
        assert res == """you're "doing" "good" "work", %s!""" % subject
        post = karma.Karma.store.lookup(subject)
        assert post == pre - 1
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 / tests / unit / test_commands.py View on Github external
def test_boo(self):
        """
        Test "boo foo"
        """
        subject = "foo"
        pre = karma.Karma.store.lookup(subject)
        res = commands.boo(subject)
        assert res == "/me BOOO %s!!! BOOO!!!" % subject
        post = karma.Karma.store.lookup(subject)
        assert post == pre - 1
github yougov / pmxbot / tests / unit / test_commands.py View on Github external
def test_keelhaul(self):
        """
        Test "keelhaul foo"
        """
        subject = "foo"
        pre = karma.Karma.store.lookup(subject)
        res = commands.keelhaul(subject)
        assert res == (
            "/me straps %s to a dirty rope, tosses 'em overboard and "
            "pulls with great speed. Yarrr!" % subject
        )
        post = karma.Karma.store.lookup(subject)
        assert post == pre - 1
github yougov / pmxbot / tests / unit / test_commands.py View on Github external
def test_motivate(self):
        """
        Test that motivate actually works.
        """
        subject = "foo"
        pre = karma.Karma.store.lookup(subject)
        res = commands.motivate(channel="#test", rest=subject)
        assert res == "you're doing good work, %s!" % subject
        post = karma.Karma.store.lookup(subject)
        assert post == pre + 1
github yougov / pmxbot / tests / unit / test_commands.py View on Github external
def test_demotivate(self):
        """
        Test that demotivate actually works.
        """
        subject = "foo"
        pre = karma.Karma.store.lookup(subject)
        res = commands.demotivate(rest=subject, channel="#test")
        assert res == "you're doing horrible work, %s!" % subject
        post = karma.Karma.store.lookup(subject)
        assert post == pre - 1
github yougov / pmxbot / tests / unit / test_commands.py View on Github external
def test_demotivate(self):
        """
        Test that demotivate actually works.
        """
        subject = "foo"
        pre = karma.Karma.store.lookup(subject)
        res = commands.demotivate(rest=subject, channel="#test")
        assert res == "you're doing horrible work, %s!" % subject
        post = karma.Karma.store.lookup(subject)
        assert post == pre - 1
github yougov / pmxbot / tests / unit / test_commands.py View on Github external
def test_keelhaul(self):
        """
        Test "keelhaul foo"
        """
        subject = "foo"
        pre = karma.Karma.store.lookup(subject)
        res = commands.keelhaul(subject)
        assert res == (
            "/me straps %s to a dirty rope, tosses 'em overboard and "
            "pulls with great speed. Yarrr!" % subject
        )
        post = karma.Karma.store.lookup(subject)
        assert post == pre - 1
github yougov / pmxbot / pmxbot / karma.py View on Github external
elif change == -1:
            return "%s karma--" % karmee
    elif '==' in rest:
        t1, t2 = rest.split('==')
        try:
            Karma.store.link(t1, t2)
        except SameName:
            Karma.store.change(nick, -1)
            return "Don't try to link a name to itself!"
        except AlreadyLinked:
            return "Those names were previously linked."
        score = Karma.store.lookup(t1)
        return "%s and %s are now linked and have a score of %s" % (t1, t2, score)
    else:
        karmee = rest or nick
        score = Karma.store.lookup(karmee)
        return "%s has %s karmas" % (karmee, score)