diff --git a/apps/add.ts b/apps/add.ts index 0226bc8..d38909b 100644 --- a/apps/add.ts +++ b/apps/add.ts @@ -12,22 +12,9 @@ import { makeForwardMsg } from 'yunzai/core' const textArr = {} export class add extends Plugin { - - /** - * - */ path = './data/textJson/' - - /** - * - */ facePath = './data/face/' - - /** - * - */ isGlobal = false - /** * */ @@ -36,14 +23,8 @@ export class add extends Plugin { name: '添加表情', dsc: '添加表情,文字等', */ - super({ - event: 'message', - priority: 50000, - }); - - /** - * rule - */ + super(); + this.priority = 50000 this.rule = [ { reg: '^#(全局)?添加(.*)', @@ -70,6 +51,17 @@ export class add extends Plugin { } + /** + * + */ + async accept() { + /** 处理消息 */ + if (this.e.atBot && this.e.msg && this.e?.msg.includes('添加') && !this.e?.msg.includes('#')) { + this.e.msg = '#' + this.e.msg + } + } + + /** * */ @@ -82,16 +74,6 @@ export class add extends Plugin { } } - /** - * - */ - async accept() { - /** 处理消息 */ - if (this.e.atBot && this.e.msg && this.e?.msg.includes('添加') && !this.e?.msg.includes('#')) { - this.e.msg = '#' + this.e.msg - } - } - /** * */ diff --git a/apps/disFriPoke.ts b/apps/disFriPoke.ts index 859f312..7210ced 100644 --- a/apps/disFriPoke.ts +++ b/apps/disFriPoke.ts @@ -1,27 +1,24 @@ import { ConfigController as cfg } from 'yunzai/config' import { Plugin } from 'yunzai/core' -/** - * - */ export class disFriPoke extends Plugin { constructor() { /** name: '禁止私聊', dsc: '对私聊禁用做处理当开启私聊禁用时只接收cookie以及抽卡链接', */ - super({ - event: 'notice.friend.poke' - }) + super() + this.event = 'notice.friend.poke' this.priority = 0 } - + /** + * default + * @returns + */ async accept() { if (!cfg.other?.disablePrivate) return - if (this.e.isMaster) return - this.e.reply(cfg.other.disableMsg) return 'return' } -} +} \ No newline at end of file diff --git a/apps/disPri.ts b/apps/disPri.ts index c4de567..1ac1f88 100644 --- a/apps/disPri.ts +++ b/apps/disPri.ts @@ -13,12 +13,8 @@ export class disPri extends Plugin { name: '禁止私聊', dsc: '对私聊禁用做处理当开启私聊禁用时只接收cookie以及抽卡链接', */ - super({ - event: 'message.private' - }) - /** - * - */ + super() + this.event = 'message.private' this.priority = 0 } diff --git a/apps/example2.ts b/apps/example2.ts index 2866b1c..baa2348 100644 --- a/apps/example2.ts +++ b/apps/example2.ts @@ -8,16 +8,14 @@ export class example2 extends Plugin { name: '复读', dsc: '复读用户发送的内容,然后撤回', */ - super({ - event: 'message', - priority: 5000, - rule: [ - { - reg: '^#复读$', - fnc: 'repeat' - } - ] - }) + super() + this.priority = 5000 + this.rule = [ + { + reg: '^#复读$', + fnc: this.repeat.name + } + ] } /** * diff --git a/apps/friend.ts b/apps/friend.ts index 19f7da2..a0a8112 100644 --- a/apps/friend.ts +++ b/apps/friend.ts @@ -15,9 +15,8 @@ export class friend extends Plugin { name: 'autoFriend', dsc: '自动同意好友', */ - super({ - event: 'request.friend' - }) + super() + this.event = 'request.friend' } /** * diff --git a/apps/invite.ts b/apps/invite.ts index e2c7f77..6e1920e 100644 --- a/apps/invite.ts +++ b/apps/invite.ts @@ -14,9 +14,8 @@ export class invite extends Plugin { name: 'invite', dsc: '主人邀请自动进群', */ - super({ - event: 'request.group.invite' - }) + super() + this.event = 'request.group.invite' } /** * diff --git a/apps/newcomer.ts b/apps/newcomer.ts index 09f7285..dc21940 100644 --- a/apps/newcomer.ts +++ b/apps/newcomer.ts @@ -11,10 +11,9 @@ export class newcomer extends Plugin { name: '欢迎新人', dsc: '新人入群欢迎', */ - super({ - event: 'notice.group.increase', - priority: 5000, - }) + super() + this.event = 'notice.group.increase' + this.priority = 5000 } /** diff --git a/apps/outNotice.ts b/apps/outNotice.ts index b0c1420..8c6dae3 100644 --- a/apps/outNotice.ts +++ b/apps/outNotice.ts @@ -6,9 +6,8 @@ export class outNotice extends Plugin { name: '退群通知', dsc: 'xx退群了', */ - super({ - event: 'notice.group.decrease' - }) + super() + this.event = 'notice.group.decrease' } /** * diff --git a/apps/quit.ts b/apps/quit.ts index 4c5c470..fd1a168 100644 --- a/apps/quit.ts +++ b/apps/quit.ts @@ -12,9 +12,8 @@ export class quit extends Plugin { name: 'notice', dsc: '自动退群', */ - super({ - event: 'notice.group.increase' - }) + super() + this.event = 'notice.group.increase' } /** * diff --git a/apps/restart.ts b/apps/restart.ts index 74f4c94..3356ce0 100644 --- a/apps/restart.ts +++ b/apps/restart.ts @@ -34,21 +34,20 @@ export class Restart extends Plugin { name: '重启', dsc: '#重启', */ - super({ - event: 'message', - priority: 10, - rule: [{ + super() + this.priority = 10 + this.rule = [ + { reg: '^#重启$', - fnc: 'restart', + fnc: this.restart.name, permission: 'master' - }, { + }, + { reg: '^#(停机|关机)$', - fnc: 'stop', + fnc: this.stop.name, permission: 'master' - }] - }) - - + } + ] } async init() { diff --git a/apps/sendLog.ts b/apps/sendLog.ts index 59334be..95fa140 100644 --- a/apps/sendLog.ts +++ b/apps/sendLog.ts @@ -16,18 +16,15 @@ export class sendLog extends Plugin { /** name: "发送日志", dsc: "发送最近100条运行日志", - * */ - super({ - event: "message", - rule: [ - { - reg: "^#(运行|错误)*日志[0-9]*(.*)", - fnc: "sendLog", - permission: "master" - } - ] - }) + super() + this.rule = [ + { + reg: "^#(运行|错误)*日志[0-9]*(.*)", + fnc: this.sendLog.name, + permission: "master" + } + ] } /** diff --git a/apps/status.ts b/apps/status.ts index 7d37cf0..29dc30c 100644 --- a/apps/status.ts +++ b/apps/status.ts @@ -11,15 +11,13 @@ export class status extends Plugin { dsc: '#状态', */ constructor() { - super({ - event: 'message', - rule: [ - { - reg: '^#状态$', - fnc: 'status' - } - ] - }) + super() + this.rule = [ + { + reg: '^#状态$', + fnc: this.status.name + } + ] } /** @@ -69,7 +67,7 @@ export class status extends Plugin { await this.reply(msg) } - async getCount(groupId = '') { + async getCount(groupId:number | string = '') { this.date = moment().format('MMDD') this.month = Number(moment().month()) + 1 diff --git a/apps/update.ts b/apps/update.ts index 80cea7c..3e154da 100644 --- a/apps/update.ts +++ b/apps/update.ts @@ -12,32 +12,28 @@ let uping = false export class update extends Plugin { typeName = BOT_NAME messages = [] - constructor() { /** name: '更新', dsc: '#更新 #强制更新', */ - super({ - event: 'message', - priority: 4000, - rule: [ - { - reg: '^#更新日志', - fnc: 'updateLog' - }, - { - reg: '^#(强制)?更新', - fnc: 'update' - }, - { - reg: '^#(静默)?全部(强制)?更新$', - fnc: 'updateAll', - permission: 'master' - } - ] - }) - + super() + this.priority = 4000 + this.rule = [ + { + reg: '^#更新日志', + fnc: this.updateLog.name + }, + { + reg: '^#(强制)?更新', + fnc: this.update.name + }, + { + reg: '^#(静默)?全部(强制)?更新$', + fnc: this.updateAll.name, + permission: 'master' + } + ] } async update() {