koishi-plugin-common
Advanced tools
Comparing version 3.0.0-alpha.9 to 3.0.0-alpha.10
@@ -72,2 +72,10 @@ "use strict"; | ||
} | ||
if (options.group) { | ||
const info = await ctx.sender.getGroupMemberInfo(ctxId, newMeta.userId).catch(() => ({})); | ||
Object.assign(newMeta.sender, info); | ||
} | ||
else if (options.user) { | ||
const info = await ctx.sender.getStrangerInfo(newMeta.userId).catch(() => ({})); | ||
Object.assign(newMeta.sender, info); | ||
} | ||
// generate path | ||
@@ -74,0 +82,0 @@ Object.defineProperty(newMeta, '$ctxId', { value: ctxId }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const koishi_utils_1 = require("koishi-utils"); | ||
function default_1(ctx) { | ||
ctx.command('echo <message...>', '向多个上下文发送广播', { authority: 2 }) | ||
.option('-a, --anonymous', '匿名发送消息') | ||
.option('-A, --force-anonymous', '匿名发送消息') | ||
.option('-u, --user <id>', '指定信息发送的目标 QQ 号', { isString: true, authority: 4 }) | ||
@@ -20,2 +23,8 @@ .option('-g, --group <id>', '指定信息发送的目标群号', { isString: true, authority: 4 }) | ||
} | ||
if (options.forceAnonymous) { | ||
message = koishi_utils_1.CQCode.stringify('anonymous') + message; | ||
} | ||
else if (options.anonymous) { | ||
message = koishi_utils_1.CQCode.stringify('anonymous', { ignore: true }) + message; | ||
} | ||
// send messages | ||
@@ -22,0 +31,0 @@ return Promise.all([ |
{ | ||
"name": "koishi-plugin-common", | ||
"description": "Common plugins for Koishi", | ||
"version": "3.0.0-alpha.9", | ||
"version": "3.0.0-alpha.10", | ||
"main": "dist/index.js", | ||
@@ -31,9 +31,9 @@ "typings": "dist/index.d.ts", | ||
"devDependencies": { | ||
"koishi-database-memory": "^2.0.0-alpha.9", | ||
"koishi-test-utils": "^4.0.0-alpha.9" | ||
"koishi-database-memory": "^2.0.0-alpha.10", | ||
"koishi-test-utils": "^4.0.0-alpha.10" | ||
}, | ||
"dependencies": { | ||
"koishi-core": "^2.0.0-alpha.9", | ||
"koishi-utils": "^1.0.6" | ||
"koishi-core": "^2.0.0-alpha.10", | ||
"koishi-utils": "^1.0.7" | ||
} | ||
} |
@@ -75,2 +75,10 @@ import { Context, getTargetId, ContextType } from 'koishi-core' | ||
if (options.group) { | ||
const info = await ctx.sender.getGroupMemberInfo(ctxId, newMeta.userId).catch(() => ({})) | ||
Object.assign(newMeta.sender, info) | ||
} else if (options.user) { | ||
const info = await ctx.sender.getStrangerInfo(newMeta.userId).catch(() => ({})) | ||
Object.assign(newMeta.sender, info) | ||
} | ||
// generate path | ||
@@ -77,0 +85,0 @@ Object.defineProperty(newMeta, '$ctxId', { value: ctxId }) |
import { MetaTypeMap, Context } from 'koishi-core' | ||
import { CQCode } from 'koishi-utils' | ||
export default function (ctx: Context) { | ||
ctx.command('echo <message...>', '向多个上下文发送广播', { authority: 2 }) | ||
.option('-a, --anonymous', '匿名发送消息') | ||
.option('-A, --force-anonymous', '匿名发送消息') | ||
.option('-u, --user <id>', '指定信息发送的目标 QQ 号', { isString: true, authority: 4 }) | ||
@@ -22,2 +25,8 @@ .option('-g, --group <id>', '指定信息发送的目标群号', { isString: true, authority: 4 }) | ||
if (options.forceAnonymous) { | ||
message = CQCode.stringify('anonymous') + message | ||
} else if (options.anonymous) { | ||
message = CQCode.stringify('anonymous', { ignore: true }) + message | ||
} | ||
// send messages | ||
@@ -24,0 +33,0 @@ return Promise.all([ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
350203
2428
Updatedkoishi-core@^2.0.0-alpha.10
Updatedkoishi-utils@^1.0.7