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

Method checkAndReply

keyword/keyword.ts:512–536  ·  view source on GitHub ↗
(message: Api.Message)

Source from the content-addressed store, hash-verified

510 const aliasId = keywordAlias.get(chatId);
511 if (aliasId) {
512 const aliasTasks = this.getTasksForChat(aliasId);
513 for (const task of aliasTasks) {
514 if (task.checkNeedReply(message)) {
515 await task.processKeyword(message);
516 }
517 }
518 }
519
520 const tasks = this.getTasksForChat(chatId);
521 for (const task of tasks) {
522 if (task.checkNeedReply(message)) {
523 await task.processKeyword(message);
524 }
525 }
526 } catch (error) {
527 console.error("Check and reply error:", error);
528 }
529 }
530}
531
532function toNumber(value: any): number {
533 if (typeof value === "number") return value;
534 if (typeof value === "bigint") return Number(value);
535 if (typeof value === "string") return parseInt(value, 10) || 0;
536 return 0;
537}
538
539function getChatId(msg: Api.Message): number {

Callers 2

KeywordPluginClass · 0.80
processKeywordMessageFunction · 0.80

Calls 6

getTasksForChatMethod · 0.95
getChatIdFunction · 0.85
checkNeedReplyMethod · 0.80
processKeywordMethod · 0.80
errorMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected