(text, desp, time = 2100)
| 1184 | } |
| 1185 | |
| 1186 | function gobotNotify(text, desp, time = 2100) { |
| 1187 | return new Promise((resolve) => { |
| 1188 | if (GOBOT_URL) { |
| 1189 | const options = { |
| 1190 | url: `${GOBOT_URL}?access_token=${GOBOT_TOKEN}&${GOBOT_QQ}`, |
| 1191 | json: { |
| 1192 | message: `${text}\n${desp}` |
| 1193 | }, |
| 1194 | headers: { |
| 1195 | 'Content-Type': 'application/json', |
| 1196 | }, |
| 1197 | timeout, |
| 1198 | }; |
| 1199 | setTimeout(() => { |
| 1200 | $.post(options, (err, resp, data) => { |
| 1201 | try { |
| 1202 | if (err) { |
| 1203 | console.log('发送go-cqhttp通知调用API失败!!\n'); |
| 1204 | console.log(err); |
| 1205 | } else { |
| 1206 | data = JSON.parse(data); |
| 1207 | if (data.retcode === 0) { |
| 1208 | console.log('go-cqhttp发送通知消息成功🎉\n'); |
| 1209 | } else if (data.retcode === 100) { |
| 1210 | console.log(`go-cqhttp发送通知消息异常: ${data.errmsg}\n`); |
| 1211 | } else { |
| 1212 | console.log(`go-cqhttp发送通知消息异常\n${JSON.stringify(data)}`); |
| 1213 | } |
| 1214 | } |
| 1215 | } catch (e) { |
| 1216 | $.logErr(e, resp); |
| 1217 | } |
| 1218 | finally { |
| 1219 | resolve(data); |
| 1220 | } |
| 1221 | }); |
| 1222 | }, time); |
| 1223 | } else { |
| 1224 | resolve(); |
| 1225 | } |
| 1226 | }); |
| 1227 | } |
| 1228 | |
| 1229 | function serverNotify(text, desp, time = 2100) { |
| 1230 | return new Promise((resolve) => { |
no test coverage detected