koishi-plugin-teach
Advanced tools
Comparing version 1.2.2 to 1.3.0
@@ -28,3 +28,3 @@ "use strict"; | ||
ctx.app.emit(session, 'dialogue/prepare', state); | ||
const userFields = new Set(['name']); | ||
const userFields = new Set(['name', 'flag']); | ||
ctx.app.emit(session, 'dialogue/before-attach-user', state, userFields); | ||
@@ -212,15 +212,29 @@ await session.$observeUser(userFields); | ||
}); | ||
ctx.on('notify/poke', (session) => { | ||
ctx.on('notify/poke', async (session) => { | ||
if (session.targetId !== session.selfId) | ||
return; | ||
const { flag } = await session.$observeGroup(['flag']); | ||
if (flag & koishi_core_1.Group.Flag.ignore) | ||
return; | ||
session.message = 'hook:poke'; | ||
triggerDialogue(ctx, session); | ||
}); | ||
ctx.on('notify/honor', async (session) => { | ||
const { assignee } = await session.$observeGroup(['assignee']); | ||
async function triggerNotice(name, session) { | ||
const { flag, assignee } = await session.$observeGroup(['flag', 'assignee']); | ||
if (assignee !== session.selfId) | ||
return; | ||
session.message = 'hook:' + session.honorType; | ||
if (flag & koishi_core_1.Group.Flag.ignore) | ||
return; | ||
session.message = 'hook:' + name + (session.userId === session.selfId ? ':self' : ':others'); | ||
triggerDialogue(ctx, session); | ||
} | ||
ctx.on('notify/honor', async (session) => { | ||
await triggerNotice(session.honorType, session); | ||
}); | ||
ctx.on('group-increase', triggerNotice.bind(null, 'join')); | ||
ctx.on('group-decrease', triggerNotice.bind(null, 'leave')); | ||
ctx.on('dialogue/attach-user', ({ session }) => { | ||
if (session.$user.flag & koishi_core_1.User.Flag.ignore) | ||
return true; | ||
}); | ||
ctx.on('dialogue/receive', ({ session, test }) => { | ||
@@ -227,0 +241,0 @@ if (session.message.includes('[CQ:image,')) |
@@ -29,3 +29,3 @@ "use strict"; | ||
}); | ||
ctx.on('dialogue/execute', (argv) => { | ||
ctx.prependListener('dialogue/execute', (argv) => { | ||
const { options, session } = argv; | ||
@@ -75,3 +75,3 @@ const { includeLast, excludeLast } = options; | ||
if (_type) { | ||
output.push(`最后一次${_type}于:${koishi_utils_1.Time.formatTime(Date.now() - _timestamp)}前`); | ||
output.push(`${_type}于:${koishi_utils_1.Time.formatTime(Date.now() - _timestamp)}前`); | ||
} | ||
@@ -93,2 +93,3 @@ }); | ||
}); | ||
output.unshift('近期执行的教学操作有:'); | ||
return session.$send(output.join('\n')); | ||
@@ -95,0 +96,0 @@ } |
{ | ||
"name": "koishi-plugin-teach", | ||
"description": "Teach plugin for Koishi", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"main": "dist/index.js", | ||
@@ -41,7 +41,7 @@ "typings": "dist/index.d.ts", | ||
"peerDependencies": { | ||
"koishi-core": "^2.4.2", | ||
"koishi-utils": "^3.1.5" | ||
"koishi-core": "^2.5.0", | ||
"koishi-utils": "^3.2.1" | ||
}, | ||
"devDependencies": { | ||
"koishi-plugin-mongo": "^1.1.2", | ||
"koishi-plugin-mongo": "^1.1.3", | ||
"koishi-plugin-mysql": "^2.1.0", | ||
@@ -51,3 +51,3 @@ "koishi-test-utils": "^5.0.3" | ||
"dependencies": { | ||
"axios": "^0.21.0", | ||
"axios": "^0.21.1", | ||
"fastest-levenshtein": "^1.0.12", | ||
@@ -54,0 +54,0 @@ "regexpp": "^3.1.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
218330
50
2844
Updatedaxios@^0.21.1