Skip to content

Commit d76ee38

Browse files
committed
fix: rule out dierct sessions, close #6
1 parent 1e2c0bb commit d76ee38

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "koishi-plugin-switch",
3-
"version": "1.8.0",
3+
"version": "1.9.0",
44
"description": "Switch Command Contexts in Koishi",
55
"type": "module",
66
"main": "lib/index.cjs",

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export function apply(ctx: Context, config: Config) {
4949
})
5050

5151
ctx.permissions.provide('switch:(value)', ({ value }, session: Partial<Session<any, 'enable' | 'disable'>>) => {
52+
if (session.isDirect) return true
5253
let command = ctx.$commander.get(value)
5354
// ignore normal command execution
5455
if (!command || command?.name === session.argv?.command?.name) return true
@@ -71,6 +72,7 @@ export function apply(ctx: Context, config: Config) {
7172
})
7273

7374
ctx.on('attach', (session: Session<never, 'enable' | 'disable'>) => {
75+
if (session.isDirect) return
7476
let command = session.argv?.command
7577
const { enable = [], disable = [] } = session.channel || {}
7678
while (command) {

0 commit comments

Comments
 (0)