MCPcopy Create free account
hub / github.com/Noumena-Network/code / firePetReaction

Function firePetReaction

src/buddy/observer.ts:510–534  ·  view source on GitHub ↗
(
  onReaction: (reaction: string) => void,
)

Source from the content-addressed store, hash-verified

508}
509
510export 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
536function fallbackCompanionSoul(bones: CompanionBones): CompanionSoul {
537 const seed = bones.species.charCodeAt(0) + bones.eye.charCodeAt(0)

Callers 1

callFunction · 0.85

Calls 3

getCompanionFunction · 0.85
postBuddyReactionFunction · 0.85
pushRecentReactionFunction · 0.85

Tested by

no test coverage detected