MCPcopy Index your code
hub / github.com/smallfawn/QLScriptPublic / gobotNotify

Function gobotNotify

sendNofity.js:240–275  ·  view source on GitHub ↗
(text, desp)

Source from the content-addressed store, hash-verified

238}
239
240function 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
277function serverNotify(text, desp) {
278 return new Promise((resolve) => {

Callers 1

sendNotifyFunction · 0.70

Calls 3

postMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected