| 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 | |
| 1004 | module.exports = {Env, CryptoJS}; |