async def handlePointRedemption(self, twitchChannel: Channel, twitchUser: User, redemptionMessage: str, rewardId: str, userIdThatRedeemed: str, userNameThatRedeemed: str) -> bool: if twitchChannel is None: raise ValueError( f'twitchChannel argument is malformed: \"{twitchChannel}\"') elif twitchUser is None: raise ValueError( f'twitchUser argument is malformed: \"{twitchUser}\"') elif not utils.isValidStr(rewardId): raise ValueError(f'rewardId argument is malformed: \"{rewardId}\"') elif not utils.isValidStr(userIdThatRedeemed): raise ValueError( f'userIdThatRedeemed argument is malformed: \"{userIdThatRedeemed}\"' ) elif not utils.isValidStr(userNameThatRedeemed): raise ValueError( f'userNameThatRedeemed argument is malformed: \"{userNameThatRedeemed}\"' ) if not twitchUser.isPkmnEnabled( ) or not twitchUser.hasPkmnCatchBoosterPacks(): return False pkmnCatchBoosterPack: PkmnCatchBoosterPack = None for pkbp in twitchUser.getPkmnCatchBoosterPacks(): if rewardId == pkbp.getRewardId(): pkmnCatchBoosterPack = pkbp break if pkmnCatchBoosterPack is None: return False funtoonPkmnCatchType: FuntoonPkmnCatchType = None if pkmnCatchBoosterPack.hasCatchType(): funtoonPkmnCatchType = self.__toFuntoonPkmnCatchType( pkmnCatchBoosterPack) generalSettings = await self.__generalSettingsRepository.getAllAsync() actionCompleted = False if generalSettings.isFuntoonApiEnabled(): if await self.__funtoonRepository.pkmnCatch( userThatRedeemed=userNameThatRedeemed, twitchChannel=twitchUser.getHandle(), funtoonPkmnCatchType=funtoonPkmnCatchType): actionCompleted = True if not actionCompleted and generalSettings.isFuntoonTwitchChatFallbackEnabled( ): await twitchUtils.safeSend(twitchChannel, f'!catch {userNameThatRedeemed}') actionCompleted = True self.__timber.log( 'PkmnCatchRedemption', f'Redeemed pkmn catch for {userNameThatRedeemed}:{userIdThatRedeemed} (catch type: {pkmnCatchBoosterPack.getCatchType()}) in {twitchUser.getHandle()}' ) return actionCompleted