(text, desp)
| 238 | } |
| 239 | |
| 240 | function gobotNotify(text, desp) { |
| 241 | return new Promise((resolve) => { |
| 242 | const { GOBOT_URL, GOBOT_TOKEN, GOBOT_QQ } = push_config; |
| 243 | if (GOBOT_URL) { |
| 244 | const options = { |
| 245 | url: `${GOBOT_URL}?access_token=${GOBOT_TOKEN}&${GOBOT_QQ}`, |
| 246 | json: { message: `${text}\n${desp}` }, |
| 247 | headers: { |
| 248 | 'Content-Type': 'application/json', |
| 249 | }, |
| 250 | timeout, |
| 251 | }; |
| 252 | $.post(options, (err, resp, data) => { |
| 253 | try { |
| 254 | if (err) { |
| 255 | console.log('Go-cqhttp 通知调用API失败😞\n', err); |
| 256 | } else { |
| 257 | if (data.retcode === 0) { |
| 258 | console.log('Go-cqhttp 发送通知消息成功🎉\n'); |
| 259 | } else if (data.retcode === 100) { |
| 260 | console.log(`Go-cqhttp 发送通知消息异常 ${data.errmsg}\n`); |
| 261 | } else { |
| 262 | console.log(`Go-cqhttp 发送通知消息异常 ${JSON.stringify(data)}`); |
| 263 | } |
| 264 | } |
| 265 | } catch (e) { |
| 266 | $.logErr(e, resp); |
| 267 | } finally { |
| 268 | resolve(data); |
| 269 | } |
| 270 | }); |
| 271 | } else { |
| 272 | resolve(); |
| 273 | } |
| 274 | }); |
| 275 | } |
| 276 | |
| 277 | function serverNotify(text, desp) { |
| 278 | return new Promise((resolve) => { |
no test coverage detected