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

Function call

src/commands/buddy/buddy.tsx:333–405  ·  view source on GitHub ↗
(onDone, context, args)

Source from the content-addressed store, hash-verified

331}
332
333export const call: LocalJSXCommandCall = async (onDone, context, args) => {
334 const config = getGlobalConfig()
335 const trimmedArgs = args?.trim()
336
337 if (trimmedArgs === 'pet') {
338 const companion = getCompanion()
339 if (!companion) {
340 onDone('no companion yet · run /buddy first', { display: 'system' })
341 return null
342 }
343 if (config.companionMuted === true) {
344 saveGlobalConfig(current => ({
345 ...current,
346 companionMuted: false,
347 }))
348 }
349 context.setAppState(current => ({
350 ...current,
351 companionPetAt: Date.now(),
352 }))
353 void firePetReaction(setReaction(context.setAppState))
354 onDone(`petted ${companion.name}`, { display: 'system' })
355 return null
356 }
357
358 if (trimmedArgs === 'off') {
359 if (config.companionMuted !== true) {
360 saveGlobalConfig(current => ({
361 ...current,
362 companionMuted: true,
363 }))
364 }
365 onDone('companion muted', { display: 'system' })
366 return null
367 }
368
369 if (trimmedArgs === 'on') {
370 if (config.companionMuted === true) {
371 saveGlobalConfig(current => ({
372 ...current,
373 companionMuted: false,
374 }))
375 }
376 onDone('companion unmuted', { display: 'system' })
377 return null
378 }
379
380 if (config.companionMuted === true) {
381 saveGlobalConfig(current => ({
382 ...current,
383 companionMuted: false,
384 }))
385 }
386
387 const existingCompanion = getCompanion()
388 if (existingCompanion) {
389 return (
390 <CompanionCard

Callers

nothing calls this directly

Calls 11

getCompanionFunction · 0.85
firePetReactionFunction · 0.85
setReactionFunction · 0.85
getLastCompanionReactionFunction · 0.85
rollFunction · 0.85
companionUserIdFunction · 0.85
hatchCompanionFunction · 0.85
fireHatchReactionFunction · 0.85
getGlobalConfigFunction · 0.50
onDoneFunction · 0.50
saveGlobalConfigFunction · 0.50

Tested by

no test coverage detected