koishi-plugin-echo-cave 1.16.12 → 1.16.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +30 -18
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -157,6 +157,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
157
157
|
var import_koishi_plugin_adapter_onebot = require("@pynickle/koishi-plugin-adapter-onebot");
|
|
158
158
|
|
|
159
159
|
// src/cqcode-helper.ts
|
|
160
|
+
var import_koishi = require("koishi");
|
|
160
161
|
function createTextMsg(content) {
|
|
161
162
|
return {
|
|
162
163
|
type: "text",
|
|
@@ -168,7 +169,23 @@ function createTextMsg(content) {
|
|
|
168
169
|
function parseUserIds(userIds) {
|
|
169
170
|
const parsedUserIds = [];
|
|
170
171
|
for (const userId of userIds) {
|
|
171
|
-
|
|
172
|
+
try {
|
|
173
|
+
const element = import_koishi.h.parse(userId);
|
|
174
|
+
if (element.length === 1 && element[0].type === "at") {
|
|
175
|
+
const userId2 = element[0].attrs.id;
|
|
176
|
+
if (userId2 === "all") {
|
|
177
|
+
return {
|
|
178
|
+
parsedUserIds: [],
|
|
179
|
+
error: "invalid_all_mention"
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
parsedUserIds.push(userId2);
|
|
183
|
+
}
|
|
184
|
+
} catch (e) {
|
|
185
|
+
const num = Number(userId);
|
|
186
|
+
if (Number.isNaN(num)) {
|
|
187
|
+
parsedUserIds.push(userId);
|
|
188
|
+
}
|
|
172
189
|
}
|
|
173
190
|
}
|
|
174
191
|
return {
|
|
@@ -523,20 +540,20 @@ async function processMessageContent(ctx, msg, cfg) {
|
|
|
523
540
|
|
|
524
541
|
// src/index.ts
|
|
525
542
|
var import_koishi_plugin_adapter_onebot2 = require("@pynickle/koishi-plugin-adapter-onebot");
|
|
526
|
-
var
|
|
543
|
+
var import_koishi2 = require("koishi");
|
|
527
544
|
var name = "echo-cave";
|
|
528
545
|
var inject = ["database"];
|
|
529
|
-
var Config =
|
|
530
|
-
adminMessageProtection:
|
|
531
|
-
allowContributorDelete:
|
|
532
|
-
allowSenderDelete:
|
|
533
|
-
deleteMediaWhenDeletingMsg:
|
|
534
|
-
enableSizeLimit:
|
|
535
|
-
maxImageSize:
|
|
536
|
-
maxVideoSize:
|
|
537
|
-
maxFileSize:
|
|
538
|
-
maxRecordSize:
|
|
539
|
-
useBase64ForMedia:
|
|
546
|
+
var Config = import_koishi2.Schema.object({
|
|
547
|
+
adminMessageProtection: import_koishi2.Schema.boolean().default(false),
|
|
548
|
+
allowContributorDelete: import_koishi2.Schema.boolean().default(true),
|
|
549
|
+
allowSenderDelete: import_koishi2.Schema.boolean().default(true),
|
|
550
|
+
deleteMediaWhenDeletingMsg: import_koishi2.Schema.boolean().default(true),
|
|
551
|
+
enableSizeLimit: import_koishi2.Schema.boolean().default(false),
|
|
552
|
+
maxImageSize: import_koishi2.Schema.number().default(2048),
|
|
553
|
+
maxVideoSize: import_koishi2.Schema.number().default(512),
|
|
554
|
+
maxFileSize: import_koishi2.Schema.number().default(512),
|
|
555
|
+
maxRecordSize: import_koishi2.Schema.number().default(512),
|
|
556
|
+
useBase64ForMedia: import_koishi2.Schema.boolean().default(false)
|
|
540
557
|
}).i18n({
|
|
541
558
|
"zh-CN": require_zh_CN()._config
|
|
542
559
|
});
|
|
@@ -574,11 +591,6 @@ function apply(ctx, cfg) {
|
|
|
574
591
|
);
|
|
575
592
|
ctx.command("cave.bind <id:number> <...userIds>", { authority: 4 }).action(
|
|
576
593
|
async ({ session }, id, ...userIds) => {
|
|
577
|
-
ctx.logger.info(`Binding users ${JSON.stringify(userIds)} to cave ID ${id}`);
|
|
578
|
-
for (const uid of userIds) {
|
|
579
|
-
ctx.logger.info(`User ID to bind: ${uid}`);
|
|
580
|
-
ctx.logger.info(`userid type: ${typeof uid}`);
|
|
581
|
-
}
|
|
582
594
|
await bindUsersToCave(ctx, session, id, userIds);
|
|
583
595
|
}
|
|
584
596
|
);
|