def test_dropeffect(self): result = BeginFund().dropeffect() assert result == "The Fed is Broke" Command("damn", 2).save() Command("handbag", 10).save() TheFed.collect_taxes() assert TheFed.reserve() == 6 result = BeginFund().dropeffect() assert "now has access" in result
def test_dropping_specific_effects(self): Command("handbag", 10).save() TheFed.collect_taxes() assert TheFed.reserve() == 5 result = BeginFund(target_user="******", target_command="damn").dropeffect() assert result == "@uzi now has access to !damn" assert TheFed.reserve() == 4 result = BeginFund(target_command="damn", amount=2).dropeffect() assert "now has access to !damn" in result assert TheFed.reserve() == 2
def guess_pokemon(cls, user, guess): pokemon = cls.MYSTERY_POKEMON_PATH.read_text() print(f"@{user} guessed {guess}") if guess == pokemon: cls.MYSTERY_POKEMON_PATH.unlink() guess_count = cls.guesses() cls.GUESSES_PATH.unlink() result = f"{user} Won! {pokemon} - Beating {guess_count} Other People" prize = None if user not in STREAM_GODS: prize = BeginFund(target_user=user).dropeffect() result += f" | {prize}" if "TEST_MODE" not in os.environ: soundfile = SoundeffectsLibrary.find_sample("pokewin") AudioPlayer.play_sample(soundfile.resolve(), notification=False) Notification(f"{user} won: {guess}").save() return result else: with open(cls.GUESSES_PATH, "a") as f: f.write(f"{user}: {guess}\n") return f"@{user} YOU WERE WRONG"
def _welcome(self, user): sound_effect_files = SoundeffectsLibrary.find_soundeffect_files(user) if sound_effect_files: effect = sound_effect_files[0] command = Command(user) command.update_health(1) PlaySoundeffectRequest(user=user, command=user).save() else: # Use non private method User(user)._find_or_create_user() send_twitch_msg(BeginFund(user).dropeffect())
def _welcome(self, user): sound_effect_files = SoundeffectsLibrary.find_soundeffect_files(user) if sound_effect_files: effect = sound_effect_files[0] command = Command(user) command.update_health(1) PlaySoundeffectRequest(user=user, command=user).save() else: # Use non private method User(user)._find_or_create_user() send_twitch_msg(BeginFund(user).dropeffect()) send_twitch_msg( f"Welcome @{user}! You need a Theme song (max 5 secs): !soundeffect YOUTUBE-URL @{user} 00:03 00:07" )
def route(self): if self.user in STREAM_GODS: if self.command == "no_news": return BreakingNews.purge() if self.command == "do_over": return self._do_over() if self.command == "revive": if self.parser.target_sfx: print( f"We are attempting to revive: !{self.parser.target_sfx}" ) Command.find_or_create(self.parser.target_sfx) return Command(self.parser.target_sfx).revive() elif self.parser.target_user: return User(self.parser.target_user).revive() else: print(f"Not Sure who or what to silence: {self.args}") if self.command == "silence": if self.parser.target_sfx: print(f"We are attempting to silence: {self.target_sfx}") return Command(self.parser.target_sfx).silence() elif self.parser.target_user: print( f"We are attempting to silence: {self.parser.target_user}" ) return User(self.parser.target_user).kill() else: print(f"Not Sure who or what to silence: {self.args}") if self.command == "dropeffect" and self.user in STREAM_GODS: return BeginFund( target_user=self.parser.target_user, target_command=self.parser.target_sfx, amount=self.parser.amount, ).drop() if self.command == "dropreward" and self.user in STREAM_GODS: return dropreward()