node-karin 1.0.0 → 1.0.2
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/CHANGELOG.md +28 -0
- package/dist/index.d.ts +99 -144
- package/dist/index.js +264 -337
- package/package.json +6 -1
package/dist/index.js
CHANGED
|
@@ -2897,7 +2897,7 @@ var init_level = __esm({
|
|
|
2897
2897
|
import { Level as Level2 } from "level";
|
|
2898
2898
|
import lodash4 from "lodash";
|
|
2899
2899
|
import moment from "moment";
|
|
2900
|
-
import EventEmitter2 from "node:events";
|
|
2900
|
+
import { EventEmitter as EventEmitter2 } from "node:events";
|
|
2901
2901
|
var RedisClient;
|
|
2902
2902
|
var init_mock = __esm({
|
|
2903
2903
|
"src/core/db/redis/mock.ts"() {
|
|
@@ -4636,10 +4636,10 @@ var init_restart = __esm({
|
|
|
4636
4636
|
"use strict";
|
|
4637
4637
|
init_esm_shims();
|
|
4638
4638
|
init_exec();
|
|
4639
|
-
restart = async (selfId,
|
|
4639
|
+
restart = async (selfId, contact3, messageId, isFront = true) => {
|
|
4640
4640
|
const options = {
|
|
4641
4641
|
selfId,
|
|
4642
|
-
contact:
|
|
4642
|
+
contact: contact3,
|
|
4643
4643
|
messageId,
|
|
4644
4644
|
time: Date.now()
|
|
4645
4645
|
};
|
|
@@ -4902,7 +4902,7 @@ var init_base = __esm({
|
|
|
4902
4902
|
* @param elements 消息元素
|
|
4903
4903
|
* @param retryCount 重试次数 默认为0
|
|
4904
4904
|
*/
|
|
4905
|
-
sendMsg(
|
|
4905
|
+
sendMsg(contact3, elements, retryCount) {
|
|
4906
4906
|
throw new Error(`[adapter][${this.adapter.protocol}] \u6B64\u63A5\u53E3\u672A\u5B9E\u73B0`);
|
|
4907
4907
|
}
|
|
4908
4908
|
/**
|
|
@@ -4910,7 +4910,7 @@ var init_base = __esm({
|
|
|
4910
4910
|
* @param contact 目标信息
|
|
4911
4911
|
* @param resId 资源ID
|
|
4912
4912
|
*/
|
|
4913
|
-
sendLongMsg(
|
|
4913
|
+
sendLongMsg(contact3, resId) {
|
|
4914
4914
|
throw new Error(`[adapter][${this.adapter.protocol}] \u6B64\u63A5\u53E3\u672A\u5B9E\u73B0`);
|
|
4915
4915
|
}
|
|
4916
4916
|
/**
|
|
@@ -4919,7 +4919,7 @@ var init_base = __esm({
|
|
|
4919
4919
|
* @param elements 消息元素
|
|
4920
4920
|
* @param options 首层小卡片外显参数
|
|
4921
4921
|
*/
|
|
4922
|
-
sendForwardMsg(
|
|
4922
|
+
sendForwardMsg(contact3, elements, options) {
|
|
4923
4923
|
throw new Error(`[adapter][${this.adapter.protocol}] \u6B64\u63A5\u53E3\u672A\u5B9E\u73B0`);
|
|
4924
4924
|
}
|
|
4925
4925
|
/**
|
|
@@ -4928,7 +4928,7 @@ var init_base = __esm({
|
|
|
4928
4928
|
* @param messageId 消息ID
|
|
4929
4929
|
* @returns 此接口的返回值不值得信任
|
|
4930
4930
|
*/
|
|
4931
|
-
recallMsg(
|
|
4931
|
+
recallMsg(contact3, messageId) {
|
|
4932
4932
|
throw new Error(`[adapter][${this.adapter.protocol}] \u6B64\u63A5\u53E3\u672A\u5B9E\u73B0`);
|
|
4933
4933
|
}
|
|
4934
4934
|
/**
|
|
@@ -4956,7 +4956,7 @@ var init_base = __esm({
|
|
|
4956
4956
|
* @param messageId 消息ID
|
|
4957
4957
|
* @returns MessageResponse对象
|
|
4958
4958
|
*/
|
|
4959
|
-
getMsg(
|
|
4959
|
+
getMsg(contact3, messageId) {
|
|
4960
4960
|
throw new Error(`[adapter][${this.adapter.protocol}] \u6B64\u63A5\u53E3\u672A\u5B9E\u73B0`);
|
|
4961
4961
|
}
|
|
4962
4962
|
/**
|
|
@@ -4966,7 +4966,7 @@ var init_base = __esm({
|
|
|
4966
4966
|
* @param count 获取消息数量 默认为1
|
|
4967
4967
|
* @returns 包含历史消息的数组
|
|
4968
4968
|
*/
|
|
4969
|
-
getHistoryMsg(
|
|
4969
|
+
getHistoryMsg(contact3, startMsgId, count3) {
|
|
4970
4970
|
throw new Error(`[adapter][${this.adapter.protocol}] \u6B64\u63A5\u53E3\u672A\u5B9E\u73B0`);
|
|
4971
4971
|
}
|
|
4972
4972
|
/**
|
|
@@ -4993,7 +4993,7 @@ var init_base = __esm({
|
|
|
4993
4993
|
* @param elements 转发消息元素
|
|
4994
4994
|
* @description 此接口并不是所有协议端都支持的,因此在使用时请注意
|
|
4995
4995
|
*/
|
|
4996
|
-
createResId(
|
|
4996
|
+
createResId(contact3, elements) {
|
|
4997
4997
|
throw new Error(`[adapter][${this.adapter.protocol}] \u6B64\u63A5\u53E3\u672A\u5B9E\u73B0`);
|
|
4998
4998
|
}
|
|
4999
4999
|
/**
|
|
@@ -5190,7 +5190,7 @@ var init_base = __esm({
|
|
|
5190
5190
|
* @param faceId 表情ID
|
|
5191
5191
|
* @returns 此接口的返回值不值得信任
|
|
5192
5192
|
*/
|
|
5193
|
-
setMsgReaction(
|
|
5193
|
+
setMsgReaction(contact3, messageId, faceId, isSet) {
|
|
5194
5194
|
throw new Error(`[adapter][${this.adapter.protocol}] \u6B64\u63A5\u53E3\u672A\u5B9E\u73B0`);
|
|
5195
5195
|
}
|
|
5196
5196
|
/**
|
|
@@ -5201,7 +5201,7 @@ var init_base = __esm({
|
|
|
5201
5201
|
* @param folder 父目录ID 不提供则上传到根目录 仅在群聊时有效
|
|
5202
5202
|
* @returns 此接口的返回值不值得信任
|
|
5203
5203
|
*/
|
|
5204
|
-
uploadFile(
|
|
5204
|
+
uploadFile(contact3, file, name, folder) {
|
|
5205
5205
|
throw new Error(`[adapter][${this.adapter.protocol}] \u6B64\u63A5\u53E3\u672A\u5B9E\u73B0`);
|
|
5206
5206
|
}
|
|
5207
5207
|
/**
|
|
@@ -5316,7 +5316,7 @@ var init_base = __esm({
|
|
|
5316
5316
|
* @param count 戳一戳次数 默认为1
|
|
5317
5317
|
* @returns 此接口的返回值不值得信任
|
|
5318
5318
|
*/
|
|
5319
|
-
pokeUser(
|
|
5319
|
+
pokeUser(contact3, count3) {
|
|
5320
5320
|
throw new Error(`[adapter][${this.adapter.protocol}] \u6B64\u63A5\u53E3\u672A\u5B9E\u73B0`);
|
|
5321
5321
|
}
|
|
5322
5322
|
/**
|
|
@@ -5460,8 +5460,8 @@ var init_bot = __esm({
|
|
|
5460
5460
|
list3.push({ index: id, bot });
|
|
5461
5461
|
const tips = (str) => logger.green(`[\u6CE8\u518CBot][${str}]`);
|
|
5462
5462
|
const sendForwardMsg = bot.sendForwardMsg;
|
|
5463
|
-
bot.sendForwardMsg = async (
|
|
5464
|
-
return sendForwardMsg.call(bot,
|
|
5463
|
+
bot.sendForwardMsg = async (contact3, elements, options) => {
|
|
5464
|
+
return sendForwardMsg.call(bot, contact3, elements, options);
|
|
5465
5465
|
};
|
|
5466
5466
|
setTimeout(async () => {
|
|
5467
5467
|
const { level: level2 } = await init_db2().then(() => db_exports);
|
|
@@ -5469,7 +5469,7 @@ var init_bot = __esm({
|
|
|
5469
5469
|
const options = await level2.has(key);
|
|
5470
5470
|
if (!options) return;
|
|
5471
5471
|
try {
|
|
5472
|
-
const { selfId, contact:
|
|
5472
|
+
const { selfId, contact: contact3, messageId, time: time2 } = options;
|
|
5473
5473
|
const restartTime = ((Date.now() - time2) / 1e3).toFixed(2);
|
|
5474
5474
|
if (Number(restartTime) > 120) {
|
|
5475
5475
|
return false;
|
|
@@ -5479,7 +5479,7 @@ var init_bot = __esm({
|
|
|
5479
5479
|
segment_exports.text(`
|
|
5480
5480
|
\u91CD\u542F\u6210\u529F\uFF1A${restartTime}\u79D2`)
|
|
5481
5481
|
];
|
|
5482
|
-
await sendMsg(selfId,
|
|
5482
|
+
await sendMsg(selfId, contact3, element);
|
|
5483
5483
|
} finally {
|
|
5484
5484
|
await level2.del(key);
|
|
5485
5485
|
}
|
|
@@ -5500,7 +5500,7 @@ var init_bot = __esm({
|
|
|
5500
5500
|
});
|
|
5501
5501
|
return id;
|
|
5502
5502
|
};
|
|
5503
|
-
sendMsg = async (selfId,
|
|
5503
|
+
sendMsg = async (selfId, contact3, elements, options = { recallMsg: 0, retryCount: 1, retry_count: 1 }) => {
|
|
5504
5504
|
let result = {};
|
|
5505
5505
|
const NewElements = makeMessage(elements);
|
|
5506
5506
|
const bot = getBot(selfId);
|
|
@@ -5508,14 +5508,14 @@ var init_bot = __esm({
|
|
|
5508
5508
|
const { recallMsg } = options;
|
|
5509
5509
|
const retryCount = options.retryCount ?? options.retry_count ?? 1;
|
|
5510
5510
|
const { raw: raw2 } = createRawMessage(NewElements);
|
|
5511
|
-
if (
|
|
5512
|
-
logger.bot("info", selfId, `${logger.green("Send Proactive Group")} ${
|
|
5511
|
+
if (contact3.scene === "group") {
|
|
5512
|
+
logger.bot("info", selfId, `${logger.green("Send Proactive Group")} ${contact3.peer}: ${raw2}`);
|
|
5513
5513
|
} else {
|
|
5514
|
-
logger.bot("info", selfId, `${logger.green("Send Proactive private")} ${
|
|
5514
|
+
logger.bot("info", selfId, `${logger.green("Send Proactive private")} ${contact3.peer}: ${raw2}`);
|
|
5515
5515
|
}
|
|
5516
5516
|
try {
|
|
5517
|
-
listeners.emit(SEND_MSG,
|
|
5518
|
-
result = await bot.sendMsg(
|
|
5517
|
+
listeners.emit(SEND_MSG, contact3);
|
|
5518
|
+
result = await bot.sendMsg(contact3, NewElements, retryCount);
|
|
5519
5519
|
logger.bot("debug", selfId, `\u4E3B\u52A8\u6D88\u606F\u7ED3\u679C:${JSON.stringify(result, null, 2)}`);
|
|
5520
5520
|
} catch (error) {
|
|
5521
5521
|
logger.bot("error", selfId, `\u4E3B\u52A8\u6D88\u606F\u53D1\u9001\u5931\u8D25:${raw2}`);
|
|
@@ -5523,7 +5523,7 @@ var init_bot = __esm({
|
|
|
5523
5523
|
}
|
|
5524
5524
|
result.message_id = result.messageId;
|
|
5525
5525
|
if (recallMsg && recallMsg > 0 && (result == null ? void 0 : result.messageId)) {
|
|
5526
|
-
setTimeout(() => bot.recallMsg(
|
|
5526
|
+
setTimeout(() => bot.recallMsg(contact3, result.messageId), recallMsg * 1e3);
|
|
5527
5527
|
}
|
|
5528
5528
|
return result;
|
|
5529
5529
|
};
|
|
@@ -5722,7 +5722,7 @@ var init_lock = __esm({
|
|
|
5722
5722
|
});
|
|
5723
5723
|
|
|
5724
5724
|
// src/event/handler/other/handler.ts
|
|
5725
|
-
var log, initMsg, initRole, initAlias, initEmit, disableViaAdapter, disableViaPluginWhitelist, disableViaPluginBlacklist, privateFilterEvent, groupFilterEvent, groupPrint
|
|
5725
|
+
var log, initMsg, initRole, initAlias, initEmit, disableViaAdapter, disableViaPluginWhitelist, disableViaPluginBlacklist, privateFilterEvent, groupFilterEvent, groupPrint;
|
|
5726
5726
|
var init_handler2 = __esm({
|
|
5727
5727
|
"src/event/handler/other/handler.ts"() {
|
|
5728
5728
|
"use strict";
|
|
@@ -5979,26 +5979,6 @@ var init_handler2 = __esm({
|
|
|
5979
5979
|
}
|
|
5980
5980
|
return true;
|
|
5981
5981
|
};
|
|
5982
|
-
guildPrint = (ctx3, config2) => {
|
|
5983
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
5984
|
-
if (((_b = (_a = config2 == null ? void 0 : config2.guilds) == null ? void 0 : _a.log_enable_list) == null ? void 0 : _b.length) && !((_c = config2 == null ? void 0 : config2.guilds) == null ? void 0 : _c.log_enable_list.includes(ctx3.guildId))) {
|
|
5985
|
-
log(ctx3.guildId, `\u9891\u9053\u65E5\u5FD7\u672A\u5904\u4E8E\u767D\u540D\u5355: ${ctx3.eventId}`);
|
|
5986
|
-
return false;
|
|
5987
|
-
}
|
|
5988
|
-
if (((_e = (_d = config2 == null ? void 0 : config2.guilds) == null ? void 0 : _d.log_disable_list) == null ? void 0 : _e.length) && ((_f = config2 == null ? void 0 : config2.guilds) == null ? void 0 : _f.log_disable_list.includes(ctx3.guildId))) {
|
|
5989
|
-
log(ctx3.guildId, `\u9891\u9053\u65E5\u5FD7\u5904\u4E8E\u9ED1\u540D\u5355: ${ctx3.eventId}`);
|
|
5990
|
-
return false;
|
|
5991
|
-
}
|
|
5992
|
-
if (((_h = (_g = config2 == null ? void 0 : config2.channels) == null ? void 0 : _g.log_enable_list) == null ? void 0 : _h.length) && !((_i = config2 == null ? void 0 : config2.channels) == null ? void 0 : _i.log_enable_list.includes(ctx3.channelId))) {
|
|
5993
|
-
log(ctx3.channelId, `\u5B50\u9891\u9053\u65E5\u5FD7\u672A\u5904\u4E8E\u767D\u540D\u5355: ${ctx3.eventId}`);
|
|
5994
|
-
return false;
|
|
5995
|
-
}
|
|
5996
|
-
if (((_k = (_j = config2 == null ? void 0 : config2.channels) == null ? void 0 : _j.log_disable_list) == null ? void 0 : _k.length) && ((_l = config2 == null ? void 0 : config2.channels) == null ? void 0 : _l.log_disable_list.includes(ctx3.channelId))) {
|
|
5997
|
-
log(ctx3.channelId, `\u5B50\u9891\u9053\u65E5\u5FD7\u5904\u4E8E\u9ED1\u540D\u5355: ${ctx3.eventId}`);
|
|
5998
|
-
return false;
|
|
5999
|
-
}
|
|
6000
|
-
return true;
|
|
6001
|
-
};
|
|
6002
5982
|
}
|
|
6003
5983
|
});
|
|
6004
5984
|
|
|
@@ -6091,7 +6071,7 @@ var init_permission = __esm({
|
|
|
6091
6071
|
|
|
6092
6072
|
// src/event/handler/message/groups.ts
|
|
6093
6073
|
import lodash6 from "lodash";
|
|
6094
|
-
var groupHandler, groupTempHandler,
|
|
6074
|
+
var groupHandler, groupTempHandler, initPrint, groupsDeal, groupsCmd;
|
|
6095
6075
|
var init_groups2 = __esm({
|
|
6096
6076
|
async "src/event/handler/message/groups.ts"() {
|
|
6097
6077
|
"use strict";
|
|
@@ -6151,33 +6131,6 @@ var init_groups2 = __esm({
|
|
|
6151
6131
|
});
|
|
6152
6132
|
}
|
|
6153
6133
|
};
|
|
6154
|
-
guildHandler = async (ctx3) => {
|
|
6155
|
-
const config2 = config();
|
|
6156
|
-
const group = getGuildCfg(ctx3.guildId, ctx3.channelId, ctx3.selfId);
|
|
6157
|
-
const isPrint = guildPrint(ctx3, config2);
|
|
6158
|
-
initMsg(ctx3);
|
|
6159
|
-
initRole(ctx3, config2);
|
|
6160
|
-
initAlias(ctx3, group.alias);
|
|
6161
|
-
initEmit(ctx3);
|
|
6162
|
-
initPrint(ctx3, "guild", "\u9891\u9053\u6D88\u606F");
|
|
6163
|
-
const context2 = context(ctx3);
|
|
6164
|
-
if (context2) return ctx3;
|
|
6165
|
-
const cd = groupsCD(group, `${ctx3.guildId}:${ctx3.channelId}`, ctx3.userId);
|
|
6166
|
-
const filter = groupFilterEvent(ctx3, config2, group, cd);
|
|
6167
|
-
if (filter) {
|
|
6168
|
-
groupsDeal(ctx3, group, isPrint, (plugin) => {
|
|
6169
|
-
if (plugin.event !== "message" && plugin.event !== "message.guild") return false;
|
|
6170
|
-
if (![
|
|
6171
|
-
"all",
|
|
6172
|
-
"master",
|
|
6173
|
-
"admin",
|
|
6174
|
-
"guild.owner",
|
|
6175
|
-
"guild.admin"
|
|
6176
|
-
].includes(plugin.permission)) return false;
|
|
6177
|
-
return true;
|
|
6178
|
-
});
|
|
6179
|
-
}
|
|
6180
|
-
};
|
|
6181
6134
|
initPrint = (ctx3, type, prefix, level2 = "info") => {
|
|
6182
6135
|
ctx3.logText = `[${type}:${ctx3.userId}(${ctx3.sender.nick || ""})]`;
|
|
6183
6136
|
logger.bot(level2, ctx3.selfId, `${prefix}: [${ctx3.userId}(${ctx3.sender.nick || ""})] ${ctx3.rawMessage}`);
|
|
@@ -6240,7 +6193,7 @@ var init_groups2 = __esm({
|
|
|
6240
6193
|
|
|
6241
6194
|
// src/event/handler/message/private.ts
|
|
6242
6195
|
import lodash7 from "lodash";
|
|
6243
|
-
var friendHandler,
|
|
6196
|
+
var friendHandler, initPrint2, privateDeal, privateCmd;
|
|
6244
6197
|
var init_private = __esm({
|
|
6245
6198
|
async "src/event/handler/message/private.ts"() {
|
|
6246
6199
|
"use strict";
|
|
@@ -6271,26 +6224,6 @@ var init_private = __esm({
|
|
|
6271
6224
|
});
|
|
6272
6225
|
}
|
|
6273
6226
|
};
|
|
6274
|
-
directHandler = async (ctx3) => {
|
|
6275
|
-
const config2 = config();
|
|
6276
|
-
const friend = getFriendCfg(ctx3.userId, ctx3.selfId);
|
|
6277
|
-
initMsg(ctx3);
|
|
6278
|
-
initRole(ctx3, config2);
|
|
6279
|
-
initAlias(ctx3, friend.alias);
|
|
6280
|
-
initEmit(ctx3);
|
|
6281
|
-
initPrint2(ctx3, "direct", "\u9891\u9053\u79C1\u4FE1");
|
|
6282
|
-
const context2 = context(ctx3);
|
|
6283
|
-
if (context2) return ctx3;
|
|
6284
|
-
const cd = privateCD(friend, ctx3.userId);
|
|
6285
|
-
const filter = privateFilterEvent(ctx3, config2, friend, cd);
|
|
6286
|
-
if (filter) {
|
|
6287
|
-
privateDeal(ctx3, friend, (plugin) => {
|
|
6288
|
-
if (plugin.event !== "message" && plugin.event !== "message.direct") return false;
|
|
6289
|
-
if (!["all", "master", "admin"].includes(plugin.permission)) return false;
|
|
6290
|
-
return true;
|
|
6291
|
-
});
|
|
6292
|
-
}
|
|
6293
|
-
};
|
|
6294
6227
|
initPrint2 = (ctx3, type, prefix, level2 = "info") => {
|
|
6295
6228
|
ctx3.logText = `[${type}:${ctx3.userId}(${ctx3.sender.nick || ""})]`;
|
|
6296
6229
|
logger.bot(level2, ctx3.selfId, `${prefix}: [${ctx3.userId}(${ctx3.sender.nick || ""})] ${ctx3.rawMessage}`);
|
|
@@ -6557,7 +6490,6 @@ var init_notice = __esm({
|
|
|
6557
6490
|
});
|
|
6558
6491
|
|
|
6559
6492
|
// src/event/handler/request/groups.ts
|
|
6560
|
-
var groupRequestHandler;
|
|
6561
6493
|
var init_groups4 = __esm({
|
|
6562
6494
|
async "src/event/handler/request/groups.ts"() {
|
|
6563
6495
|
"use strict";
|
|
@@ -6566,22 +6498,10 @@ var init_groups4 = __esm({
|
|
|
6566
6498
|
await init_config2();
|
|
6567
6499
|
init_other();
|
|
6568
6500
|
init_handler2();
|
|
6569
|
-
groupRequestHandler = async (ctx3) => {
|
|
6570
|
-
const config2 = config();
|
|
6571
|
-
const group = getGroupCfg(ctx3.groupId, ctx3.selfId);
|
|
6572
|
-
initRole(ctx3, config2);
|
|
6573
|
-
initEmit(ctx3);
|
|
6574
|
-
initTips(ctx3);
|
|
6575
|
-
initPrint3(ctx3, "group", "\u7FA4\u8BF7\u6C42");
|
|
6576
|
-
const cd = noticeRequestCD(ctx3, group, ctx3.groupId);
|
|
6577
|
-
const filter = groupFilterEvent(ctx3, config2, group, cd);
|
|
6578
|
-
if (filter) deal(ctx3, group);
|
|
6579
|
-
};
|
|
6580
6501
|
}
|
|
6581
6502
|
});
|
|
6582
6503
|
|
|
6583
6504
|
// src/event/handler/request/private.ts
|
|
6584
|
-
var friendRequestHandler;
|
|
6585
6505
|
var init_private3 = __esm({
|
|
6586
6506
|
async "src/event/handler/request/private.ts"() {
|
|
6587
6507
|
"use strict";
|
|
@@ -6590,17 +6510,6 @@ var init_private3 = __esm({
|
|
|
6590
6510
|
init_other();
|
|
6591
6511
|
await init_config2();
|
|
6592
6512
|
init_handler2();
|
|
6593
|
-
friendRequestHandler = async (ctx3) => {
|
|
6594
|
-
const config2 = config();
|
|
6595
|
-
const friend = getFriendCfg(ctx3.userId, ctx3.selfId);
|
|
6596
|
-
initRole(ctx3, config2);
|
|
6597
|
-
initEmit(ctx3);
|
|
6598
|
-
initTips(ctx3);
|
|
6599
|
-
initPrint3(ctx3, "friend", "\u597D\u53CB\u8BF7\u6C42");
|
|
6600
|
-
const cd = noticeRequestCD(ctx3, friend, ctx3.userId);
|
|
6601
|
-
const filter = privateFilterEvent(ctx3, config2, friend, cd);
|
|
6602
|
-
if (filter) deal(ctx3, friend);
|
|
6603
|
-
};
|
|
6604
6513
|
}
|
|
6605
6514
|
});
|
|
6606
6515
|
|
|
@@ -6653,8 +6562,8 @@ var init_base2 = __esm({
|
|
|
6653
6562
|
eventId,
|
|
6654
6563
|
rawEvent,
|
|
6655
6564
|
time: time2,
|
|
6656
|
-
contact:
|
|
6657
|
-
sender,
|
|
6565
|
+
contact: contact3,
|
|
6566
|
+
sender: sender2,
|
|
6658
6567
|
srcReply,
|
|
6659
6568
|
bot
|
|
6660
6569
|
}) {
|
|
@@ -6664,8 +6573,8 @@ var init_base2 = __esm({
|
|
|
6664
6573
|
this.#eventId = eventId;
|
|
6665
6574
|
this.#rawEvent = rawEvent;
|
|
6666
6575
|
this.#time = time2;
|
|
6667
|
-
this.#contact =
|
|
6668
|
-
this.#sender =
|
|
6576
|
+
this.#contact = contact3;
|
|
6577
|
+
this.#sender = sender2;
|
|
6669
6578
|
this.#srcReply = srcReply;
|
|
6670
6579
|
this.#bot = bot;
|
|
6671
6580
|
this.store = /* @__PURE__ */ new Map();
|
|
@@ -6825,8 +6734,8 @@ var init_message4 = __esm({
|
|
|
6825
6734
|
eventId,
|
|
6826
6735
|
rawEvent,
|
|
6827
6736
|
time: time2,
|
|
6828
|
-
contact:
|
|
6829
|
-
sender,
|
|
6737
|
+
contact: contact3,
|
|
6738
|
+
sender: sender2,
|
|
6830
6739
|
srcReply,
|
|
6831
6740
|
bot,
|
|
6832
6741
|
messageId,
|
|
@@ -6838,8 +6747,8 @@ var init_message4 = __esm({
|
|
|
6838
6747
|
eventId,
|
|
6839
6748
|
rawEvent,
|
|
6840
6749
|
time: time2,
|
|
6841
|
-
contact:
|
|
6842
|
-
sender,
|
|
6750
|
+
contact: contact3,
|
|
6751
|
+
sender: sender2,
|
|
6843
6752
|
srcReply,
|
|
6844
6753
|
bot,
|
|
6845
6754
|
event: "message"
|
|
@@ -7183,8 +7092,8 @@ var init_notice2 = __esm({
|
|
|
7183
7092
|
eventId,
|
|
7184
7093
|
rawEvent,
|
|
7185
7094
|
time: time2,
|
|
7186
|
-
contact:
|
|
7187
|
-
sender,
|
|
7095
|
+
contact: contact3,
|
|
7096
|
+
sender: sender2,
|
|
7188
7097
|
srcReply,
|
|
7189
7098
|
bot
|
|
7190
7099
|
}) {
|
|
@@ -7193,8 +7102,8 @@ var init_notice2 = __esm({
|
|
|
7193
7102
|
eventId,
|
|
7194
7103
|
rawEvent,
|
|
7195
7104
|
time: time2,
|
|
7196
|
-
contact:
|
|
7197
|
-
sender,
|
|
7105
|
+
contact: contact3,
|
|
7106
|
+
sender: sender2,
|
|
7198
7107
|
srcReply,
|
|
7199
7108
|
bot,
|
|
7200
7109
|
event: "notice"
|
|
@@ -8083,8 +7992,8 @@ var init_request2 = __esm({
|
|
|
8083
7992
|
eventId,
|
|
8084
7993
|
rawEvent,
|
|
8085
7994
|
time: time2,
|
|
8086
|
-
contact:
|
|
8087
|
-
sender,
|
|
7995
|
+
contact: contact3,
|
|
7996
|
+
sender: sender2,
|
|
8088
7997
|
srcReply,
|
|
8089
7998
|
bot
|
|
8090
7999
|
}) {
|
|
@@ -8093,8 +8002,8 @@ var init_request2 = __esm({
|
|
|
8093
8002
|
eventId,
|
|
8094
8003
|
rawEvent,
|
|
8095
8004
|
time: time2,
|
|
8096
|
-
contact:
|
|
8097
|
-
sender,
|
|
8005
|
+
contact: contact3,
|
|
8006
|
+
sender: sender2,
|
|
8098
8007
|
srcReply,
|
|
8099
8008
|
bot,
|
|
8100
8009
|
event: "request"
|
|
@@ -8252,7 +8161,7 @@ var init_request2 = __esm({
|
|
|
8252
8161
|
});
|
|
8253
8162
|
|
|
8254
8163
|
// src/event/create/index.ts
|
|
8255
|
-
var createFriendMessage, createGroupMessage,
|
|
8164
|
+
var createFriendMessage, createGroupMessage, createGroupTempMessage, createFriendIncreaseNotice, createPrivatePokeNotice, createPrivateRecallNotice, createGroupPokeNotice, createGroupRecallNotice, createGroupFileUploadedNotice, createGroupCardChangedNotice, createGroupHlightsChangedNotice, createGroupMemberAddNotice, createGroupMemberDelNotice, createGroupAdminChangedNotice, createGroupMemberBanNotice, createGroupMessageReactionNotice, createGroupLuckKingNotice, createGroupHonorChangedNotice;
|
|
8256
8165
|
var init_create = __esm({
|
|
8257
8166
|
async "src/event/create/index.ts"() {
|
|
8258
8167
|
"use strict";
|
|
@@ -8273,36 +8182,16 @@ var init_create = __esm({
|
|
|
8273
8182
|
groupHandler(event);
|
|
8274
8183
|
return event;
|
|
8275
8184
|
};
|
|
8276
|
-
createGuildMessage = (options) => {
|
|
8277
|
-
const event = new GuildMessage(options);
|
|
8278
|
-
guildHandler(event);
|
|
8279
|
-
return event;
|
|
8280
|
-
};
|
|
8281
|
-
createDirectMessage = (options) => {
|
|
8282
|
-
const event = new DirectMessage(options);
|
|
8283
|
-
directHandler(event);
|
|
8284
|
-
return event;
|
|
8285
|
-
};
|
|
8286
8185
|
createGroupTempMessage = (options) => {
|
|
8287
8186
|
const event = new GroupTempMessage(options);
|
|
8288
8187
|
groupTempHandler(event);
|
|
8289
8188
|
return event;
|
|
8290
8189
|
};
|
|
8291
|
-
createReceiveLikeNotice = (options) => {
|
|
8292
|
-
const event = new ReceiveLikeNotice(options);
|
|
8293
|
-
friendNoticeHandler(event);
|
|
8294
|
-
return event;
|
|
8295
|
-
};
|
|
8296
8190
|
createFriendIncreaseNotice = (options) => {
|
|
8297
8191
|
const event = new FriendIncreaseNotice(options);
|
|
8298
8192
|
friendNoticeHandler(event);
|
|
8299
8193
|
return event;
|
|
8300
8194
|
};
|
|
8301
|
-
createFriendDecreaseNotice = (options) => {
|
|
8302
|
-
const event = new FriendDecreaseNotice(options);
|
|
8303
|
-
friendNoticeHandler(event);
|
|
8304
|
-
return event;
|
|
8305
|
-
};
|
|
8306
8195
|
createPrivatePokeNotice = (options) => {
|
|
8307
8196
|
const event = new PrivatePokeNotice(options);
|
|
8308
8197
|
friendNoticeHandler(event);
|
|
@@ -8313,11 +8202,6 @@ var init_create = __esm({
|
|
|
8313
8202
|
friendNoticeHandler(event);
|
|
8314
8203
|
return event;
|
|
8315
8204
|
};
|
|
8316
|
-
createPrivateFileUploadedNotice = (options) => {
|
|
8317
|
-
const event = new PrivateFileUploadedNotice(options);
|
|
8318
|
-
friendNoticeHandler(event);
|
|
8319
|
-
return event;
|
|
8320
|
-
};
|
|
8321
8205
|
createGroupPokeNotice = (options) => {
|
|
8322
8206
|
const event = new GroupPokeNotice(options);
|
|
8323
8207
|
groupNoticeHandler(event);
|
|
@@ -8338,11 +8222,6 @@ var init_create = __esm({
|
|
|
8338
8222
|
groupNoticeHandler(event);
|
|
8339
8223
|
return event;
|
|
8340
8224
|
};
|
|
8341
|
-
createGroupMemberTitleUpdatedNotice = (options) => {
|
|
8342
|
-
const event = new GroupMemberTitleUpdatedNotice(options);
|
|
8343
|
-
groupNoticeHandler(event);
|
|
8344
|
-
return event;
|
|
8345
|
-
};
|
|
8346
8225
|
createGroupHlightsChangedNotice = (options) => {
|
|
8347
8226
|
const event = new GroupHlightsChangedNotice(options);
|
|
8348
8227
|
groupNoticeHandler(event);
|
|
@@ -8363,21 +8242,11 @@ var init_create = __esm({
|
|
|
8363
8242
|
groupNoticeHandler(event);
|
|
8364
8243
|
return event;
|
|
8365
8244
|
};
|
|
8366
|
-
createGroupSignInNotice = (options) => {
|
|
8367
|
-
const event = new GroupSignInNotice(options);
|
|
8368
|
-
groupNoticeHandler(event);
|
|
8369
|
-
return event;
|
|
8370
|
-
};
|
|
8371
8245
|
createGroupMemberBanNotice = (options) => {
|
|
8372
8246
|
const event = new GroupMemberBanNotice(options);
|
|
8373
8247
|
groupNoticeHandler(event);
|
|
8374
8248
|
return event;
|
|
8375
8249
|
};
|
|
8376
|
-
createGroupWholeBanNotice = (options) => {
|
|
8377
|
-
const event = new GroupWholeBanNotice(options);
|
|
8378
|
-
groupNoticeHandler(event);
|
|
8379
|
-
return event;
|
|
8380
|
-
};
|
|
8381
8250
|
createGroupMessageReactionNotice = (options) => {
|
|
8382
8251
|
const event = new GroupMessageReactionNotice(options);
|
|
8383
8252
|
groupNoticeHandler(event);
|
|
@@ -8393,26 +8262,11 @@ var init_create = __esm({
|
|
|
8393
8262
|
groupNoticeHandler(event);
|
|
8394
8263
|
return event;
|
|
8395
8264
|
};
|
|
8396
|
-
createGroupApplyRequest = (options) => {
|
|
8397
|
-
const event = new GroupApplyRequest(options);
|
|
8398
|
-
groupRequestHandler(event);
|
|
8399
|
-
return event;
|
|
8400
|
-
};
|
|
8401
|
-
createGroupInviteRequest = (options) => {
|
|
8402
|
-
const event = new GroupInviteRequest(options);
|
|
8403
|
-
groupRequestHandler(event);
|
|
8404
|
-
return event;
|
|
8405
|
-
};
|
|
8406
|
-
createPrivateApplyRequest = (options) => {
|
|
8407
|
-
const event = new PrivateApplyRequest(options);
|
|
8408
|
-
friendRequestHandler(event);
|
|
8409
|
-
return event;
|
|
8410
|
-
};
|
|
8411
8265
|
}
|
|
8412
8266
|
});
|
|
8413
8267
|
|
|
8414
8268
|
// src/event/sender.ts
|
|
8415
|
-
var senderFriend, senderGroup;
|
|
8269
|
+
var senderFriend, senderGroup, senderGuild, senderDirect, senderGroupTemp, sender;
|
|
8416
8270
|
var init_sender = __esm({
|
|
8417
8271
|
"src/event/sender.ts"() {
|
|
8418
8272
|
"use strict";
|
|
@@ -8465,11 +8319,36 @@ var init_sender = __esm({
|
|
|
8465
8319
|
}
|
|
8466
8320
|
throw TypeError("\u63D0\u4F9B\u7684\u53C2\u6570\u7C7B\u578B\u9519\u8BEF");
|
|
8467
8321
|
};
|
|
8322
|
+
senderGuild = (userId, role, name = "", sex, age) => {
|
|
8323
|
+
if (!name) name = "";
|
|
8324
|
+
return {
|
|
8325
|
+
userId,
|
|
8326
|
+
nick: name,
|
|
8327
|
+
name,
|
|
8328
|
+
role,
|
|
8329
|
+
sex,
|
|
8330
|
+
age
|
|
8331
|
+
};
|
|
8332
|
+
};
|
|
8333
|
+
senderDirect = senderFriend;
|
|
8334
|
+
senderGroupTemp = senderFriend;
|
|
8335
|
+
sender = {
|
|
8336
|
+
/** 好友场景 */
|
|
8337
|
+
friend: senderFriend,
|
|
8338
|
+
/** 群聊场景 */
|
|
8339
|
+
group: senderGroup,
|
|
8340
|
+
/** 频道场景 */
|
|
8341
|
+
guild: senderGuild,
|
|
8342
|
+
/** 频道私信场景 */
|
|
8343
|
+
direct: senderDirect,
|
|
8344
|
+
/** 群聊临时会话场景 */
|
|
8345
|
+
groupTemp: senderGroupTemp
|
|
8346
|
+
};
|
|
8468
8347
|
}
|
|
8469
8348
|
});
|
|
8470
8349
|
|
|
8471
8350
|
// src/event/contact.ts
|
|
8472
|
-
var contactFriend, contactGroup, contactGroupTemp;
|
|
8351
|
+
var contactFriend, contactGroup, contactDirect, contactGuild, contactGroupTemp, contact2;
|
|
8473
8352
|
var init_contact = __esm({
|
|
8474
8353
|
"src/event/contact.ts"() {
|
|
8475
8354
|
"use strict";
|
|
@@ -8488,6 +8367,24 @@ var init_contact = __esm({
|
|
|
8488
8367
|
name
|
|
8489
8368
|
};
|
|
8490
8369
|
};
|
|
8370
|
+
contactDirect = (peer, subId, name = "", subName = "") => {
|
|
8371
|
+
return {
|
|
8372
|
+
scene: "direct",
|
|
8373
|
+
peer,
|
|
8374
|
+
subPeer: subId,
|
|
8375
|
+
name,
|
|
8376
|
+
subName
|
|
8377
|
+
};
|
|
8378
|
+
};
|
|
8379
|
+
contactGuild = (peer, subPeer, name = "", subName = "") => {
|
|
8380
|
+
return {
|
|
8381
|
+
scene: "guild",
|
|
8382
|
+
peer,
|
|
8383
|
+
subPeer,
|
|
8384
|
+
name,
|
|
8385
|
+
subName
|
|
8386
|
+
};
|
|
8387
|
+
};
|
|
8491
8388
|
contactGroupTemp = (peer, subPeer, name = "") => {
|
|
8492
8389
|
return {
|
|
8493
8390
|
scene: "groupTemp",
|
|
@@ -8496,6 +8393,18 @@ var init_contact = __esm({
|
|
|
8496
8393
|
name
|
|
8497
8394
|
};
|
|
8498
8395
|
};
|
|
8396
|
+
contact2 = {
|
|
8397
|
+
/** 好友场景 */
|
|
8398
|
+
friend: contactFriend,
|
|
8399
|
+
/** 群聊场景 */
|
|
8400
|
+
group: contactGroup,
|
|
8401
|
+
/** 频道场景 */
|
|
8402
|
+
guild: contactGuild,
|
|
8403
|
+
/** 频道私信场景 */
|
|
8404
|
+
direct: contactDirect,
|
|
8405
|
+
/** 群聊临时会话场景 */
|
|
8406
|
+
groupTemp: contactGroupTemp
|
|
8407
|
+
};
|
|
8499
8408
|
}
|
|
8500
8409
|
});
|
|
8501
8410
|
|
|
@@ -8557,10 +8466,10 @@ var init_input = __esm({
|
|
|
8557
8466
|
const seq2 = Math.floor(Math.random() * 1e9);
|
|
8558
8467
|
const time2 = Date.now();
|
|
8559
8468
|
if (text2.startsWith("group")) {
|
|
8560
|
-
const
|
|
8469
|
+
const contact4 = contactGroup("10010");
|
|
8561
8470
|
createGroupMessage({
|
|
8562
8471
|
bot: this,
|
|
8563
|
-
contact:
|
|
8472
|
+
contact: contact4,
|
|
8564
8473
|
elements: [segment_exports.text(text2.replace(/^group/, "").trim())],
|
|
8565
8474
|
eventId: `${botID}${time2}`,
|
|
8566
8475
|
messageId: `${botID}${time2}`,
|
|
@@ -8568,14 +8477,14 @@ var init_input = __esm({
|
|
|
8568
8477
|
rawEvent: { data },
|
|
8569
8478
|
sender: senderGroup(botID, "member"),
|
|
8570
8479
|
time: time2,
|
|
8571
|
-
srcReply: (elements) => this.sendMsg(
|
|
8480
|
+
srcReply: (elements) => this.sendMsg(contact4, elements)
|
|
8572
8481
|
});
|
|
8573
8482
|
return;
|
|
8574
8483
|
}
|
|
8575
|
-
const
|
|
8484
|
+
const contact3 = contactFriend(botID);
|
|
8576
8485
|
createFriendMessage({
|
|
8577
8486
|
bot: this,
|
|
8578
|
-
contact:
|
|
8487
|
+
contact: contact3,
|
|
8579
8488
|
elements: [segment_exports.text(text2.replace(/^group/, "").trim())],
|
|
8580
8489
|
eventId: `${botID}.${time2}`,
|
|
8581
8490
|
messageId: `${botID}.${time2}`,
|
|
@@ -8583,10 +8492,10 @@ var init_input = __esm({
|
|
|
8583
8492
|
rawEvent: { data },
|
|
8584
8493
|
sender: senderFriend(botID, ""),
|
|
8585
8494
|
time: time2,
|
|
8586
|
-
srcReply: (elements) => this.sendMsg(
|
|
8495
|
+
srcReply: (elements) => this.sendMsg(contact3, elements)
|
|
8587
8496
|
});
|
|
8588
8497
|
}
|
|
8589
|
-
async sendMsg(
|
|
8498
|
+
async sendMsg(contact3, elements, retryCount) {
|
|
8590
8499
|
const time2 = Date.now();
|
|
8591
8500
|
const messageId = (++index2).toString();
|
|
8592
8501
|
const result = {
|
|
@@ -8613,7 +8522,7 @@ var init_input = __esm({
|
|
|
8613
8522
|
}
|
|
8614
8523
|
msg.push(JSON.stringify(v));
|
|
8615
8524
|
}
|
|
8616
|
-
if (
|
|
8525
|
+
if (contact3.scene === "group") {
|
|
8617
8526
|
msg.unshift(logger.green("Send group message: "));
|
|
8618
8527
|
logger.info(msg.join(""));
|
|
8619
8528
|
} else {
|
|
@@ -9544,8 +9453,8 @@ var sendMaster = async (selfId, targetId, elements, options = { recallMsg: 0, re
|
|
|
9544
9453
|
throw new Error("\u53D1\u9001\u6D88\u606F\u5931\u8D25: \u76EE\u6807\u4E0D\u662F\u4E3B\u4EBA");
|
|
9545
9454
|
}
|
|
9546
9455
|
}
|
|
9547
|
-
const
|
|
9548
|
-
return sendMsg(selfId,
|
|
9456
|
+
const contact3 = { peer: targetId, scene: "friend" };
|
|
9457
|
+
return sendMsg(selfId, contact3, elements, options);
|
|
9549
9458
|
};
|
|
9550
9459
|
var sendAdmin = async (selfId, targetId, elements, options = { recallMsg: 0, retryCount: 1, mustAdmin: false }) => {
|
|
9551
9460
|
const mustAdmin = (options == null ? void 0 : options.mustAdmin) ?? false;
|
|
@@ -9559,8 +9468,8 @@ var sendAdmin = async (selfId, targetId, elements, options = { recallMsg: 0, ret
|
|
|
9559
9468
|
throw new Error("\u53D1\u9001\u6D88\u606F\u5931\u8D25: \u76EE\u6807\u4E0D\u662F\u7BA1\u7406\u5458");
|
|
9560
9469
|
}
|
|
9561
9470
|
}
|
|
9562
|
-
const
|
|
9563
|
-
return sendMsg(selfId,
|
|
9471
|
+
const contact3 = { peer: targetId, scene: "friend" };
|
|
9472
|
+
return sendMsg(selfId, contact3, elements, options);
|
|
9564
9473
|
};
|
|
9565
9474
|
|
|
9566
9475
|
// src/core/karin/export.ts
|
|
@@ -9570,7 +9479,7 @@ init_bot();
|
|
|
9570
9479
|
init_esm_shims();
|
|
9571
9480
|
init_internal();
|
|
9572
9481
|
init_bot();
|
|
9573
|
-
import { EventEmitter as EventEmitter3 } from "events";
|
|
9482
|
+
import { EventEmitter as EventEmitter3 } from "node:events";
|
|
9574
9483
|
var Other = class extends EventEmitter3 {
|
|
9575
9484
|
/** 框架名称 */
|
|
9576
9485
|
name = "karin";
|
|
@@ -10645,8 +10554,8 @@ var createMessage = (event, bot) => {
|
|
|
10645
10554
|
if (event.message_type === "private") {
|
|
10646
10555
|
if (event.sub_type === "friend") {
|
|
10647
10556
|
const userId = event.sender.user_id + "";
|
|
10648
|
-
const
|
|
10649
|
-
const
|
|
10557
|
+
const contact3 = contactFriend(userId);
|
|
10558
|
+
const sender2 = senderFriend(
|
|
10650
10559
|
userId,
|
|
10651
10560
|
event.sender.nickname,
|
|
10652
10561
|
event.sender.sex,
|
|
@@ -10655,33 +10564,33 @@ var createMessage = (event, bot) => {
|
|
|
10655
10564
|
createFriendMessage({
|
|
10656
10565
|
bot,
|
|
10657
10566
|
time: time2,
|
|
10658
|
-
contact:
|
|
10659
|
-
sender,
|
|
10567
|
+
contact: contact3,
|
|
10568
|
+
sender: sender2,
|
|
10660
10569
|
rawEvent: event,
|
|
10661
10570
|
messageId: event.message_id + "",
|
|
10662
10571
|
messageSeq: event.message_id,
|
|
10663
10572
|
eventId: `message:${event.message_id}`,
|
|
10664
10573
|
elements: AdapterConvertKarin(event.message),
|
|
10665
|
-
srcReply: (elements) => bot.sendMsg(
|
|
10574
|
+
srcReply: (elements) => bot.sendMsg(contact3, elements)
|
|
10666
10575
|
});
|
|
10667
10576
|
return;
|
|
10668
10577
|
}
|
|
10669
10578
|
if (event.sub_type === "group") {
|
|
10670
10579
|
const groupId = event.group_id + "" || event.temp_source + "";
|
|
10671
10580
|
const userId = event.sender.user_id + "";
|
|
10672
|
-
const
|
|
10673
|
-
const
|
|
10581
|
+
const contact3 = contactGroupTemp(groupId, userId);
|
|
10582
|
+
const sender2 = senderFriend(userId, event.sender.nickname);
|
|
10674
10583
|
createGroupTempMessage({
|
|
10675
10584
|
bot,
|
|
10676
|
-
contact:
|
|
10585
|
+
contact: contact3,
|
|
10677
10586
|
elements: AdapterConvertKarin(event.message),
|
|
10678
10587
|
eventId: `message:${event.message_id}`,
|
|
10679
10588
|
messageId: event.message_id + "",
|
|
10680
10589
|
messageSeq: event.message_id,
|
|
10681
10590
|
rawEvent: event,
|
|
10682
|
-
sender,
|
|
10591
|
+
sender: sender2,
|
|
10683
10592
|
time: time2,
|
|
10684
|
-
srcReply: (elements) => bot.sendMsg(
|
|
10593
|
+
srcReply: (elements) => bot.sendMsg(contact3, elements)
|
|
10685
10594
|
});
|
|
10686
10595
|
}
|
|
10687
10596
|
return;
|
|
@@ -10690,19 +10599,19 @@ var createMessage = (event, bot) => {
|
|
|
10690
10599
|
const groupId = event.group_id + "";
|
|
10691
10600
|
const userId = event.sender.user_id + "";
|
|
10692
10601
|
const { nickname, role, sex, age, card, area, level: level2, title } = event.sender;
|
|
10693
|
-
const
|
|
10694
|
-
const
|
|
10602
|
+
const contact3 = contactGroup(groupId);
|
|
10603
|
+
const sender2 = senderGroup(userId, role, nickname, sex, age, card, area, level2, title);
|
|
10695
10604
|
createGroupMessage({
|
|
10696
10605
|
bot,
|
|
10697
|
-
contact:
|
|
10606
|
+
contact: contact3,
|
|
10698
10607
|
elements: AdapterConvertKarin(event.message),
|
|
10699
10608
|
eventId: `message:${event.message_id}`,
|
|
10700
10609
|
messageId: event.message_id + "",
|
|
10701
10610
|
messageSeq: event.message_id,
|
|
10702
10611
|
rawEvent: event,
|
|
10703
|
-
sender,
|
|
10612
|
+
sender: sender2,
|
|
10704
10613
|
time: time2,
|
|
10705
|
-
srcReply: (elements) => bot.sendMsg(
|
|
10614
|
+
srcReply: (elements) => bot.sendMsg(contact3, elements)
|
|
10706
10615
|
});
|
|
10707
10616
|
return;
|
|
10708
10617
|
}
|
|
@@ -10718,15 +10627,15 @@ var createNotice = (event, bot) => {
|
|
|
10718
10627
|
if (event.notice_type === "friend_recall" /* FriendRecall */) {
|
|
10719
10628
|
const userId = event.user_id + "";
|
|
10720
10629
|
const messageId = event.message_id + "";
|
|
10721
|
-
const
|
|
10630
|
+
const contact3 = contactFriend(userId);
|
|
10722
10631
|
createPrivateRecallNotice({
|
|
10723
10632
|
bot,
|
|
10724
10633
|
eventId: `notice:${userId}.${event.time}`,
|
|
10725
10634
|
rawEvent: event,
|
|
10726
10635
|
time: time2,
|
|
10727
|
-
contact:
|
|
10636
|
+
contact: contact3,
|
|
10728
10637
|
sender: senderFriend(userId),
|
|
10729
|
-
srcReply: (elements) => bot.sendMsg(
|
|
10638
|
+
srcReply: (elements) => bot.sendMsg(contact3, elements),
|
|
10730
10639
|
content: {
|
|
10731
10640
|
messageId,
|
|
10732
10641
|
operatorId: userId,
|
|
@@ -10737,15 +10646,15 @@ var createNotice = (event, bot) => {
|
|
|
10737
10646
|
}
|
|
10738
10647
|
if (event.notice_type === "friend_add" /* FriendAdd */) {
|
|
10739
10648
|
const userId = event.user_id + "";
|
|
10740
|
-
const
|
|
10649
|
+
const contact3 = contactFriend(userId);
|
|
10741
10650
|
createFriendIncreaseNotice({
|
|
10742
10651
|
bot,
|
|
10743
10652
|
eventId: `notice:${userId}.${event.time}`,
|
|
10744
10653
|
rawEvent: event,
|
|
10745
10654
|
time: time2,
|
|
10746
|
-
contact:
|
|
10655
|
+
contact: contact3,
|
|
10747
10656
|
sender: senderFriend(userId),
|
|
10748
|
-
srcReply: (elements) => bot.sendMsg(
|
|
10657
|
+
srcReply: (elements) => bot.sendMsg(contact3, elements),
|
|
10749
10658
|
content: {
|
|
10750
10659
|
targetId: userId
|
|
10751
10660
|
}
|
|
@@ -10755,15 +10664,15 @@ var createNotice = (event, bot) => {
|
|
|
10755
10664
|
if (event.notice_type === "notify" /* Notify */ && event.sub_type === "poke" && event.group_id) {
|
|
10756
10665
|
const userId = event.user_id + "";
|
|
10757
10666
|
const groupId = event.group_id + "";
|
|
10758
|
-
const
|
|
10667
|
+
const contact3 = contactGroup(groupId);
|
|
10759
10668
|
createGroupPokeNotice({
|
|
10760
10669
|
bot,
|
|
10761
10670
|
eventId: `notice:${groupId}.${event.time}`,
|
|
10762
10671
|
rawEvent: event,
|
|
10763
10672
|
time: time2,
|
|
10764
|
-
contact:
|
|
10673
|
+
contact: contact3,
|
|
10765
10674
|
sender: senderGroup(userId),
|
|
10766
|
-
srcReply: (elements) => bot.sendMsg(
|
|
10675
|
+
srcReply: (elements) => bot.sendMsg(contact3, elements),
|
|
10767
10676
|
content: {
|
|
10768
10677
|
operatorId: userId,
|
|
10769
10678
|
targetId: event.target_id + "",
|
|
@@ -10776,15 +10685,15 @@ var createNotice = (event, bot) => {
|
|
|
10776
10685
|
}
|
|
10777
10686
|
if (event.notice_type === "notify" /* Notify */ && event.sub_type === "poke") {
|
|
10778
10687
|
const userId = event.user_id + "";
|
|
10779
|
-
const
|
|
10688
|
+
const contact3 = contactFriend(userId);
|
|
10780
10689
|
createPrivatePokeNotice({
|
|
10781
10690
|
bot,
|
|
10782
10691
|
eventId: `notice:${userId}.${event.time}`,
|
|
10783
10692
|
rawEvent: event,
|
|
10784
10693
|
time: time2,
|
|
10785
|
-
contact:
|
|
10694
|
+
contact: contact3,
|
|
10786
10695
|
sender: senderFriend(userId),
|
|
10787
|
-
srcReply: (elements) => bot.sendMsg(
|
|
10696
|
+
srcReply: (elements) => bot.sendMsg(contact3, elements),
|
|
10788
10697
|
content: {
|
|
10789
10698
|
operatorId: userId,
|
|
10790
10699
|
targetId: event.target_id + "",
|
|
@@ -10798,15 +10707,15 @@ var createNotice = (event, bot) => {
|
|
|
10798
10707
|
if (event.notice_type === "notify" /* Notify */ && event.sub_type === "lucky_king") {
|
|
10799
10708
|
const userId = event.user_id + "";
|
|
10800
10709
|
const groupId = event.group_id + "";
|
|
10801
|
-
const
|
|
10710
|
+
const contact3 = contactGroup(groupId);
|
|
10802
10711
|
createGroupLuckKingNotice({
|
|
10803
10712
|
bot,
|
|
10804
10713
|
eventId: `notice:${groupId}.${event.time}`,
|
|
10805
10714
|
rawEvent: event,
|
|
10806
10715
|
time: time2,
|
|
10807
|
-
contact:
|
|
10716
|
+
contact: contact3,
|
|
10808
10717
|
sender: senderGroup(userId),
|
|
10809
|
-
srcReply: (elements) => bot.sendMsg(
|
|
10718
|
+
srcReply: (elements) => bot.sendMsg(contact3, elements),
|
|
10810
10719
|
content: {
|
|
10811
10720
|
userId,
|
|
10812
10721
|
targetId: event.target_id + ""
|
|
@@ -10817,15 +10726,15 @@ var createNotice = (event, bot) => {
|
|
|
10817
10726
|
if (event.notice_type === "notify" /* Notify */ && event.sub_type === "honor") {
|
|
10818
10727
|
const userId = event.user_id + "";
|
|
10819
10728
|
const groupId = event.group_id + "";
|
|
10820
|
-
const
|
|
10729
|
+
const contact3 = contactGroup(groupId);
|
|
10821
10730
|
createGroupHonorChangedNotice({
|
|
10822
10731
|
bot,
|
|
10823
10732
|
eventId: `notice:${groupId}.${event.time}`,
|
|
10824
10733
|
rawEvent: event,
|
|
10825
10734
|
time: time2,
|
|
10826
|
-
contact:
|
|
10735
|
+
contact: contact3,
|
|
10827
10736
|
sender: senderGroup(userId),
|
|
10828
|
-
srcReply: (elements) => bot.sendMsg(
|
|
10737
|
+
srcReply: (elements) => bot.sendMsg(contact3, elements),
|
|
10829
10738
|
content: {
|
|
10830
10739
|
honorType: event.honor_type
|
|
10831
10740
|
}
|
|
@@ -10837,15 +10746,15 @@ var createNotice = (event, bot) => {
|
|
|
10837
10746
|
const groupId = event.group_id + "";
|
|
10838
10747
|
const messageId = event.message_id + "";
|
|
10839
10748
|
const operatorId = event.operator_id + "";
|
|
10840
|
-
const
|
|
10749
|
+
const contact3 = contactGroup(groupId);
|
|
10841
10750
|
createGroupRecallNotice({
|
|
10842
10751
|
bot,
|
|
10843
10752
|
eventId: `notice:${groupId}.${event.time}`,
|
|
10844
10753
|
rawEvent: event,
|
|
10845
10754
|
time: time2,
|
|
10846
|
-
contact:
|
|
10755
|
+
contact: contact3,
|
|
10847
10756
|
sender: senderGroup(userId),
|
|
10848
|
-
srcReply: (elements) => bot.sendMsg(
|
|
10757
|
+
srcReply: (elements) => bot.sendMsg(contact3, elements),
|
|
10849
10758
|
content: {
|
|
10850
10759
|
messageId,
|
|
10851
10760
|
operatorId,
|
|
@@ -10858,15 +10767,15 @@ var createNotice = (event, bot) => {
|
|
|
10858
10767
|
if (event.notice_type === "group_increase" /* GroupIncrease */) {
|
|
10859
10768
|
const userId = event.user_id + "";
|
|
10860
10769
|
const groupId = event.group_id + "";
|
|
10861
|
-
const
|
|
10770
|
+
const contact3 = contactGroup(groupId);
|
|
10862
10771
|
createGroupMemberAddNotice({
|
|
10863
10772
|
bot,
|
|
10864
10773
|
eventId: `notice:${groupId}.${event.time}`,
|
|
10865
10774
|
rawEvent: event,
|
|
10866
10775
|
time: time2,
|
|
10867
|
-
contact:
|
|
10776
|
+
contact: contact3,
|
|
10868
10777
|
sender: senderGroup(userId),
|
|
10869
|
-
srcReply: (elements) => bot.sendMsg(
|
|
10778
|
+
srcReply: (elements) => bot.sendMsg(contact3, elements),
|
|
10870
10779
|
content: {
|
|
10871
10780
|
operatorId: event.operator_id + "",
|
|
10872
10781
|
targetId: userId,
|
|
@@ -10878,15 +10787,15 @@ var createNotice = (event, bot) => {
|
|
|
10878
10787
|
if (event.notice_type === "group_decrease" /* GroupDecrease */) {
|
|
10879
10788
|
const userId = event.user_id + "";
|
|
10880
10789
|
const groupId = event.group_id + "";
|
|
10881
|
-
const
|
|
10790
|
+
const contact3 = contactGroup(groupId);
|
|
10882
10791
|
createGroupMemberDelNotice({
|
|
10883
10792
|
bot,
|
|
10884
10793
|
eventId: `notice:${groupId}.${event.time}`,
|
|
10885
10794
|
rawEvent: event,
|
|
10886
10795
|
time: time2,
|
|
10887
|
-
contact:
|
|
10796
|
+
contact: contact3,
|
|
10888
10797
|
sender: senderGroup(userId),
|
|
10889
|
-
srcReply: (elements) => bot.sendMsg(
|
|
10798
|
+
srcReply: (elements) => bot.sendMsg(contact3, elements),
|
|
10890
10799
|
content: {
|
|
10891
10800
|
operatorId: event.operator_id + "",
|
|
10892
10801
|
targetId: userId,
|
|
@@ -10898,15 +10807,15 @@ var createNotice = (event, bot) => {
|
|
|
10898
10807
|
if (event.notice_type === "group_upload" /* GroupUpload */) {
|
|
10899
10808
|
const userId = event.user_id + "";
|
|
10900
10809
|
const groupId = event.group_id + "";
|
|
10901
|
-
const
|
|
10810
|
+
const contact3 = contactGroup(groupId);
|
|
10902
10811
|
createGroupFileUploadedNotice({
|
|
10903
10812
|
bot,
|
|
10904
10813
|
eventId: `notice:${groupId}.${event.time}`,
|
|
10905
10814
|
rawEvent: event,
|
|
10906
10815
|
time: time2,
|
|
10907
|
-
contact:
|
|
10816
|
+
contact: contact3,
|
|
10908
10817
|
sender: senderGroup(userId),
|
|
10909
|
-
srcReply: (elements) => bot.sendMsg(
|
|
10818
|
+
srcReply: (elements) => bot.sendMsg(contact3, elements),
|
|
10910
10819
|
content: {
|
|
10911
10820
|
fid: event.file.id,
|
|
10912
10821
|
name: event.file.name,
|
|
@@ -10919,15 +10828,15 @@ var createNotice = (event, bot) => {
|
|
|
10919
10828
|
if (event.notice_type === "group_admin" /* GroupAdmin */) {
|
|
10920
10829
|
const userId = event.user_id + "";
|
|
10921
10830
|
const groupId = event.group_id + "";
|
|
10922
|
-
const
|
|
10831
|
+
const contact3 = contactGroup(groupId);
|
|
10923
10832
|
createGroupAdminChangedNotice({
|
|
10924
10833
|
bot,
|
|
10925
10834
|
eventId: `notice:${groupId}.${event.time}`,
|
|
10926
10835
|
rawEvent: event,
|
|
10927
10836
|
time: time2,
|
|
10928
|
-
contact:
|
|
10837
|
+
contact: contact3,
|
|
10929
10838
|
sender: senderGroup(userId),
|
|
10930
|
-
srcReply: (elements) => bot.sendMsg(
|
|
10839
|
+
srcReply: (elements) => bot.sendMsg(contact3, elements),
|
|
10931
10840
|
content: {
|
|
10932
10841
|
targetId: userId,
|
|
10933
10842
|
isAdmin: event.sub_type === "set"
|
|
@@ -10938,15 +10847,15 @@ var createNotice = (event, bot) => {
|
|
|
10938
10847
|
if (event.notice_type === "group_ban" /* GroupBan */) {
|
|
10939
10848
|
const userId = event.user_id + "";
|
|
10940
10849
|
const groupId = event.group_id + "";
|
|
10941
|
-
const
|
|
10850
|
+
const contact3 = contactGroup(groupId);
|
|
10942
10851
|
createGroupMemberBanNotice({
|
|
10943
10852
|
bot,
|
|
10944
10853
|
eventId: `notice:${groupId}.${event.time}`,
|
|
10945
10854
|
rawEvent: event,
|
|
10946
10855
|
time: time2,
|
|
10947
|
-
contact:
|
|
10856
|
+
contact: contact3,
|
|
10948
10857
|
sender: senderGroup(userId),
|
|
10949
|
-
srcReply: (elements) => bot.sendMsg(
|
|
10858
|
+
srcReply: (elements) => bot.sendMsg(contact3, elements),
|
|
10950
10859
|
content: {
|
|
10951
10860
|
operatorId: event.operator_id + "",
|
|
10952
10861
|
targetId: userId,
|
|
@@ -10959,15 +10868,15 @@ var createNotice = (event, bot) => {
|
|
|
10959
10868
|
if (event.notice_type === "group_msg_emoji_like" /* GroupMsgEmojiLike */) {
|
|
10960
10869
|
const userId = event.user_id + "";
|
|
10961
10870
|
const groupId = event.group_id + "";
|
|
10962
|
-
const
|
|
10871
|
+
const contact3 = contactGroup(groupId);
|
|
10963
10872
|
createGroupMessageReactionNotice({
|
|
10964
10873
|
bot,
|
|
10965
10874
|
eventId: `notice:${groupId}.${event.time}`,
|
|
10966
10875
|
rawEvent: event,
|
|
10967
10876
|
time: time2,
|
|
10968
|
-
contact:
|
|
10877
|
+
contact: contact3,
|
|
10969
10878
|
sender: senderGroup(userId),
|
|
10970
|
-
srcReply: (elements) => bot.sendMsg(
|
|
10879
|
+
srcReply: (elements) => bot.sendMsg(contact3, elements),
|
|
10971
10880
|
content: {
|
|
10972
10881
|
count: event.likes[0].count,
|
|
10973
10882
|
faceId: event.likes[0].emoji_id,
|
|
@@ -10980,15 +10889,15 @@ var createNotice = (event, bot) => {
|
|
|
10980
10889
|
if (event.notice_type === "reaction" /* GroupMsgEmojiLikeLagrange */) {
|
|
10981
10890
|
const userId = event.operator_id + "";
|
|
10982
10891
|
const groupId = event.group_id + "";
|
|
10983
|
-
const
|
|
10892
|
+
const contact3 = contactGroup(groupId);
|
|
10984
10893
|
createGroupMessageReactionNotice({
|
|
10985
10894
|
bot,
|
|
10986
10895
|
eventId: `notice:${groupId}.${event.time}`,
|
|
10987
10896
|
rawEvent: event,
|
|
10988
10897
|
time: time2,
|
|
10989
|
-
contact:
|
|
10898
|
+
contact: contact3,
|
|
10990
10899
|
sender: senderGroup(userId),
|
|
10991
|
-
srcReply: (elements) => bot.sendMsg(
|
|
10900
|
+
srcReply: (elements) => bot.sendMsg(contact3, elements),
|
|
10992
10901
|
content: {
|
|
10993
10902
|
count: event.count,
|
|
10994
10903
|
faceId: Number(event.code),
|
|
@@ -11001,15 +10910,15 @@ var createNotice = (event, bot) => {
|
|
|
11001
10910
|
if (event.notice_type === "essence" /* GroupEssence */) {
|
|
11002
10911
|
const userId = event.sender_id + "";
|
|
11003
10912
|
const groupId = event.group_id + "";
|
|
11004
|
-
const
|
|
10913
|
+
const contact3 = contactGroup(groupId);
|
|
11005
10914
|
createGroupHlightsChangedNotice({
|
|
11006
10915
|
bot,
|
|
11007
10916
|
eventId: `notice:${groupId}.${event.time}`,
|
|
11008
10917
|
rawEvent: event,
|
|
11009
10918
|
time: time2,
|
|
11010
|
-
contact:
|
|
10919
|
+
contact: contact3,
|
|
11011
10920
|
sender: senderGroup(userId),
|
|
11012
|
-
srcReply: (elements) => bot.sendMsg(
|
|
10921
|
+
srcReply: (elements) => bot.sendMsg(contact3, elements),
|
|
11013
10922
|
content: {
|
|
11014
10923
|
isSet: event.sub_type === "add",
|
|
11015
10924
|
messageId: event.message_id + "",
|
|
@@ -11022,15 +10931,15 @@ var createNotice = (event, bot) => {
|
|
|
11022
10931
|
if (event.notice_type === "group_card" /* GroupCard */) {
|
|
11023
10932
|
const userId = event.user_id + "";
|
|
11024
10933
|
const groupId = event.group_id + "";
|
|
11025
|
-
const
|
|
10934
|
+
const contact3 = contactGroup(groupId);
|
|
11026
10935
|
createGroupCardChangedNotice({
|
|
11027
10936
|
bot,
|
|
11028
10937
|
eventId: `notice:${groupId}.${event.time}`,
|
|
11029
10938
|
rawEvent: event,
|
|
11030
10939
|
time: time2,
|
|
11031
|
-
contact:
|
|
10940
|
+
contact: contact3,
|
|
11032
10941
|
sender: senderGroup(userId),
|
|
11033
|
-
srcReply: (elements) => bot.sendMsg(
|
|
10942
|
+
srcReply: (elements) => bot.sendMsg(contact3, elements),
|
|
11034
10943
|
content: {
|
|
11035
10944
|
newCard: event.card_new,
|
|
11036
10945
|
operatorId: "",
|
|
@@ -11142,9 +11051,9 @@ var AdapterOneBot = class extends AdapterBase {
|
|
|
11142
11051
|
* @param elements
|
|
11143
11052
|
* @returns 消息ID
|
|
11144
11053
|
*/
|
|
11145
|
-
async sendMsg(
|
|
11054
|
+
async sendMsg(contact3, elements, retryCount) {
|
|
11146
11055
|
try {
|
|
11147
|
-
const { scene, peer } =
|
|
11056
|
+
const { scene, peer } = contact3;
|
|
11148
11057
|
let res;
|
|
11149
11058
|
if (scene === "group") {
|
|
11150
11059
|
res = await this.sendApi("send_msg" /* sendMsg */, {
|
|
@@ -11154,7 +11063,7 @@ var AdapterOneBot = class extends AdapterBase {
|
|
|
11154
11063
|
});
|
|
11155
11064
|
} else if (scene === "groupTemp") {
|
|
11156
11065
|
res = await this.sendApi("send_private_msg" /* sendPrivateMsg */, {
|
|
11157
|
-
user_id: Number(
|
|
11066
|
+
user_id: Number(contact3.subPeer),
|
|
11158
11067
|
group_id: Number(peer),
|
|
11159
11068
|
message: this.KarinConvertAdapter(elements)
|
|
11160
11069
|
});
|
|
@@ -11171,7 +11080,7 @@ var AdapterOneBot = class extends AdapterBase {
|
|
|
11171
11080
|
return { messageId, messageTime, rawData, message_id: messageId, time: messageTime };
|
|
11172
11081
|
} catch (error) {
|
|
11173
11082
|
if (retryCount && retryCount > 0) {
|
|
11174
|
-
return this.sendMsg(
|
|
11083
|
+
return this.sendMsg(contact3, elements, retryCount - 1);
|
|
11175
11084
|
}
|
|
11176
11085
|
throw error;
|
|
11177
11086
|
}
|
|
@@ -11180,8 +11089,8 @@ var AdapterOneBot = class extends AdapterBase {
|
|
|
11180
11089
|
* 发送消息
|
|
11181
11090
|
* @deprecated 已废弃,请使用`sendMsg`
|
|
11182
11091
|
*/
|
|
11183
|
-
async SendMessage(
|
|
11184
|
-
return this.sendMsg(
|
|
11092
|
+
async SendMessage(contact3, elements, retryCount) {
|
|
11093
|
+
return this.sendMsg(contact3, elements, retryCount);
|
|
11185
11094
|
}
|
|
11186
11095
|
// /**
|
|
11187
11096
|
// * 上传合并转发消息
|
|
@@ -11218,9 +11127,9 @@ var AdapterOneBot = class extends AdapterBase {
|
|
|
11218
11127
|
* @param contact 目标信息
|
|
11219
11128
|
* @param resId 资源ID
|
|
11220
11129
|
*/
|
|
11221
|
-
async sendLongMsg(
|
|
11130
|
+
async sendLongMsg(contact3, resId) {
|
|
11222
11131
|
let result;
|
|
11223
|
-
const { scene, peer } =
|
|
11132
|
+
const { scene, peer } = contact3;
|
|
11224
11133
|
if (scene === "group") {
|
|
11225
11134
|
result = await this.sendApi("send_group_msg" /* sendGroupMsg */, {
|
|
11226
11135
|
group_id: Number(peer),
|
|
@@ -11246,15 +11155,15 @@ var AdapterOneBot = class extends AdapterBase {
|
|
|
11246
11155
|
/**
|
|
11247
11156
|
* @deprecated 已废弃,请使用`sendLongMsg`
|
|
11248
11157
|
*/
|
|
11249
|
-
async SendMessageByResId(
|
|
11250
|
-
return this.sendLongMsg(
|
|
11158
|
+
async SendMessageByResId(contact3, id) {
|
|
11159
|
+
return this.sendLongMsg(contact3, id);
|
|
11251
11160
|
}
|
|
11252
11161
|
/**
|
|
11253
11162
|
* 撤回消息
|
|
11254
11163
|
* @param contact ob11无需提供contact参数
|
|
11255
11164
|
* @param messageId 消息ID
|
|
11256
11165
|
*/
|
|
11257
|
-
async recallMsg(
|
|
11166
|
+
async recallMsg(contact3, messageId) {
|
|
11258
11167
|
try {
|
|
11259
11168
|
await this.sendApi("delete_msg" /* deleteMsg */, { message_id: Number(messageId) });
|
|
11260
11169
|
return true;
|
|
@@ -11273,7 +11182,7 @@ var AdapterOneBot = class extends AdapterBase {
|
|
|
11273
11182
|
* @param contact 联系人信息
|
|
11274
11183
|
* @param messageId 消息ID
|
|
11275
11184
|
*/
|
|
11276
|
-
async getMsg(
|
|
11185
|
+
async getMsg(contact3, messageId) {
|
|
11277
11186
|
const result = await this.sendApi("get_msg" /* getMsg */, { message_id: Number(messageId) });
|
|
11278
11187
|
const userId = result.sender.user_id + "";
|
|
11279
11188
|
const messageSeq = result.message_seq || result.message_id;
|
|
@@ -11286,7 +11195,7 @@ var AdapterOneBot = class extends AdapterBase {
|
|
|
11286
11195
|
messageSeq,
|
|
11287
11196
|
contact: {
|
|
11288
11197
|
scene: result.message_type === "group" ? "group" : "friend",
|
|
11289
|
-
peer:
|
|
11198
|
+
peer: contact3.peer,
|
|
11290
11199
|
// 这里可能不准确 传入是什么就返回什么
|
|
11291
11200
|
sub_peer: null,
|
|
11292
11201
|
name: ""
|
|
@@ -11305,8 +11214,8 @@ var AdapterOneBot = class extends AdapterBase {
|
|
|
11305
11214
|
/**
|
|
11306
11215
|
* @deprecated 已废弃,请使用`getMsg`
|
|
11307
11216
|
*/
|
|
11308
|
-
async GetMessage(
|
|
11309
|
-
return this.getMsg(
|
|
11217
|
+
async GetMessage(contact3, messageId) {
|
|
11218
|
+
return this.getMsg(contact3, messageId);
|
|
11310
11219
|
}
|
|
11311
11220
|
/**
|
|
11312
11221
|
* 获取msgId获取历史消息
|
|
@@ -11315,21 +11224,21 @@ var AdapterOneBot = class extends AdapterBase {
|
|
|
11315
11224
|
* @param count 获取消息数量 默认为1
|
|
11316
11225
|
* @returns 包含历史消息的数组
|
|
11317
11226
|
*/
|
|
11318
|
-
async getHistoryMsg(
|
|
11227
|
+
async getHistoryMsg(contact3, startMsgId, count3) {
|
|
11319
11228
|
var _a, _b, _c, _d;
|
|
11320
11229
|
let options;
|
|
11321
11230
|
if (this.adapter.name === "Lagrange.OneBot") {
|
|
11322
11231
|
options = { message_id: Number(startMsgId), count: count3 };
|
|
11323
11232
|
} else {
|
|
11324
|
-
const messageSeq = (await this.getMsg(
|
|
11233
|
+
const messageSeq = (await this.getMsg(contact3, startMsgId)).message_seq;
|
|
11325
11234
|
options = { message_seq: messageSeq, count: count3 };
|
|
11326
11235
|
}
|
|
11327
11236
|
let res;
|
|
11328
|
-
if (
|
|
11329
|
-
options.group_id = Number(
|
|
11237
|
+
if (contact3.scene === "group") {
|
|
11238
|
+
options.group_id = Number(contact3.peer);
|
|
11330
11239
|
res = await this.sendApi("get_group_msg_history" /* getGroupMsgHistory */, options);
|
|
11331
11240
|
} else {
|
|
11332
|
-
options.user_id = Number(
|
|
11241
|
+
options.user_id = Number(contact3.peer);
|
|
11333
11242
|
res = await this.sendApi("get_friend_msg_history" /* getFriendMsgHistory */, options);
|
|
11334
11243
|
}
|
|
11335
11244
|
const all = [];
|
|
@@ -11343,7 +11252,7 @@ var AdapterOneBot = class extends AdapterBase {
|
|
|
11343
11252
|
messageSeq,
|
|
11344
11253
|
message_id: messageId,
|
|
11345
11254
|
message_seq: messageSeq,
|
|
11346
|
-
contact:
|
|
11255
|
+
contact: contact3,
|
|
11347
11256
|
sender: {
|
|
11348
11257
|
userId,
|
|
11349
11258
|
uid: userId,
|
|
@@ -11351,7 +11260,7 @@ var AdapterOneBot = class extends AdapterBase {
|
|
|
11351
11260
|
nick: ((_a = v == null ? void 0 : v.sender) == null ? void 0 : _a.nickname) || "",
|
|
11352
11261
|
name: ((_b = v == null ? void 0 : v.sender) == null ? void 0 : _b.nickname) || "",
|
|
11353
11262
|
role: ((_c = v == null ? void 0 : v.sender) == null ? void 0 : _c.role) || "unknown",
|
|
11354
|
-
card:
|
|
11263
|
+
card: contact3.scene === "group" ? ((_d = v == null ? void 0 : v.sender) == null ? void 0 : _d.card) || "" : ""
|
|
11355
11264
|
},
|
|
11356
11265
|
elements: this.AdapterConvertKarin(v.message)
|
|
11357
11266
|
};
|
|
@@ -11363,8 +11272,8 @@ var AdapterOneBot = class extends AdapterBase {
|
|
|
11363
11272
|
* 获取msg_id获取历史消息
|
|
11364
11273
|
* @deprecated 已废弃,请使用`getHistoryMsg`
|
|
11365
11274
|
*/
|
|
11366
|
-
async GetHistoryMessage(
|
|
11367
|
-
return this.getHistoryMsg(
|
|
11275
|
+
async GetHistoryMessage(contact3, startMessageId, count3 = 1) {
|
|
11276
|
+
return this.getHistoryMsg(contact3, startMessageId, count3);
|
|
11368
11277
|
}
|
|
11369
11278
|
/**
|
|
11370
11279
|
* 发送好友赞
|
|
@@ -11931,7 +11840,7 @@ var AdapterOneBot = class extends AdapterBase {
|
|
|
11931
11840
|
* @param faceId 表情ID
|
|
11932
11841
|
* @returns 此接口的返回值不值得信任
|
|
11933
11842
|
*/
|
|
11934
|
-
async setMsgReaction(
|
|
11843
|
+
async setMsgReaction(contact3, messageId, faceId, isSet) {
|
|
11935
11844
|
try {
|
|
11936
11845
|
await this.sendApi("set_msg_emoji_like" /* setMsgEmojiLike */, { message_id: messageId, emoji_id: faceId, is_set: isSet });
|
|
11937
11846
|
return true;
|
|
@@ -11942,8 +11851,8 @@ var AdapterOneBot = class extends AdapterBase {
|
|
|
11942
11851
|
/**
|
|
11943
11852
|
* @deprecated 已废弃,请使用`setMsgReaction`
|
|
11944
11853
|
*/
|
|
11945
|
-
async ReactMessageWithEmoji(
|
|
11946
|
-
return this.setMsgReaction(
|
|
11854
|
+
async ReactMessageWithEmoji(contact3, messageId, faceId, isSet = true) {
|
|
11855
|
+
return this.setMsgReaction(contact3, messageId, faceId, isSet);
|
|
11947
11856
|
}
|
|
11948
11857
|
/**
|
|
11949
11858
|
* 获取版本信息
|
|
@@ -12035,12 +11944,12 @@ var AdapterOneBot = class extends AdapterBase {
|
|
|
12035
11944
|
* @param folder 父目录ID 不提供则上传到根目录 仅在群聊时有效
|
|
12036
11945
|
* @returns 此接口的返回值不值得信任
|
|
12037
11946
|
*/
|
|
12038
|
-
async uploadFile(
|
|
11947
|
+
async uploadFile(contact3, file, name, folder) {
|
|
12039
11948
|
try {
|
|
12040
|
-
if (
|
|
12041
|
-
await this.sendApi("upload_group_file" /* uploadGroupFile */, { group_id: Number(
|
|
11949
|
+
if (contact3.scene === "group") {
|
|
11950
|
+
await this.sendApi("upload_group_file" /* uploadGroupFile */, { group_id: Number(contact3.peer), file, name, folder });
|
|
12042
11951
|
} else {
|
|
12043
|
-
await this.sendApi("upload_private_file" /* uploadPrivateFile */, { user_id: Number(
|
|
11952
|
+
await this.sendApi("upload_private_file" /* uploadPrivateFile */, { user_id: Number(contact3.peer), file, name });
|
|
12044
11953
|
}
|
|
12045
11954
|
return true;
|
|
12046
11955
|
} catch {
|
|
@@ -12190,32 +12099,32 @@ var AdapterOneBot = class extends AdapterBase {
|
|
|
12190
12099
|
* @param elements 消息元素
|
|
12191
12100
|
* @param options 首层小卡片外显参数
|
|
12192
12101
|
*/
|
|
12193
|
-
async sendForwardMsg(
|
|
12194
|
-
if (
|
|
12102
|
+
async sendForwardMsg(contact3, elements, options) {
|
|
12103
|
+
if (contact3.scene === "group") {
|
|
12195
12104
|
const result = await this.sendApi("send_group_forward_msg" /* sendGroupForwardMsg */, {
|
|
12196
|
-
group_id: Number(
|
|
12105
|
+
group_id: Number(contact3.peer),
|
|
12197
12106
|
messages: this.forwardKarinConvertAdapter(elements),
|
|
12198
12107
|
...options
|
|
12199
12108
|
});
|
|
12200
12109
|
const messageId = String(result.message_id);
|
|
12201
12110
|
return { messageId, forwardId: result.forward_id, message_id: messageId };
|
|
12202
12111
|
}
|
|
12203
|
-
if (
|
|
12112
|
+
if (contact3.scene === "friend") {
|
|
12204
12113
|
const result = await this.sendApi("send_private_forward_msg" /* sendPrivateForwardMsg */, {
|
|
12205
|
-
user_id: Number(
|
|
12114
|
+
user_id: Number(contact3.peer),
|
|
12206
12115
|
messages: this.forwardKarinConvertAdapter(elements),
|
|
12207
12116
|
...options
|
|
12208
12117
|
});
|
|
12209
12118
|
const messageId = String(result.message_id);
|
|
12210
12119
|
return { messageId, forwardId: result.forward_id, message_id: messageId };
|
|
12211
12120
|
}
|
|
12212
|
-
throw TypeError(`\u4E0D\u652F\u6301\u7684\u573A\u666F\u7C7B\u578B: ${
|
|
12121
|
+
throw TypeError(`\u4E0D\u652F\u6301\u7684\u573A\u666F\u7C7B\u578B: ${contact3.scene}`);
|
|
12213
12122
|
}
|
|
12214
12123
|
/**
|
|
12215
12124
|
* @deprecated 已废弃,请使用`sendForwardMsg`
|
|
12216
12125
|
*/
|
|
12217
|
-
async sendForwardMessage(
|
|
12218
|
-
return this.sendForwardMsg(
|
|
12126
|
+
async sendForwardMessage(contact3, elements) {
|
|
12127
|
+
return this.sendForwardMsg(contact3, elements);
|
|
12219
12128
|
}
|
|
12220
12129
|
/**
|
|
12221
12130
|
* 发送API请求
|
|
@@ -12495,6 +12404,7 @@ var createServer2 = async () => {
|
|
|
12495
12404
|
listeners.once("online", () => {
|
|
12496
12405
|
logger.info(`[server] onebot: ${logger.green(`ws://127.0.0.1:${process.env.HTTP_PORT}`)}`);
|
|
12497
12406
|
logger.info(`[server] onebot: ${logger.green(`ws://127.0.0.1:${process.env.HTTP_PORT}/onebot/v11/ws`)}`);
|
|
12407
|
+
logger.info(`[server] onebot: ${logger.green(`ws://127.0.0.1:${process.env.HTTP_PORT}/puppeteer`)}`);
|
|
12498
12408
|
});
|
|
12499
12409
|
};
|
|
12500
12410
|
var createClient2 = async () => {
|
|
@@ -12528,7 +12438,7 @@ createServer2();
|
|
|
12528
12438
|
createHttp();
|
|
12529
12439
|
|
|
12530
12440
|
// src/index.ts
|
|
12531
|
-
|
|
12441
|
+
init_event();
|
|
12532
12442
|
init_adapter2();
|
|
12533
12443
|
init_root();
|
|
12534
12444
|
|
|
@@ -12698,7 +12608,35 @@ init_esm_shims();
|
|
|
12698
12608
|
export {
|
|
12699
12609
|
AdapterBase,
|
|
12700
12610
|
AdapterConsole,
|
|
12611
|
+
BaseEvent,
|
|
12701
12612
|
Bot,
|
|
12613
|
+
DirectMessage,
|
|
12614
|
+
FriendDecreaseNotice,
|
|
12615
|
+
FriendIncreaseNotice,
|
|
12616
|
+
FriendMessage,
|
|
12617
|
+
GroupAdminChangedNotice,
|
|
12618
|
+
GroupApplyRequest,
|
|
12619
|
+
GroupCardChangedNotice,
|
|
12620
|
+
GroupFileUploadedNotice,
|
|
12621
|
+
GroupHlightsChangedNotice,
|
|
12622
|
+
GroupHonorChangedNotice,
|
|
12623
|
+
GroupInviteRequest,
|
|
12624
|
+
GroupLuckKingNotice,
|
|
12625
|
+
GroupMemberBanNotice,
|
|
12626
|
+
GroupMemberDecreaseNotice,
|
|
12627
|
+
GroupMemberIncreaseNotice,
|
|
12628
|
+
GroupMemberTitleUpdatedNotice,
|
|
12629
|
+
GroupMessage,
|
|
12630
|
+
GroupMessageReactionNotice,
|
|
12631
|
+
GroupNotice,
|
|
12632
|
+
GroupPokeNotice,
|
|
12633
|
+
GroupRecallNotice,
|
|
12634
|
+
GroupSignInNotice,
|
|
12635
|
+
GroupTempMessage,
|
|
12636
|
+
GroupWholeBanNotice,
|
|
12637
|
+
GuildMessage,
|
|
12638
|
+
MessageBase,
|
|
12639
|
+
NoticeBase,
|
|
12702
12640
|
OB11ApiAction,
|
|
12703
12641
|
OB11Event,
|
|
12704
12642
|
OB11MessageSubType,
|
|
@@ -12707,7 +12645,13 @@ export {
|
|
|
12707
12645
|
OB11RequestType,
|
|
12708
12646
|
OB11Sex,
|
|
12709
12647
|
Plugin,
|
|
12648
|
+
PrivateApplyRequest,
|
|
12649
|
+
PrivateFileUploadedNotice,
|
|
12650
|
+
PrivatePokeNotice,
|
|
12651
|
+
PrivateRecallNotice,
|
|
12652
|
+
ReceiveLikeNotice,
|
|
12710
12653
|
Renderer,
|
|
12654
|
+
RequestBase,
|
|
12711
12655
|
Watch,
|
|
12712
12656
|
Watcher,
|
|
12713
12657
|
YamlEditor,
|
|
@@ -12731,42 +12675,19 @@ export {
|
|
|
12731
12675
|
config_exports2 as config,
|
|
12732
12676
|
configPath,
|
|
12733
12677
|
consolePath,
|
|
12678
|
+
contact2 as contact,
|
|
12679
|
+
contactDirect,
|
|
12680
|
+
contactFriend,
|
|
12681
|
+
contactGroup,
|
|
12682
|
+
contactGroupTemp,
|
|
12683
|
+
contactGuild,
|
|
12734
12684
|
copyConfig,
|
|
12735
12685
|
copyConfigSync,
|
|
12736
12686
|
copyFiles,
|
|
12737
12687
|
copyFilesSync,
|
|
12738
|
-
createDirectMessage,
|
|
12739
|
-
createFriendDecreaseNotice,
|
|
12740
|
-
createFriendIncreaseNotice,
|
|
12741
|
-
createFriendMessage,
|
|
12742
|
-
createGroupAdminChangedNotice,
|
|
12743
|
-
createGroupApplyRequest,
|
|
12744
|
-
createGroupCardChangedNotice,
|
|
12745
|
-
createGroupFileUploadedNotice,
|
|
12746
|
-
createGroupHlightsChangedNotice,
|
|
12747
|
-
createGroupHonorChangedNotice,
|
|
12748
|
-
createGroupInviteRequest,
|
|
12749
|
-
createGroupLuckKingNotice,
|
|
12750
|
-
createGroupMemberAddNotice,
|
|
12751
|
-
createGroupMemberBanNotice,
|
|
12752
|
-
createGroupMemberDelNotice,
|
|
12753
|
-
createGroupMemberTitleUpdatedNotice,
|
|
12754
|
-
createGroupMessage,
|
|
12755
|
-
createGroupMessageReactionNotice,
|
|
12756
|
-
createGroupPokeNotice,
|
|
12757
|
-
createGroupRecallNotice,
|
|
12758
|
-
createGroupSignInNotice,
|
|
12759
|
-
createGroupTempMessage,
|
|
12760
|
-
createGroupWholeBanNotice,
|
|
12761
|
-
createGuildMessage,
|
|
12762
12688
|
createLogger,
|
|
12763
12689
|
createPluginDir,
|
|
12764
|
-
createPrivateApplyRequest,
|
|
12765
|
-
createPrivateFileUploadedNotice,
|
|
12766
|
-
createPrivatePokeNotice,
|
|
12767
|
-
createPrivateRecallNotice,
|
|
12768
12690
|
createRawMessage,
|
|
12769
|
-
createReceiveLikeNotice,
|
|
12770
12691
|
dataPath,
|
|
12771
12692
|
dbPath,
|
|
12772
12693
|
karin as default,
|
|
@@ -12875,6 +12796,12 @@ export {
|
|
|
12875
12796
|
save,
|
|
12876
12797
|
segment_exports as segment,
|
|
12877
12798
|
sendMsg,
|
|
12799
|
+
sender,
|
|
12800
|
+
senderDirect,
|
|
12801
|
+
senderFriend,
|
|
12802
|
+
senderGroup,
|
|
12803
|
+
senderGroupTemp,
|
|
12804
|
+
senderGuild,
|
|
12878
12805
|
sep,
|
|
12879
12806
|
server,
|
|
12880
12807
|
splitPath,
|