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

Method sendViaBot

checkin/checkin.ts:568–587  ·  view source on GitHub ↗
(token: string, chatId: string, text: string)

Source from the content-addressed store, hash-verified

566 const btn = this.findCallbackButton(msg, target);
567 if (!btn) throw new Error(`未找到回调按钮: ${target.callbackData || target.buttonText || target.id}`);
568 await client.invoke(
569 new Api.messages.GetBotCallbackAnswer({
570 peer,
571 msgId: msg.id,
572 data: btn.data || Buffer.from(target.callbackData || "", "utf-8"),
573 })
574 );
575 }
576
577 private findCallbackButton(msg: Api.Message, target: SignTarget): any | null {
578 const rows = (msg as any).replyMarkup?.rows || [];
579 for (const row of rows) {
580 for (const b of row.buttons || []) {
581 const d = this.decodeData(b.data);
582 if (target.callbackData && d === target.callbackData) return b;
583 if (!target.callbackData && target.buttonText && b.text === target.buttonText) return b;
584 }
585 }
586 return null;
587 }
588
589 private parseButtonMatcher(args: string[]): Pick<SignTarget, "callbackData" | "buttonText"> {
590 const raw = args.join(" ").trim();

Callers 1

runAllSignsMethod · 0.95

Calls 2

writeMethod · 0.80
requestMethod · 0.45

Tested by

no test coverage detected