MCPcopy Create free account
hub / github.com/6dylan6/jdpro / sendMessage

Method sendMessage

function/magic.js:983–1001  ·  view source on GitHub ↗
(chat_id, text, count = 1)

Source from the content-addressed store, hash-verified

981 }
982
983 async sendMessage(chat_id, text, count = 1) {
984 let url = `https://api.telegram.org/bot${process.env.TG_BOT_TOKEN}/sendMessage`
985 let body = {
986 'chat_id': chat_id,
987 'text': text,
988 'disable_web_page_preview': true
989 }
990 let headers = {
991 'Content-Type': 'application/json',
992 'Cookie': '10089'
993 }
994 let {data} = await this.request(url, headers, body);
995 this.log('发送数据', text)
996 if (!data?.ok && count === 1) {
997 $.log('重试中', text)
998 await $.wait(1000, 2000)
999 await this.sendMessage(chat_id, text, count++);
1000 }
1001 }
1002}
1003
1004module.exports = {Env, CryptoJS};

Callers

nothing calls this directly

Calls 3

requestMethod · 0.95
logMethod · 0.95
waitMethod · 0.45

Tested by

no test coverage detected