woodenfish-bot 3.4.3 → 3.4.5
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/es/index.js +85 -85
- package/lib/index.js +85 -85
- package/package.json +19 -19
package/es/index.js
CHANGED
|
@@ -20,12 +20,12 @@ function _typeof$1(o) {
|
|
|
20
20
|
function toPrimitive(t, r) {
|
|
21
21
|
if ("object" != _typeof$1(t) || !t) return t;
|
|
22
22
|
var e = t[Symbol.toPrimitive];
|
|
23
|
-
if (
|
|
24
|
-
var i = e.call(t, r
|
|
23
|
+
if (void 0 !== e) {
|
|
24
|
+
var i = e.call(t, r);
|
|
25
25
|
if ("object" != _typeof$1(i)) return i;
|
|
26
26
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
27
27
|
}
|
|
28
|
-
return (
|
|
28
|
+
return (String )(t);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
function toPropertyKey(t) {
|
|
@@ -122,8 +122,8 @@ var getURL = function getURL(endpoint) {
|
|
|
122
122
|
var PinsMessage = /*#__PURE__*/function () {
|
|
123
123
|
function PinsMessage(request, config) {
|
|
124
124
|
_classCallCheck(this, PinsMessage);
|
|
125
|
-
_defineProperty(this, "request",
|
|
126
|
-
_defineProperty(this, "config",
|
|
125
|
+
_defineProperty(this, "request", void 0);
|
|
126
|
+
_defineProperty(this, "config", void 0);
|
|
127
127
|
this.request = request;
|
|
128
128
|
this.config = config;
|
|
129
129
|
}
|
|
@@ -180,8 +180,8 @@ var PinsMessage = /*#__PURE__*/function () {
|
|
|
180
180
|
var Reaction = /*#__PURE__*/function () {
|
|
181
181
|
function Reaction(request, config) {
|
|
182
182
|
_classCallCheck(this, Reaction);
|
|
183
|
-
_defineProperty(this, "request",
|
|
184
|
-
_defineProperty(this, "config",
|
|
183
|
+
_defineProperty(this, "request", void 0);
|
|
184
|
+
_defineProperty(this, "config", void 0);
|
|
185
185
|
this.request = request;
|
|
186
186
|
this.config = config;
|
|
187
187
|
}
|
|
@@ -195,9 +195,9 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
195
195
|
url: getURL('reactionURI'),
|
|
196
196
|
rest: {
|
|
197
197
|
channelID: channelId,
|
|
198
|
-
messageID: reactionToCreate === null || reactionToCreate ===
|
|
199
|
-
emojiType: reactionToCreate === null || reactionToCreate ===
|
|
200
|
-
emojiID: reactionToCreate === null || reactionToCreate ===
|
|
198
|
+
messageID: reactionToCreate === null || reactionToCreate === void 0 ? void 0 : reactionToCreate.message_id,
|
|
199
|
+
emojiType: reactionToCreate === null || reactionToCreate === void 0 ? void 0 : reactionToCreate.emoji_type,
|
|
200
|
+
emojiID: reactionToCreate === null || reactionToCreate === void 0 ? void 0 : reactionToCreate.emoji_id
|
|
201
201
|
}
|
|
202
202
|
};
|
|
203
203
|
return this.request(options);
|
|
@@ -212,9 +212,9 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
212
212
|
url: getURL('reactionURI'),
|
|
213
213
|
rest: {
|
|
214
214
|
channelID: channelId,
|
|
215
|
-
messageID: reactionToDelete === null || reactionToDelete ===
|
|
216
|
-
emojiType: reactionToDelete === null || reactionToDelete ===
|
|
217
|
-
emojiID: reactionToDelete === null || reactionToDelete ===
|
|
215
|
+
messageID: reactionToDelete === null || reactionToDelete === void 0 ? void 0 : reactionToDelete.message_id,
|
|
216
|
+
emojiType: reactionToDelete === null || reactionToDelete === void 0 ? void 0 : reactionToDelete.emoji_type,
|
|
217
|
+
emojiID: reactionToDelete === null || reactionToDelete === void 0 ? void 0 : reactionToDelete.emoji_id
|
|
218
218
|
}
|
|
219
219
|
};
|
|
220
220
|
return this.request(options);
|
|
@@ -232,9 +232,9 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
232
232
|
url: getURL('reactionURI'),
|
|
233
233
|
rest: {
|
|
234
234
|
channelID: channelId,
|
|
235
|
-
messageID: reactionToCreate === null || reactionToCreate ===
|
|
236
|
-
emojiType: reactionToCreate === null || reactionToCreate ===
|
|
237
|
-
emojiID: reactionToCreate === null || reactionToCreate ===
|
|
235
|
+
messageID: reactionToCreate === null || reactionToCreate === void 0 ? void 0 : reactionToCreate.message_id,
|
|
236
|
+
emojiType: reactionToCreate === null || reactionToCreate === void 0 ? void 0 : reactionToCreate.emoji_type,
|
|
237
|
+
emojiID: reactionToCreate === null || reactionToCreate === void 0 ? void 0 : reactionToCreate.emoji_id
|
|
238
238
|
},
|
|
239
239
|
params: options
|
|
240
240
|
};
|
|
@@ -246,8 +246,8 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
246
246
|
var Guild = /*#__PURE__*/function () {
|
|
247
247
|
function Guild(request, config) {
|
|
248
248
|
_classCallCheck(this, Guild);
|
|
249
|
-
_defineProperty(this, "request",
|
|
250
|
-
_defineProperty(this, "config",
|
|
249
|
+
_defineProperty(this, "request", void 0);
|
|
250
|
+
_defineProperty(this, "config", void 0);
|
|
251
251
|
this.request = request;
|
|
252
252
|
this.config = config;
|
|
253
253
|
}
|
|
@@ -360,7 +360,7 @@ function _asyncToGenerator(n) {
|
|
|
360
360
|
function _throw(n) {
|
|
361
361
|
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
362
362
|
}
|
|
363
|
-
_next(
|
|
363
|
+
_next(void 0);
|
|
364
364
|
});
|
|
365
365
|
};
|
|
366
366
|
}
|
|
@@ -600,7 +600,7 @@ function requireRegeneratorRuntime () {
|
|
|
600
600
|
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
601
601
|
return this;
|
|
602
602
|
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
603
|
-
|
|
603
|
+
void 0 === i && (i = Promise);
|
|
604
604
|
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
605
605
|
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
606
606
|
return t.done ? t.value : a.next();
|
|
@@ -733,7 +733,7 @@ function requireRegenerator () {
|
|
|
733
733
|
var regeneratorExports = requireRegenerator();
|
|
734
734
|
var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regeneratorExports);
|
|
735
735
|
|
|
736
|
-
var version = "3.4.
|
|
736
|
+
var version = "3.4.5";
|
|
737
737
|
|
|
738
738
|
var loglevel$1 = {exports: {}};
|
|
739
739
|
|
|
@@ -1266,8 +1266,8 @@ var buildUrl = function buildUrl() {
|
|
|
1266
1266
|
var Channel = /*#__PURE__*/function () {
|
|
1267
1267
|
function Channel(request, config) {
|
|
1268
1268
|
_classCallCheck(this, Channel);
|
|
1269
|
-
_defineProperty(this, "request",
|
|
1270
|
-
_defineProperty(this, "config",
|
|
1269
|
+
_defineProperty(this, "request", void 0);
|
|
1270
|
+
_defineProperty(this, "config", void 0);
|
|
1271
1271
|
this.request = request;
|
|
1272
1272
|
this.config = config;
|
|
1273
1273
|
}
|
|
@@ -1355,8 +1355,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1355
1355
|
var Me = /*#__PURE__*/function () {
|
|
1356
1356
|
function Me(request, config) {
|
|
1357
1357
|
_classCallCheck(this, Me);
|
|
1358
|
-
_defineProperty(this, "request",
|
|
1359
|
-
_defineProperty(this, "config",
|
|
1358
|
+
_defineProperty(this, "request", void 0);
|
|
1359
|
+
_defineProperty(this, "config", void 0);
|
|
1360
1360
|
this.request = request;
|
|
1361
1361
|
this.config = config;
|
|
1362
1362
|
}
|
|
@@ -1389,8 +1389,8 @@ var Me = /*#__PURE__*/function () {
|
|
|
1389
1389
|
var Message = /*#__PURE__*/function () {
|
|
1390
1390
|
function Message(request, config) {
|
|
1391
1391
|
_classCallCheck(this, Message);
|
|
1392
|
-
_defineProperty(this, "request",
|
|
1393
|
-
_defineProperty(this, "config",
|
|
1392
|
+
_defineProperty(this, "request", void 0);
|
|
1393
|
+
_defineProperty(this, "config", void 0);
|
|
1394
1394
|
this.request = request;
|
|
1395
1395
|
this.config = config;
|
|
1396
1396
|
}
|
|
@@ -1592,8 +1592,8 @@ var Message = /*#__PURE__*/function () {
|
|
|
1592
1592
|
var Member = /*#__PURE__*/function () {
|
|
1593
1593
|
function Member(request, config) {
|
|
1594
1594
|
_classCallCheck(this, Member);
|
|
1595
|
-
_defineProperty(this, "request",
|
|
1596
|
-
_defineProperty(this, "config",
|
|
1595
|
+
_defineProperty(this, "request", void 0);
|
|
1596
|
+
_defineProperty(this, "config", void 0);
|
|
1597
1597
|
this.request = request;
|
|
1598
1598
|
this.config = config;
|
|
1599
1599
|
}
|
|
@@ -1678,8 +1678,8 @@ var defaultColor = 4278245297;
|
|
|
1678
1678
|
var Role = /*#__PURE__*/function () {
|
|
1679
1679
|
function Role(request, config) {
|
|
1680
1680
|
_classCallCheck(this, Role);
|
|
1681
|
-
_defineProperty(this, "request",
|
|
1682
|
-
_defineProperty(this, "config",
|
|
1681
|
+
_defineProperty(this, "request", void 0);
|
|
1682
|
+
_defineProperty(this, "config", void 0);
|
|
1683
1683
|
this.request = request;
|
|
1684
1684
|
this.config = config;
|
|
1685
1685
|
}
|
|
@@ -1765,8 +1765,8 @@ var Role = /*#__PURE__*/function () {
|
|
|
1765
1765
|
var DirectMessage = /*#__PURE__*/function () {
|
|
1766
1766
|
function DirectMessage(request, config) {
|
|
1767
1767
|
_classCallCheck(this, DirectMessage);
|
|
1768
|
-
_defineProperty(this, "request",
|
|
1769
|
-
_defineProperty(this, "config",
|
|
1768
|
+
_defineProperty(this, "request", void 0);
|
|
1769
|
+
_defineProperty(this, "config", void 0);
|
|
1770
1770
|
this.request = request;
|
|
1771
1771
|
this.config = config;
|
|
1772
1772
|
}
|
|
@@ -1803,8 +1803,8 @@ var DirectMessage = /*#__PURE__*/function () {
|
|
|
1803
1803
|
var ChannelPermissions = /*#__PURE__*/function () {
|
|
1804
1804
|
function ChannelPermissions(request, config) {
|
|
1805
1805
|
_classCallCheck(this, ChannelPermissions);
|
|
1806
|
-
_defineProperty(this, "request",
|
|
1807
|
-
_defineProperty(this, "config",
|
|
1806
|
+
_defineProperty(this, "request", void 0);
|
|
1807
|
+
_defineProperty(this, "config", void 0);
|
|
1808
1808
|
this.request = request;
|
|
1809
1809
|
this.config = config;
|
|
1810
1810
|
}
|
|
@@ -1890,8 +1890,8 @@ var ChannelPermissions = /*#__PURE__*/function () {
|
|
|
1890
1890
|
var Audio = /*#__PURE__*/function () {
|
|
1891
1891
|
function Audio(request, config) {
|
|
1892
1892
|
_classCallCheck(this, Audio);
|
|
1893
|
-
_defineProperty(this, "request",
|
|
1894
|
-
_defineProperty(this, "config",
|
|
1893
|
+
_defineProperty(this, "request", void 0);
|
|
1894
|
+
_defineProperty(this, "config", void 0);
|
|
1895
1895
|
this.request = request;
|
|
1896
1896
|
this.config = config;
|
|
1897
1897
|
}
|
|
@@ -1948,8 +1948,8 @@ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t
|
|
|
1948
1948
|
var Mute = /*#__PURE__*/function () {
|
|
1949
1949
|
function Mute(request, config) {
|
|
1950
1950
|
_classCallCheck(this, Mute);
|
|
1951
|
-
_defineProperty(this, "request",
|
|
1952
|
-
_defineProperty(this, "config",
|
|
1951
|
+
_defineProperty(this, "request", void 0);
|
|
1952
|
+
_defineProperty(this, "config", void 0);
|
|
1953
1953
|
this.request = request;
|
|
1954
1954
|
this.config = config;
|
|
1955
1955
|
}
|
|
@@ -2017,8 +2017,8 @@ var Mute = /*#__PURE__*/function () {
|
|
|
2017
2017
|
var Announce = /*#__PURE__*/function () {
|
|
2018
2018
|
function Announce(request, config) {
|
|
2019
2019
|
_classCallCheck(this, Announce);
|
|
2020
|
-
_defineProperty(this, "request",
|
|
2021
|
-
_defineProperty(this, "config",
|
|
2020
|
+
_defineProperty(this, "request", void 0);
|
|
2021
|
+
_defineProperty(this, "config", void 0);
|
|
2022
2022
|
this.request = request;
|
|
2023
2023
|
this.config = config;
|
|
2024
2024
|
}
|
|
@@ -2108,8 +2108,8 @@ var Announce = /*#__PURE__*/function () {
|
|
|
2108
2108
|
var Schedule = /*#__PURE__*/function () {
|
|
2109
2109
|
function Schedule(request, config) {
|
|
2110
2110
|
_classCallCheck(this, Schedule);
|
|
2111
|
-
_defineProperty(this, "request",
|
|
2112
|
-
_defineProperty(this, "config",
|
|
2111
|
+
_defineProperty(this, "request", void 0);
|
|
2112
|
+
_defineProperty(this, "config", void 0);
|
|
2113
2113
|
this.request = request;
|
|
2114
2114
|
this.config = config;
|
|
2115
2115
|
}
|
|
@@ -2204,8 +2204,8 @@ var Schedule = /*#__PURE__*/function () {
|
|
|
2204
2204
|
var Threads = /*#__PURE__*/function () {
|
|
2205
2205
|
function Threads(request, config) {
|
|
2206
2206
|
_classCallCheck(this, Threads);
|
|
2207
|
-
_defineProperty(this, "request",
|
|
2208
|
-
_defineProperty(this, "config",
|
|
2207
|
+
_defineProperty(this, "request", void 0);
|
|
2208
|
+
_defineProperty(this, "config", void 0);
|
|
2209
2209
|
this.request = request;
|
|
2210
2210
|
this.config = config;
|
|
2211
2211
|
}
|
|
@@ -2276,8 +2276,8 @@ var Threads = /*#__PURE__*/function () {
|
|
|
2276
2276
|
var GuildPermissions = /*#__PURE__*/function () {
|
|
2277
2277
|
function GuildPermissions(request, config) {
|
|
2278
2278
|
_classCallCheck(this, GuildPermissions);
|
|
2279
|
-
_defineProperty(this, "request",
|
|
2280
|
-
_defineProperty(this, "config",
|
|
2279
|
+
_defineProperty(this, "request", void 0);
|
|
2280
|
+
_defineProperty(this, "config", void 0);
|
|
2281
2281
|
this.request = request;
|
|
2282
2282
|
this.config = config;
|
|
2283
2283
|
}
|
|
@@ -2316,8 +2316,8 @@ var GuildPermissions = /*#__PURE__*/function () {
|
|
|
2316
2316
|
var Interaction = /*#__PURE__*/function () {
|
|
2317
2317
|
function Interaction(request, config) {
|
|
2318
2318
|
_classCallCheck(this, Interaction);
|
|
2319
|
-
_defineProperty(this, "request",
|
|
2320
|
-
_defineProperty(this, "config",
|
|
2319
|
+
_defineProperty(this, "request", void 0);
|
|
2320
|
+
_defineProperty(this, "config", void 0);
|
|
2321
2321
|
this.request = request;
|
|
2322
2322
|
this.config = config;
|
|
2323
2323
|
}
|
|
@@ -2352,23 +2352,23 @@ var OpenAPI = /*#__PURE__*/function () {
|
|
|
2352
2352
|
appID: '',
|
|
2353
2353
|
token: ''
|
|
2354
2354
|
});
|
|
2355
|
-
_defineProperty(this, "guildApi",
|
|
2356
|
-
_defineProperty(this, "channelApi",
|
|
2357
|
-
_defineProperty(this, "meApi",
|
|
2358
|
-
_defineProperty(this, "messageApi",
|
|
2359
|
-
_defineProperty(this, "memberApi",
|
|
2360
|
-
_defineProperty(this, "roleApi",
|
|
2361
|
-
_defineProperty(this, "muteApi",
|
|
2362
|
-
_defineProperty(this, "announceApi",
|
|
2363
|
-
_defineProperty(this, "scheduleApi",
|
|
2364
|
-
_defineProperty(this, "threadsApi",
|
|
2365
|
-
_defineProperty(this, "directMessageApi",
|
|
2366
|
-
_defineProperty(this, "channelPermissionsApi",
|
|
2367
|
-
_defineProperty(this, "audioApi",
|
|
2368
|
-
_defineProperty(this, "reactionApi",
|
|
2369
|
-
_defineProperty(this, "interactionApi",
|
|
2370
|
-
_defineProperty(this, "pinsMessageApi",
|
|
2371
|
-
_defineProperty(this, "guildPermissionsApi",
|
|
2355
|
+
_defineProperty(this, "guildApi", void 0);
|
|
2356
|
+
_defineProperty(this, "channelApi", void 0);
|
|
2357
|
+
_defineProperty(this, "meApi", void 0);
|
|
2358
|
+
_defineProperty(this, "messageApi", void 0);
|
|
2359
|
+
_defineProperty(this, "memberApi", void 0);
|
|
2360
|
+
_defineProperty(this, "roleApi", void 0);
|
|
2361
|
+
_defineProperty(this, "muteApi", void 0);
|
|
2362
|
+
_defineProperty(this, "announceApi", void 0);
|
|
2363
|
+
_defineProperty(this, "scheduleApi", void 0);
|
|
2364
|
+
_defineProperty(this, "threadsApi", void 0);
|
|
2365
|
+
_defineProperty(this, "directMessageApi", void 0);
|
|
2366
|
+
_defineProperty(this, "channelPermissionsApi", void 0);
|
|
2367
|
+
_defineProperty(this, "audioApi", void 0);
|
|
2368
|
+
_defineProperty(this, "reactionApi", void 0);
|
|
2369
|
+
_defineProperty(this, "interactionApi", void 0);
|
|
2370
|
+
_defineProperty(this, "pinsMessageApi", void 0);
|
|
2371
|
+
_defineProperty(this, "guildPermissionsApi", void 0);
|
|
2372
2372
|
this.config = config;
|
|
2373
2373
|
this.register(this);
|
|
2374
2374
|
}
|
|
@@ -2417,13 +2417,13 @@ var OpenAPI = /*#__PURE__*/function () {
|
|
|
2417
2417
|
return result;
|
|
2418
2418
|
}, function (error) {
|
|
2419
2419
|
var _error$response, _error$response2;
|
|
2420
|
-
var traceid = error === null || error ===
|
|
2421
|
-
if (error !== null && error !==
|
|
2420
|
+
var traceid = error === null || error === void 0 || (_error$response = error.response) === null || _error$response === void 0 || (_error$response = _error$response.headers) === null || _error$response === void 0 ? void 0 : _error$response['x-tps-trace-id'];
|
|
2421
|
+
if (error !== null && error !== void 0 && (_error$response2 = error.response) !== null && _error$response2 !== void 0 && _error$response2.data) {
|
|
2422
2422
|
return Promise.reject(_objectSpread(_objectSpread({}, error.response.data), {}, {
|
|
2423
2423
|
traceid: traceid
|
|
2424
2424
|
}));
|
|
2425
2425
|
}
|
|
2426
|
-
if (error !== null && error !==
|
|
2426
|
+
if (error !== null && error !== void 0 && error.response) {
|
|
2427
2427
|
return Promise.reject(_objectSpread(_objectSpread({}, error.response), {}, {
|
|
2428
2428
|
traceid: traceid
|
|
2429
2429
|
}));
|
|
@@ -2445,13 +2445,13 @@ function v1Setup() {
|
|
|
2445
2445
|
}
|
|
2446
2446
|
|
|
2447
2447
|
function _assertThisInitialized(e) {
|
|
2448
|
-
if (
|
|
2448
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
2449
2449
|
return e;
|
|
2450
2450
|
}
|
|
2451
2451
|
|
|
2452
2452
|
function _possibleConstructorReturn(t, e) {
|
|
2453
2453
|
if (e && ("object" == _typeof$1(e) || "function" == typeof e)) return e;
|
|
2454
|
-
if (
|
|
2454
|
+
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
2455
2455
|
return _assertThisInitialized(t);
|
|
2456
2456
|
}
|
|
2457
2457
|
|
|
@@ -2813,17 +2813,17 @@ var Properties = {
|
|
|
2813
2813
|
var Ws = /*#__PURE__*/function () {
|
|
2814
2814
|
function Ws(config, event, sessionRecord) {
|
|
2815
2815
|
_classCallCheck(this, Ws);
|
|
2816
|
-
_defineProperty(this, "ws",
|
|
2817
|
-
_defineProperty(this, "event",
|
|
2818
|
-
_defineProperty(this, "config",
|
|
2819
|
-
_defineProperty(this, "heartbeatInterval",
|
|
2816
|
+
_defineProperty(this, "ws", void 0);
|
|
2817
|
+
_defineProperty(this, "event", void 0);
|
|
2818
|
+
_defineProperty(this, "config", void 0);
|
|
2819
|
+
_defineProperty(this, "heartbeatInterval", void 0);
|
|
2820
2820
|
// 心跳参数,默认为心跳测试
|
|
2821
2821
|
_defineProperty(this, "heartbeatParam", {
|
|
2822
2822
|
op: OpCode.HEARTBEAT,
|
|
2823
2823
|
d: null // 心跳唯一值
|
|
2824
2824
|
});
|
|
2825
2825
|
// 是否是断线重连,如果是断线重连的话,不需要走鉴权
|
|
2826
|
-
_defineProperty(this, "isReconnect",
|
|
2826
|
+
_defineProperty(this, "isReconnect", void 0);
|
|
2827
2827
|
// 记录会话参数
|
|
2828
2828
|
_defineProperty(this, "sessionRecord", {
|
|
2829
2829
|
sessionID: '',
|
|
@@ -2869,10 +2869,10 @@ var Ws = /*#__PURE__*/function () {
|
|
|
2869
2869
|
// 先将消息解析
|
|
2870
2870
|
var wsRes = toObject(data);
|
|
2871
2871
|
// 先判断websocket连接是否成功
|
|
2872
|
-
if ((wsRes === null || wsRes ===
|
|
2872
|
+
if ((wsRes === null || wsRes === void 0 ? void 0 : wsRes.op) === OpCode.HELLO && wsRes !== null && wsRes !== void 0 && (_wsRes$d = wsRes.d) !== null && _wsRes$d !== void 0 && _wsRes$d.heartbeat_interval) {
|
|
2873
2873
|
var _wsRes$d2;
|
|
2874
2874
|
// websocket连接成功,拿到心跳周期
|
|
2875
|
-
_this.heartbeatInterval = wsRes === null || wsRes ===
|
|
2875
|
+
_this.heartbeatInterval = wsRes === null || wsRes === void 0 || (_wsRes$d2 = wsRes.d) === null || _wsRes$d2 === void 0 ? void 0 : _wsRes$d2.heartbeat_interval;
|
|
2876
2876
|
// 非断线重连时,需要鉴权
|
|
2877
2877
|
_this.isReconnect ? _this.reconnectWs() : _this.authWs();
|
|
2878
2878
|
return;
|
|
@@ -3140,11 +3140,11 @@ var Ws = /*#__PURE__*/function () {
|
|
|
3140
3140
|
var Session = /*#__PURE__*/function () {
|
|
3141
3141
|
function Session(config, event, sessionRecord) {
|
|
3142
3142
|
_classCallCheck(this, Session);
|
|
3143
|
-
_defineProperty(this, "config",
|
|
3144
|
-
_defineProperty(this, "heartbeatInterval",
|
|
3145
|
-
_defineProperty(this, "ws",
|
|
3146
|
-
_defineProperty(this, "event",
|
|
3147
|
-
_defineProperty(this, "sessionRecord",
|
|
3143
|
+
_defineProperty(this, "config", void 0);
|
|
3144
|
+
_defineProperty(this, "heartbeatInterval", void 0);
|
|
3145
|
+
_defineProperty(this, "ws", void 0);
|
|
3146
|
+
_defineProperty(this, "event", void 0);
|
|
3147
|
+
_defineProperty(this, "sessionRecord", void 0);
|
|
3148
3148
|
this.config = config;
|
|
3149
3149
|
this.event = event;
|
|
3150
3150
|
// 如果会话记录存在的话,继续透传
|
|
@@ -3193,7 +3193,7 @@ var WebsocketClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
3193
3193
|
var _this;
|
|
3194
3194
|
_classCallCheck(this, WebsocketClient);
|
|
3195
3195
|
_this = _callSuper(this, WebsocketClient);
|
|
3196
|
-
_defineProperty(_this, "session",
|
|
3196
|
+
_defineProperty(_this, "session", void 0);
|
|
3197
3197
|
_defineProperty(_this, "retry", 0);
|
|
3198
3198
|
_this.connect(config);
|
|
3199
3199
|
_this.on(SessionEvents.EVENT_WS, function (data) {
|
|
@@ -3207,7 +3207,7 @@ var WebsocketClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
3207
3207
|
BotLogger.info('[CLIENT] 重新连接中,尝试次数:', _this.retry + 1);
|
|
3208
3208
|
_this.connect(config, (_WebsocketCloseReason = WebsocketCloseReason.find(function (v) {
|
|
3209
3209
|
return v.code === data.code;
|
|
3210
|
-
})) !== null && _WebsocketCloseReason !==
|
|
3210
|
+
})) !== null && _WebsocketCloseReason !== void 0 && _WebsocketCloseReason.resume ? data.eventMsg : null);
|
|
3211
3211
|
_this.retry += 1;
|
|
3212
3212
|
} else {
|
|
3213
3213
|
BotLogger.info('[CLIENT] 超过重试次数,连接终止');
|
package/lib/index.js
CHANGED
|
@@ -22,12 +22,12 @@ function _typeof$1(o) {
|
|
|
22
22
|
function toPrimitive(t, r) {
|
|
23
23
|
if ("object" != _typeof$1(t) || !t) return t;
|
|
24
24
|
var e = t[Symbol.toPrimitive];
|
|
25
|
-
if (
|
|
26
|
-
var i = e.call(t, r
|
|
25
|
+
if (void 0 !== e) {
|
|
26
|
+
var i = e.call(t, r);
|
|
27
27
|
if ("object" != _typeof$1(i)) return i;
|
|
28
28
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
29
29
|
}
|
|
30
|
-
return (
|
|
30
|
+
return (String )(t);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
function toPropertyKey(t) {
|
|
@@ -124,8 +124,8 @@ var getURL = function getURL(endpoint) {
|
|
|
124
124
|
var PinsMessage = /*#__PURE__*/function () {
|
|
125
125
|
function PinsMessage(request, config) {
|
|
126
126
|
_classCallCheck(this, PinsMessage);
|
|
127
|
-
_defineProperty(this, "request",
|
|
128
|
-
_defineProperty(this, "config",
|
|
127
|
+
_defineProperty(this, "request", void 0);
|
|
128
|
+
_defineProperty(this, "config", void 0);
|
|
129
129
|
this.request = request;
|
|
130
130
|
this.config = config;
|
|
131
131
|
}
|
|
@@ -182,8 +182,8 @@ var PinsMessage = /*#__PURE__*/function () {
|
|
|
182
182
|
var Reaction = /*#__PURE__*/function () {
|
|
183
183
|
function Reaction(request, config) {
|
|
184
184
|
_classCallCheck(this, Reaction);
|
|
185
|
-
_defineProperty(this, "request",
|
|
186
|
-
_defineProperty(this, "config",
|
|
185
|
+
_defineProperty(this, "request", void 0);
|
|
186
|
+
_defineProperty(this, "config", void 0);
|
|
187
187
|
this.request = request;
|
|
188
188
|
this.config = config;
|
|
189
189
|
}
|
|
@@ -197,9 +197,9 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
197
197
|
url: getURL('reactionURI'),
|
|
198
198
|
rest: {
|
|
199
199
|
channelID: channelId,
|
|
200
|
-
messageID: reactionToCreate === null || reactionToCreate ===
|
|
201
|
-
emojiType: reactionToCreate === null || reactionToCreate ===
|
|
202
|
-
emojiID: reactionToCreate === null || reactionToCreate ===
|
|
200
|
+
messageID: reactionToCreate === null || reactionToCreate === void 0 ? void 0 : reactionToCreate.message_id,
|
|
201
|
+
emojiType: reactionToCreate === null || reactionToCreate === void 0 ? void 0 : reactionToCreate.emoji_type,
|
|
202
|
+
emojiID: reactionToCreate === null || reactionToCreate === void 0 ? void 0 : reactionToCreate.emoji_id
|
|
203
203
|
}
|
|
204
204
|
};
|
|
205
205
|
return this.request(options);
|
|
@@ -214,9 +214,9 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
214
214
|
url: getURL('reactionURI'),
|
|
215
215
|
rest: {
|
|
216
216
|
channelID: channelId,
|
|
217
|
-
messageID: reactionToDelete === null || reactionToDelete ===
|
|
218
|
-
emojiType: reactionToDelete === null || reactionToDelete ===
|
|
219
|
-
emojiID: reactionToDelete === null || reactionToDelete ===
|
|
217
|
+
messageID: reactionToDelete === null || reactionToDelete === void 0 ? void 0 : reactionToDelete.message_id,
|
|
218
|
+
emojiType: reactionToDelete === null || reactionToDelete === void 0 ? void 0 : reactionToDelete.emoji_type,
|
|
219
|
+
emojiID: reactionToDelete === null || reactionToDelete === void 0 ? void 0 : reactionToDelete.emoji_id
|
|
220
220
|
}
|
|
221
221
|
};
|
|
222
222
|
return this.request(options);
|
|
@@ -234,9 +234,9 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
234
234
|
url: getURL('reactionURI'),
|
|
235
235
|
rest: {
|
|
236
236
|
channelID: channelId,
|
|
237
|
-
messageID: reactionToCreate === null || reactionToCreate ===
|
|
238
|
-
emojiType: reactionToCreate === null || reactionToCreate ===
|
|
239
|
-
emojiID: reactionToCreate === null || reactionToCreate ===
|
|
237
|
+
messageID: reactionToCreate === null || reactionToCreate === void 0 ? void 0 : reactionToCreate.message_id,
|
|
238
|
+
emojiType: reactionToCreate === null || reactionToCreate === void 0 ? void 0 : reactionToCreate.emoji_type,
|
|
239
|
+
emojiID: reactionToCreate === null || reactionToCreate === void 0 ? void 0 : reactionToCreate.emoji_id
|
|
240
240
|
},
|
|
241
241
|
params: options
|
|
242
242
|
};
|
|
@@ -248,8 +248,8 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
248
248
|
var Guild = /*#__PURE__*/function () {
|
|
249
249
|
function Guild(request, config) {
|
|
250
250
|
_classCallCheck(this, Guild);
|
|
251
|
-
_defineProperty(this, "request",
|
|
252
|
-
_defineProperty(this, "config",
|
|
251
|
+
_defineProperty(this, "request", void 0);
|
|
252
|
+
_defineProperty(this, "config", void 0);
|
|
253
253
|
this.request = request;
|
|
254
254
|
this.config = config;
|
|
255
255
|
}
|
|
@@ -362,7 +362,7 @@ function _asyncToGenerator(n) {
|
|
|
362
362
|
function _throw(n) {
|
|
363
363
|
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
364
364
|
}
|
|
365
|
-
_next(
|
|
365
|
+
_next(void 0);
|
|
366
366
|
});
|
|
367
367
|
};
|
|
368
368
|
}
|
|
@@ -602,7 +602,7 @@ function requireRegeneratorRuntime () {
|
|
|
602
602
|
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
603
603
|
return this;
|
|
604
604
|
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
605
|
-
|
|
605
|
+
void 0 === i && (i = Promise);
|
|
606
606
|
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
607
607
|
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
608
608
|
return t.done ? t.value : a.next();
|
|
@@ -735,7 +735,7 @@ function requireRegenerator () {
|
|
|
735
735
|
var regeneratorExports = requireRegenerator();
|
|
736
736
|
var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regeneratorExports);
|
|
737
737
|
|
|
738
|
-
var version = "3.4.
|
|
738
|
+
var version = "3.4.5";
|
|
739
739
|
|
|
740
740
|
var loglevel$1 = {exports: {}};
|
|
741
741
|
|
|
@@ -1268,8 +1268,8 @@ var buildUrl = function buildUrl() {
|
|
|
1268
1268
|
var Channel = /*#__PURE__*/function () {
|
|
1269
1269
|
function Channel(request, config) {
|
|
1270
1270
|
_classCallCheck(this, Channel);
|
|
1271
|
-
_defineProperty(this, "request",
|
|
1272
|
-
_defineProperty(this, "config",
|
|
1271
|
+
_defineProperty(this, "request", void 0);
|
|
1272
|
+
_defineProperty(this, "config", void 0);
|
|
1273
1273
|
this.request = request;
|
|
1274
1274
|
this.config = config;
|
|
1275
1275
|
}
|
|
@@ -1357,8 +1357,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1357
1357
|
var Me = /*#__PURE__*/function () {
|
|
1358
1358
|
function Me(request, config) {
|
|
1359
1359
|
_classCallCheck(this, Me);
|
|
1360
|
-
_defineProperty(this, "request",
|
|
1361
|
-
_defineProperty(this, "config",
|
|
1360
|
+
_defineProperty(this, "request", void 0);
|
|
1361
|
+
_defineProperty(this, "config", void 0);
|
|
1362
1362
|
this.request = request;
|
|
1363
1363
|
this.config = config;
|
|
1364
1364
|
}
|
|
@@ -1391,8 +1391,8 @@ var Me = /*#__PURE__*/function () {
|
|
|
1391
1391
|
var Message = /*#__PURE__*/function () {
|
|
1392
1392
|
function Message(request, config) {
|
|
1393
1393
|
_classCallCheck(this, Message);
|
|
1394
|
-
_defineProperty(this, "request",
|
|
1395
|
-
_defineProperty(this, "config",
|
|
1394
|
+
_defineProperty(this, "request", void 0);
|
|
1395
|
+
_defineProperty(this, "config", void 0);
|
|
1396
1396
|
this.request = request;
|
|
1397
1397
|
this.config = config;
|
|
1398
1398
|
}
|
|
@@ -1594,8 +1594,8 @@ var Message = /*#__PURE__*/function () {
|
|
|
1594
1594
|
var Member = /*#__PURE__*/function () {
|
|
1595
1595
|
function Member(request, config) {
|
|
1596
1596
|
_classCallCheck(this, Member);
|
|
1597
|
-
_defineProperty(this, "request",
|
|
1598
|
-
_defineProperty(this, "config",
|
|
1597
|
+
_defineProperty(this, "request", void 0);
|
|
1598
|
+
_defineProperty(this, "config", void 0);
|
|
1599
1599
|
this.request = request;
|
|
1600
1600
|
this.config = config;
|
|
1601
1601
|
}
|
|
@@ -1680,8 +1680,8 @@ var defaultColor = 4278245297;
|
|
|
1680
1680
|
var Role = /*#__PURE__*/function () {
|
|
1681
1681
|
function Role(request, config) {
|
|
1682
1682
|
_classCallCheck(this, Role);
|
|
1683
|
-
_defineProperty(this, "request",
|
|
1684
|
-
_defineProperty(this, "config",
|
|
1683
|
+
_defineProperty(this, "request", void 0);
|
|
1684
|
+
_defineProperty(this, "config", void 0);
|
|
1685
1685
|
this.request = request;
|
|
1686
1686
|
this.config = config;
|
|
1687
1687
|
}
|
|
@@ -1767,8 +1767,8 @@ var Role = /*#__PURE__*/function () {
|
|
|
1767
1767
|
var DirectMessage = /*#__PURE__*/function () {
|
|
1768
1768
|
function DirectMessage(request, config) {
|
|
1769
1769
|
_classCallCheck(this, DirectMessage);
|
|
1770
|
-
_defineProperty(this, "request",
|
|
1771
|
-
_defineProperty(this, "config",
|
|
1770
|
+
_defineProperty(this, "request", void 0);
|
|
1771
|
+
_defineProperty(this, "config", void 0);
|
|
1772
1772
|
this.request = request;
|
|
1773
1773
|
this.config = config;
|
|
1774
1774
|
}
|
|
@@ -1805,8 +1805,8 @@ var DirectMessage = /*#__PURE__*/function () {
|
|
|
1805
1805
|
var ChannelPermissions = /*#__PURE__*/function () {
|
|
1806
1806
|
function ChannelPermissions(request, config) {
|
|
1807
1807
|
_classCallCheck(this, ChannelPermissions);
|
|
1808
|
-
_defineProperty(this, "request",
|
|
1809
|
-
_defineProperty(this, "config",
|
|
1808
|
+
_defineProperty(this, "request", void 0);
|
|
1809
|
+
_defineProperty(this, "config", void 0);
|
|
1810
1810
|
this.request = request;
|
|
1811
1811
|
this.config = config;
|
|
1812
1812
|
}
|
|
@@ -1892,8 +1892,8 @@ var ChannelPermissions = /*#__PURE__*/function () {
|
|
|
1892
1892
|
var Audio = /*#__PURE__*/function () {
|
|
1893
1893
|
function Audio(request, config) {
|
|
1894
1894
|
_classCallCheck(this, Audio);
|
|
1895
|
-
_defineProperty(this, "request",
|
|
1896
|
-
_defineProperty(this, "config",
|
|
1895
|
+
_defineProperty(this, "request", void 0);
|
|
1896
|
+
_defineProperty(this, "config", void 0);
|
|
1897
1897
|
this.request = request;
|
|
1898
1898
|
this.config = config;
|
|
1899
1899
|
}
|
|
@@ -1950,8 +1950,8 @@ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t
|
|
|
1950
1950
|
var Mute = /*#__PURE__*/function () {
|
|
1951
1951
|
function Mute(request, config) {
|
|
1952
1952
|
_classCallCheck(this, Mute);
|
|
1953
|
-
_defineProperty(this, "request",
|
|
1954
|
-
_defineProperty(this, "config",
|
|
1953
|
+
_defineProperty(this, "request", void 0);
|
|
1954
|
+
_defineProperty(this, "config", void 0);
|
|
1955
1955
|
this.request = request;
|
|
1956
1956
|
this.config = config;
|
|
1957
1957
|
}
|
|
@@ -2019,8 +2019,8 @@ var Mute = /*#__PURE__*/function () {
|
|
|
2019
2019
|
var Announce = /*#__PURE__*/function () {
|
|
2020
2020
|
function Announce(request, config) {
|
|
2021
2021
|
_classCallCheck(this, Announce);
|
|
2022
|
-
_defineProperty(this, "request",
|
|
2023
|
-
_defineProperty(this, "config",
|
|
2022
|
+
_defineProperty(this, "request", void 0);
|
|
2023
|
+
_defineProperty(this, "config", void 0);
|
|
2024
2024
|
this.request = request;
|
|
2025
2025
|
this.config = config;
|
|
2026
2026
|
}
|
|
@@ -2110,8 +2110,8 @@ var Announce = /*#__PURE__*/function () {
|
|
|
2110
2110
|
var Schedule = /*#__PURE__*/function () {
|
|
2111
2111
|
function Schedule(request, config) {
|
|
2112
2112
|
_classCallCheck(this, Schedule);
|
|
2113
|
-
_defineProperty(this, "request",
|
|
2114
|
-
_defineProperty(this, "config",
|
|
2113
|
+
_defineProperty(this, "request", void 0);
|
|
2114
|
+
_defineProperty(this, "config", void 0);
|
|
2115
2115
|
this.request = request;
|
|
2116
2116
|
this.config = config;
|
|
2117
2117
|
}
|
|
@@ -2206,8 +2206,8 @@ var Schedule = /*#__PURE__*/function () {
|
|
|
2206
2206
|
var Threads = /*#__PURE__*/function () {
|
|
2207
2207
|
function Threads(request, config) {
|
|
2208
2208
|
_classCallCheck(this, Threads);
|
|
2209
|
-
_defineProperty(this, "request",
|
|
2210
|
-
_defineProperty(this, "config",
|
|
2209
|
+
_defineProperty(this, "request", void 0);
|
|
2210
|
+
_defineProperty(this, "config", void 0);
|
|
2211
2211
|
this.request = request;
|
|
2212
2212
|
this.config = config;
|
|
2213
2213
|
}
|
|
@@ -2278,8 +2278,8 @@ var Threads = /*#__PURE__*/function () {
|
|
|
2278
2278
|
var GuildPermissions = /*#__PURE__*/function () {
|
|
2279
2279
|
function GuildPermissions(request, config) {
|
|
2280
2280
|
_classCallCheck(this, GuildPermissions);
|
|
2281
|
-
_defineProperty(this, "request",
|
|
2282
|
-
_defineProperty(this, "config",
|
|
2281
|
+
_defineProperty(this, "request", void 0);
|
|
2282
|
+
_defineProperty(this, "config", void 0);
|
|
2283
2283
|
this.request = request;
|
|
2284
2284
|
this.config = config;
|
|
2285
2285
|
}
|
|
@@ -2318,8 +2318,8 @@ var GuildPermissions = /*#__PURE__*/function () {
|
|
|
2318
2318
|
var Interaction = /*#__PURE__*/function () {
|
|
2319
2319
|
function Interaction(request, config) {
|
|
2320
2320
|
_classCallCheck(this, Interaction);
|
|
2321
|
-
_defineProperty(this, "request",
|
|
2322
|
-
_defineProperty(this, "config",
|
|
2321
|
+
_defineProperty(this, "request", void 0);
|
|
2322
|
+
_defineProperty(this, "config", void 0);
|
|
2323
2323
|
this.request = request;
|
|
2324
2324
|
this.config = config;
|
|
2325
2325
|
}
|
|
@@ -2354,23 +2354,23 @@ var OpenAPI = /*#__PURE__*/function () {
|
|
|
2354
2354
|
appID: '',
|
|
2355
2355
|
token: ''
|
|
2356
2356
|
});
|
|
2357
|
-
_defineProperty(this, "guildApi",
|
|
2358
|
-
_defineProperty(this, "channelApi",
|
|
2359
|
-
_defineProperty(this, "meApi",
|
|
2360
|
-
_defineProperty(this, "messageApi",
|
|
2361
|
-
_defineProperty(this, "memberApi",
|
|
2362
|
-
_defineProperty(this, "roleApi",
|
|
2363
|
-
_defineProperty(this, "muteApi",
|
|
2364
|
-
_defineProperty(this, "announceApi",
|
|
2365
|
-
_defineProperty(this, "scheduleApi",
|
|
2366
|
-
_defineProperty(this, "threadsApi",
|
|
2367
|
-
_defineProperty(this, "directMessageApi",
|
|
2368
|
-
_defineProperty(this, "channelPermissionsApi",
|
|
2369
|
-
_defineProperty(this, "audioApi",
|
|
2370
|
-
_defineProperty(this, "reactionApi",
|
|
2371
|
-
_defineProperty(this, "interactionApi",
|
|
2372
|
-
_defineProperty(this, "pinsMessageApi",
|
|
2373
|
-
_defineProperty(this, "guildPermissionsApi",
|
|
2357
|
+
_defineProperty(this, "guildApi", void 0);
|
|
2358
|
+
_defineProperty(this, "channelApi", void 0);
|
|
2359
|
+
_defineProperty(this, "meApi", void 0);
|
|
2360
|
+
_defineProperty(this, "messageApi", void 0);
|
|
2361
|
+
_defineProperty(this, "memberApi", void 0);
|
|
2362
|
+
_defineProperty(this, "roleApi", void 0);
|
|
2363
|
+
_defineProperty(this, "muteApi", void 0);
|
|
2364
|
+
_defineProperty(this, "announceApi", void 0);
|
|
2365
|
+
_defineProperty(this, "scheduleApi", void 0);
|
|
2366
|
+
_defineProperty(this, "threadsApi", void 0);
|
|
2367
|
+
_defineProperty(this, "directMessageApi", void 0);
|
|
2368
|
+
_defineProperty(this, "channelPermissionsApi", void 0);
|
|
2369
|
+
_defineProperty(this, "audioApi", void 0);
|
|
2370
|
+
_defineProperty(this, "reactionApi", void 0);
|
|
2371
|
+
_defineProperty(this, "interactionApi", void 0);
|
|
2372
|
+
_defineProperty(this, "pinsMessageApi", void 0);
|
|
2373
|
+
_defineProperty(this, "guildPermissionsApi", void 0);
|
|
2374
2374
|
this.config = config;
|
|
2375
2375
|
this.register(this);
|
|
2376
2376
|
}
|
|
@@ -2419,13 +2419,13 @@ var OpenAPI = /*#__PURE__*/function () {
|
|
|
2419
2419
|
return result;
|
|
2420
2420
|
}, function (error) {
|
|
2421
2421
|
var _error$response, _error$response2;
|
|
2422
|
-
var traceid = error === null || error ===
|
|
2423
|
-
if (error !== null && error !==
|
|
2422
|
+
var traceid = error === null || error === void 0 || (_error$response = error.response) === null || _error$response === void 0 || (_error$response = _error$response.headers) === null || _error$response === void 0 ? void 0 : _error$response['x-tps-trace-id'];
|
|
2423
|
+
if (error !== null && error !== void 0 && (_error$response2 = error.response) !== null && _error$response2 !== void 0 && _error$response2.data) {
|
|
2424
2424
|
return Promise.reject(_objectSpread(_objectSpread({}, error.response.data), {}, {
|
|
2425
2425
|
traceid: traceid
|
|
2426
2426
|
}));
|
|
2427
2427
|
}
|
|
2428
|
-
if (error !== null && error !==
|
|
2428
|
+
if (error !== null && error !== void 0 && error.response) {
|
|
2429
2429
|
return Promise.reject(_objectSpread(_objectSpread({}, error.response), {}, {
|
|
2430
2430
|
traceid: traceid
|
|
2431
2431
|
}));
|
|
@@ -2447,13 +2447,13 @@ function v1Setup() {
|
|
|
2447
2447
|
}
|
|
2448
2448
|
|
|
2449
2449
|
function _assertThisInitialized(e) {
|
|
2450
|
-
if (
|
|
2450
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
2451
2451
|
return e;
|
|
2452
2452
|
}
|
|
2453
2453
|
|
|
2454
2454
|
function _possibleConstructorReturn(t, e) {
|
|
2455
2455
|
if (e && ("object" == _typeof$1(e) || "function" == typeof e)) return e;
|
|
2456
|
-
if (
|
|
2456
|
+
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
2457
2457
|
return _assertThisInitialized(t);
|
|
2458
2458
|
}
|
|
2459
2459
|
|
|
@@ -2815,17 +2815,17 @@ var Properties = {
|
|
|
2815
2815
|
var Ws = /*#__PURE__*/function () {
|
|
2816
2816
|
function Ws(config, event, sessionRecord) {
|
|
2817
2817
|
_classCallCheck(this, Ws);
|
|
2818
|
-
_defineProperty(this, "ws",
|
|
2819
|
-
_defineProperty(this, "event",
|
|
2820
|
-
_defineProperty(this, "config",
|
|
2821
|
-
_defineProperty(this, "heartbeatInterval",
|
|
2818
|
+
_defineProperty(this, "ws", void 0);
|
|
2819
|
+
_defineProperty(this, "event", void 0);
|
|
2820
|
+
_defineProperty(this, "config", void 0);
|
|
2821
|
+
_defineProperty(this, "heartbeatInterval", void 0);
|
|
2822
2822
|
// 心跳参数,默认为心跳测试
|
|
2823
2823
|
_defineProperty(this, "heartbeatParam", {
|
|
2824
2824
|
op: OpCode.HEARTBEAT,
|
|
2825
2825
|
d: null // 心跳唯一值
|
|
2826
2826
|
});
|
|
2827
2827
|
// 是否是断线重连,如果是断线重连的话,不需要走鉴权
|
|
2828
|
-
_defineProperty(this, "isReconnect",
|
|
2828
|
+
_defineProperty(this, "isReconnect", void 0);
|
|
2829
2829
|
// 记录会话参数
|
|
2830
2830
|
_defineProperty(this, "sessionRecord", {
|
|
2831
2831
|
sessionID: '',
|
|
@@ -2871,10 +2871,10 @@ var Ws = /*#__PURE__*/function () {
|
|
|
2871
2871
|
// 先将消息解析
|
|
2872
2872
|
var wsRes = toObject(data);
|
|
2873
2873
|
// 先判断websocket连接是否成功
|
|
2874
|
-
if ((wsRes === null || wsRes ===
|
|
2874
|
+
if ((wsRes === null || wsRes === void 0 ? void 0 : wsRes.op) === OpCode.HELLO && wsRes !== null && wsRes !== void 0 && (_wsRes$d = wsRes.d) !== null && _wsRes$d !== void 0 && _wsRes$d.heartbeat_interval) {
|
|
2875
2875
|
var _wsRes$d2;
|
|
2876
2876
|
// websocket连接成功,拿到心跳周期
|
|
2877
|
-
_this.heartbeatInterval = wsRes === null || wsRes ===
|
|
2877
|
+
_this.heartbeatInterval = wsRes === null || wsRes === void 0 || (_wsRes$d2 = wsRes.d) === null || _wsRes$d2 === void 0 ? void 0 : _wsRes$d2.heartbeat_interval;
|
|
2878
2878
|
// 非断线重连时,需要鉴权
|
|
2879
2879
|
_this.isReconnect ? _this.reconnectWs() : _this.authWs();
|
|
2880
2880
|
return;
|
|
@@ -3142,11 +3142,11 @@ var Ws = /*#__PURE__*/function () {
|
|
|
3142
3142
|
var Session = /*#__PURE__*/function () {
|
|
3143
3143
|
function Session(config, event, sessionRecord) {
|
|
3144
3144
|
_classCallCheck(this, Session);
|
|
3145
|
-
_defineProperty(this, "config",
|
|
3146
|
-
_defineProperty(this, "heartbeatInterval",
|
|
3147
|
-
_defineProperty(this, "ws",
|
|
3148
|
-
_defineProperty(this, "event",
|
|
3149
|
-
_defineProperty(this, "sessionRecord",
|
|
3145
|
+
_defineProperty(this, "config", void 0);
|
|
3146
|
+
_defineProperty(this, "heartbeatInterval", void 0);
|
|
3147
|
+
_defineProperty(this, "ws", void 0);
|
|
3148
|
+
_defineProperty(this, "event", void 0);
|
|
3149
|
+
_defineProperty(this, "sessionRecord", void 0);
|
|
3150
3150
|
this.config = config;
|
|
3151
3151
|
this.event = event;
|
|
3152
3152
|
// 如果会话记录存在的话,继续透传
|
|
@@ -3195,7 +3195,7 @@ var WebsocketClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
3195
3195
|
var _this;
|
|
3196
3196
|
_classCallCheck(this, WebsocketClient);
|
|
3197
3197
|
_this = _callSuper(this, WebsocketClient);
|
|
3198
|
-
_defineProperty(_this, "session",
|
|
3198
|
+
_defineProperty(_this, "session", void 0);
|
|
3199
3199
|
_defineProperty(_this, "retry", 0);
|
|
3200
3200
|
_this.connect(config);
|
|
3201
3201
|
_this.on(SessionEvents.EVENT_WS, function (data) {
|
|
@@ -3209,7 +3209,7 @@ var WebsocketClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
3209
3209
|
BotLogger.info('[CLIENT] 重新连接中,尝试次数:', _this.retry + 1);
|
|
3210
3210
|
_this.connect(config, (_WebsocketCloseReason = WebsocketCloseReason.find(function (v) {
|
|
3211
3211
|
return v.code === data.code;
|
|
3212
|
-
})) !== null && _WebsocketCloseReason !==
|
|
3212
|
+
})) !== null && _WebsocketCloseReason !== void 0 && _WebsocketCloseReason.resume ? data.eventMsg : null);
|
|
3213
3213
|
_this.retry += 1;
|
|
3214
3214
|
} else {
|
|
3215
3215
|
BotLogger.info('[CLIENT] 超过重试次数,连接终止');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "woodenfish-bot",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.5",
|
|
4
4
|
"description": "woodenfish-bot",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,17 +30,17 @@
|
|
|
30
30
|
"linkdev": "node scripts/dev.js"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@babel/core": "^7.26.
|
|
34
|
-
"@babel/generator": "^7.26.
|
|
35
|
-
"@babel/parser": "^7.26.
|
|
33
|
+
"@babel/core": "^7.26.8",
|
|
34
|
+
"@babel/generator": "^7.26.8",
|
|
35
|
+
"@babel/parser": "^7.26.8",
|
|
36
36
|
"@babel/plugin-transform-class-properties": "^7.25.9",
|
|
37
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
38
|
-
"@babel/preset-env": "^7.26.
|
|
37
|
+
"@babel/plugin-transform-runtime": "^7.26.8",
|
|
38
|
+
"@babel/preset-env": "^7.26.8",
|
|
39
39
|
"@babel/preset-typescript": "^7.26.0",
|
|
40
|
-
"@babel/traverse": "^7.26.
|
|
41
|
-
"@babel/types": "^7.26.
|
|
42
|
-
"@commitlint/cli": "^19.
|
|
43
|
-
"@commitlint/config-conventional": "^19.
|
|
40
|
+
"@babel/traverse": "^7.26.8",
|
|
41
|
+
"@babel/types": "^7.26.8",
|
|
42
|
+
"@commitlint/cli": "^19.7.1",
|
|
43
|
+
"@commitlint/config-conventional": "^19.7.1",
|
|
44
44
|
"@rollup/plugin-babel": "^6.0.4",
|
|
45
45
|
"@rollup/plugin-commonjs": "^28.0.2",
|
|
46
46
|
"@rollup/plugin-json": "^6.1.0",
|
|
@@ -48,28 +48,28 @@
|
|
|
48
48
|
"@rollup/plugin-replace": "^6.0.2",
|
|
49
49
|
"@types/jest": "^29.5.14",
|
|
50
50
|
"@types/lodash.assignin": "^4.2.9",
|
|
51
|
-
"@types/node": "^22.
|
|
52
|
-
"@types/ws": "^8.5.
|
|
53
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
54
|
-
"@typescript-eslint/parser": "^8.
|
|
51
|
+
"@types/node": "^22.13.1",
|
|
52
|
+
"@types/ws": "^8.5.14",
|
|
53
|
+
"@typescript-eslint/eslint-plugin": "^8.23.0",
|
|
54
|
+
"@typescript-eslint/parser": "^8.23.0",
|
|
55
55
|
"chalk": "^5.4.1",
|
|
56
56
|
"commitizen": "^4.3.1",
|
|
57
57
|
"cross-env": "^7.0.3",
|
|
58
58
|
"cz-conventional-changelog": "^3.3.0",
|
|
59
|
-
"eslint": "^9.
|
|
59
|
+
"eslint": "^9.20.0",
|
|
60
60
|
"eslint-config-alloy": "^5.1.2",
|
|
61
61
|
"eslint-config-prettier": "^10.0.1",
|
|
62
62
|
"eslint-plugin-jest": "^28.11.0",
|
|
63
63
|
"eslint-plugin-prettier": "^5.2.3",
|
|
64
64
|
"handlebars": "^4.7.8",
|
|
65
|
-
"inquirer": "^12.
|
|
65
|
+
"inquirer": "^12.4.1",
|
|
66
66
|
"jest": "^29.7.0",
|
|
67
|
-
"lint-staged": "^15.4.
|
|
67
|
+
"lint-staged": "^15.4.3",
|
|
68
68
|
"lodash.clonedeep": "^4.5.0",
|
|
69
|
-
"prettier": "^3.
|
|
69
|
+
"prettier": "^3.5.0",
|
|
70
70
|
"readline-sync": "^1.4.10",
|
|
71
71
|
"rimraf": "^6.0.1",
|
|
72
|
-
"rollup": "^4.
|
|
72
|
+
"rollup": "^4.34.6",
|
|
73
73
|
"rollup-plugin-dts": "^6.1.1",
|
|
74
74
|
"rollup-plugin-typescript-paths": "^1.5.0",
|
|
75
75
|
"standard-version": "^9.5.0",
|