示例#1
0
    def test_karma(self):
        subject = User("gary")
        other_user = User("ash")
        assert subject.karma() == 0
        other_user.set_ride_or_die(subject.name)
        assert subject.karma() == 1

        another_user = User("meowth")
        another_user.set_ride_or_die(subject.name)
        assert subject.karma() == 2

        other_user.set_ride_or_die(another_user.name)
        assert subject.karma() == 1
示例#2
0
def sync_main():
    PlaySoundeffectRequest(user="******", command="openingbell").save()

    while True:
        try:
            peasants = ChatLogs().recent_stream_peasants()
            # We need to make this better
            result = drop_random_soundeffect_to_user(
                random.sample(peasants, 1)[0])
            send_twitch_msg(result)

            for peasant in peasants:
                if peasant not in BLACKLIST:
                    user = User(peasant)
                    user_karma = user.karma()
                    print(f"@{peasant} Karma: {user.karma()}")
                    user.update_street_cred(1)
                    # user.update_street_cred(1 + user_karma)
                    user.revive(3 + user_karma)

            send_twitch_msg("CoolCat CoolCat CoolCat")
            # formatted_peasants = [f"@{peasant}" for peasant in peasants]
            # send_twitch_msg(
            #     f"Squid1 Enjoy your street cred: {' '.join(formatted_peasants)} Squid4"
            # )

            # Every 5 minutes, all the chatters have a chance at some street cred
            # os.system("time make deploy")
            time.sleep(300)
        except Exception as e:
            time.sleep(30)
            if e is KeyboardInterrupt:
                raise e
            else:
                traceback.print_exc()
示例#3
0
 def test_setting_ride_or_die_to_self(self):
     subject = User("gary")
     subject.set_ride_or_die("gary")
     assert subject.karma() == 0