update: 修改

This commit is contained in:
ningmengchongshui 2024-06-12 22:36:39 +08:00
parent 56f6d5a180
commit 2a66b09158
13 changed files with 84 additions and 126 deletions

View File

@ -12,22 +12,9 @@ import { makeForwardMsg } from 'yunzai/core'
const textArr = {} const textArr = {}
export class add extends Plugin { export class add extends Plugin {
/**
*
*/
path = './data/textJson/' path = './data/textJson/'
/**
*
*/
facePath = './data/face/' facePath = './data/face/'
/**
*
*/
isGlobal = false isGlobal = false
/** /**
* *
*/ */
@ -36,14 +23,8 @@ export class add extends Plugin {
name: '添加表情', name: '添加表情',
dsc: '添加表情,文字等', dsc: '添加表情,文字等',
*/ */
super({ super();
event: 'message', this.priority = 50000
priority: 50000,
});
/**
* rule
*/
this.rule = [ this.rule = [
{ {
reg: '^#(全局)?添加(.*)', 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
}
}
/** /**
* *
*/ */

View File

@ -1,26 +1,23 @@
import { ConfigController as cfg } from 'yunzai/config' import { ConfigController as cfg } from 'yunzai/config'
import { Plugin } from 'yunzai/core' import { Plugin } from 'yunzai/core'
/**
*
*/
export class disFriPoke extends Plugin { export class disFriPoke extends Plugin {
constructor() { constructor() {
/** /**
name: '禁止私聊', name: '禁止私聊',
dsc: '对私聊禁用做处理当开启私聊禁用时只接收cookie以及抽卡链接', dsc: '对私聊禁用做处理当开启私聊禁用时只接收cookie以及抽卡链接',
*/ */
super({ super()
event: 'notice.friend.poke' this.event = 'notice.friend.poke'
})
this.priority = 0 this.priority = 0
} }
/**
* default
* @returns
*/
async accept() { async accept() {
if (!cfg.other?.disablePrivate) return if (!cfg.other?.disablePrivate) return
if (this.e.isMaster) return if (this.e.isMaster) return
this.e.reply(cfg.other.disableMsg) this.e.reply(cfg.other.disableMsg)
return 'return' return 'return'
} }

View File

@ -13,12 +13,8 @@ export class disPri extends Plugin {
name: '禁止私聊', name: '禁止私聊',
dsc: '对私聊禁用做处理当开启私聊禁用时只接收cookie以及抽卡链接', dsc: '对私聊禁用做处理当开启私聊禁用时只接收cookie以及抽卡链接',
*/ */
super({ super()
event: 'message.private' this.event = 'message.private'
})
/**
*
*/
this.priority = 0 this.priority = 0
} }

View File

@ -8,16 +8,14 @@ export class example2 extends Plugin {
name: '复读', name: '复读',
dsc: '复读用户发送的内容,然后撤回', dsc: '复读用户发送的内容,然后撤回',
*/ */
super({ super()
event: 'message', this.priority = 5000
priority: 5000, this.rule = [
rule: [ {
{ reg: '^#复读$',
reg: '^#复读$', fnc: this.repeat.name
fnc: 'repeat' }
} ]
]
})
} }
/** /**
* *

View File

@ -15,9 +15,8 @@ export class friend extends Plugin {
name: 'autoFriend', name: 'autoFriend',
dsc: '自动同意好友', dsc: '自动同意好友',
*/ */
super({ super()
event: 'request.friend' this.event = 'request.friend'
})
} }
/** /**
* *

View File

@ -14,9 +14,8 @@ export class invite extends Plugin {
name: 'invite', name: 'invite',
dsc: '主人邀请自动进群', dsc: '主人邀请自动进群',
*/ */
super({ super()
event: 'request.group.invite' this.event = 'request.group.invite'
})
} }
/** /**
* *

View File

@ -11,10 +11,9 @@ export class newcomer extends Plugin {
name: '欢迎新人', name: '欢迎新人',
dsc: '新人入群欢迎', dsc: '新人入群欢迎',
*/ */
super({ super()
event: 'notice.group.increase', this.event = 'notice.group.increase'
priority: 5000, this.priority = 5000
})
} }
/** /**

View File

@ -6,9 +6,8 @@ export class outNotice extends Plugin {
name: '退群通知', name: '退群通知',
dsc: 'xx退群了', dsc: 'xx退群了',
*/ */
super({ super()
event: 'notice.group.decrease' this.event = 'notice.group.decrease'
})
} }
/** /**
* *

View File

@ -12,9 +12,8 @@ export class quit extends Plugin {
name: 'notice', name: 'notice',
dsc: '自动退群', dsc: '自动退群',
*/ */
super({ super()
event: 'notice.group.increase' this.event = 'notice.group.increase'
})
} }
/** /**
* *

View File

@ -34,21 +34,20 @@ export class Restart extends Plugin {
name: '重启', name: '重启',
dsc: '#重启', dsc: '#重启',
*/ */
super({ super()
event: 'message', this.priority = 10
priority: 10, this.rule = [
rule: [{ {
reg: '^#重启$', reg: '^#重启$',
fnc: 'restart', fnc: this.restart.name,
permission: 'master' permission: 'master'
}, { },
{
reg: '^#(停机|关机)$', reg: '^#(停机|关机)$',
fnc: 'stop', fnc: this.stop.name,
permission: 'master' permission: 'master'
}] }
}) ]
} }
async init() { async init() {

View File

@ -16,18 +16,15 @@ export class sendLog extends Plugin {
/** /**
name: "发送日志", name: "发送日志",
dsc: "发送最近100条运行日志", dsc: "发送最近100条运行日志",
*
*/ */
super({ super()
event: "message", this.rule = [
rule: [ {
{ reg: "^#(运行|错误)*日志[0-9]*(.*)",
reg: "^#(运行|错误)*日志[0-9]*(.*)", fnc: this.sendLog.name,
fnc: "sendLog", permission: "master"
permission: "master" }
} ]
]
})
} }
/** /**

View File

@ -11,15 +11,13 @@ export class status extends Plugin {
dsc: '#状态', dsc: '#状态',
*/ */
constructor() { constructor() {
super({ super()
event: 'message', this.rule = [
rule: [ {
{ reg: '^#状态$',
reg: '^#状态$', fnc: this.status.name
fnc: 'status' }
} ]
]
})
} }
/** /**
@ -69,7 +67,7 @@ export class status extends Plugin {
await this.reply(msg) await this.reply(msg)
} }
async getCount(groupId = '') { async getCount(groupId:number | string = '') {
this.date = moment().format('MMDD') this.date = moment().format('MMDD')
this.month = Number(moment().month()) + 1 this.month = Number(moment().month()) + 1

View File

@ -12,32 +12,28 @@ let uping = false
export class update extends Plugin { export class update extends Plugin {
typeName = BOT_NAME typeName = BOT_NAME
messages = [] messages = []
constructor() { constructor() {
/** /**
name: '更新', name: '更新',
dsc: '#更新 #强制更新', dsc: '#更新 #强制更新',
*/ */
super({ super()
event: 'message', this.priority = 4000
priority: 4000, this.rule = [
rule: [ {
{ reg: '^#更新日志',
reg: '^#更新日志', fnc: this.updateLog.name
fnc: 'updateLog' },
}, {
{ reg: '^#(强制)?更新',
reg: '^#(强制)?更新', fnc: this.update.name
fnc: 'update' },
}, {
{ reg: '^#(静默)?全部(强制)?更新$',
reg: '^#(静默)?全部(强制)?更新$', fnc: this.updateAll.name,
fnc: 'updateAll', permission: 'master'
permission: 'master' }
} ]
]
})
} }
async update() { async update() {