update lib/events/offline.js.

Signed-off-by: touchscale <11134128+touchscale@user.noreply.gitee.com>
This commit is contained in:
touchscale 2023-05-06 10:18:50 +00:00 committed by Gitee
parent 4aa77a90dd
commit 527f59f5b6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 10 additions and 0 deletions

View File

@ -1,4 +1,6 @@
import EventListener from '../listener/listener.js'
import fetch from 'node-fetch'
import cfg from '../config/config.js'
/**
* 监听下线事件
@ -11,5 +13,13 @@ export default class onlineEvent extends EventListener {
/** 默认方法 */
async execute (e) {
logger.mark('掉线了')
let config = cfg.getConfig('notice')
let title = `Miao-Yunzai(${Bot.nickname})已离线,请关注`
if (config.iyuu) {
await fetch(`https://iyuu.cn/${config.iyuu}.send?text=${title}&desp=${e.message}`)
}
if (config.sct) {
await fetch(`https://sctapi.ftqq.com/${config.sct}.send?title=${title}&content=${e.message}`)
}
}
}