MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / fn

Function fn

eat/eat.ts:399–439  ·  view source on GitHub ↗
(
  msg: Api.Message,
  trigger?: Api.Message,
  isEat2: boolean = false
)

Source from the content-addressed store, hash-verified

397}
398
399const fn = async (
400 msg: Api.Message,
401 trigger?: Api.Message,
402 isEat2: boolean = false
403) => {
404 const [, ...args] = msg.message.split(" ");
405
406 if (!msg.isReply) {
407 if (args[0] == "set") {
408 let url = args[1] || baseConfigURL;
409 await handleSetCommand({ msg, url });
410 return;
411 }
412
413 await ensureConfigLoaded(msg);
414 await sendStickerList(msg);
415 return;
416 }
417
418 await ensureConfigLoaded(msg);
419
420 if (args.length == 0) {
421 const entry = getRandomEntry();
422 await sendSticker({ entry, msg, trigger, isEat2 });
423 } else {
424 const stickerName = args[0];
425 const entrys = Object.keys(config);
426 if (!entrys.includes(stickerName)) {
427 const stickerList = entrys
428 .sort((a, b) => a.localeCompare(b))
429 .map((key) => `${key} - ${config[key].name}`)
430 .join("\n");
431 await msg.edit({
432 text: `找不到 ${stickerName} 该表情包,目前可用表情包如下:\n${stickerList}`,
433 });
434 return;
435 }
436 let entry = config[stickerName];
437 await sendSticker({ entry, msg, trigger, isEat2 });
438 }
439};
440
441const help_text =
442 `表情包插件,智能缓存机制,首次使用自动下载配置\n` +

Callers 7

scheduleTimerFunction · 0.85
scheduleTimerFunction · 0.85
scheduleTimerFunction · 0.85
EatPluginClass · 0.85
scheduleTimerFunction · 0.85
scheduleTimerFunction · 0.85
withRetryFunction · 0.85

Calls 6

handleSetCommandFunction · 0.85
ensureConfigLoadedFunction · 0.85
sendStickerListFunction · 0.85
getRandomEntryFunction · 0.85
sendStickerFunction · 0.85
editMethod · 0.45

Tested by

no test coverage detected