( onReaction: (reaction: string) => void, )
| 508 | } |
| 509 | |
| 510 | export async function firePetReaction( |
| 511 | onReaction: (reaction: string) => void, |
| 512 | ): Promise<void> { |
| 513 | const companion = getCompanion() |
| 514 | if (!companion) { |
| 515 | return |
| 516 | } |
| 517 | |
| 518 | lastReactionAt = Date.now() |
| 519 | const reaction = await postBuddyReaction( |
| 520 | companion, |
| 521 | '(you were just petted)', |
| 522 | 'pet', |
| 523 | recentReactions, |
| 524 | false, |
| 525 | AbortSignal.timeout(BUDDY_REQUEST_TIMEOUT_MS), |
| 526 | ) |
| 527 | |
| 528 | if (!reaction) { |
| 529 | return |
| 530 | } |
| 531 | |
| 532 | pushRecentReaction(reaction) |
| 533 | onReaction(reaction) |
| 534 | } |
| 535 | |
| 536 | function fallbackCompanionSoul(bones: CompanionBones): CompanionSoul { |
| 537 | const seed = bones.species.charCodeAt(0) + bones.eye.charCodeAt(0) |
no test coverage detected