woodenfish-bot 5.0.2 → 5.0.4
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 +114 -84
- package/lib/index.js +114 -84
- package/package.json +2 -2
package/es/index.js
CHANGED
|
@@ -282,7 +282,7 @@ var Guild = /*#__PURE__*/function () {
|
|
|
282
282
|
}]);
|
|
283
283
|
}();
|
|
284
284
|
|
|
285
|
-
var version = "5.0.
|
|
285
|
+
var version = "5.0.4";
|
|
286
286
|
|
|
287
287
|
function getDefaultExportFromCjs (x) {
|
|
288
288
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -1309,8 +1309,8 @@ var Audio = /*#__PURE__*/function () {
|
|
|
1309
1309
|
}]);
|
|
1310
1310
|
}();
|
|
1311
1311
|
|
|
1312
|
-
function ownKeys$
|
|
1313
|
-
function _objectSpread$
|
|
1312
|
+
function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1313
|
+
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1314
1314
|
var Mute = /*#__PURE__*/function () {
|
|
1315
1315
|
function Mute(request, config) {
|
|
1316
1316
|
_classCallCheck(this, Mute);
|
|
@@ -1371,7 +1371,7 @@ var Mute = /*#__PURE__*/function () {
|
|
|
1371
1371
|
guildID: guildID
|
|
1372
1372
|
},
|
|
1373
1373
|
// 将options和userIDList合并到一起
|
|
1374
|
-
data: _objectSpread$
|
|
1374
|
+
data: _objectSpread$6(_objectSpread$6({}, options), {}, {
|
|
1375
1375
|
user_ids: userIDList
|
|
1376
1376
|
})
|
|
1377
1377
|
};
|
|
@@ -1567,8 +1567,8 @@ var Schedule = /*#__PURE__*/function () {
|
|
|
1567
1567
|
}]);
|
|
1568
1568
|
}();
|
|
1569
1569
|
|
|
1570
|
-
function ownKeys$
|
|
1571
|
-
function _objectSpread$
|
|
1570
|
+
function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1571
|
+
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1572
1572
|
var Threads = /*#__PURE__*/function () {
|
|
1573
1573
|
function Threads(request, config) {
|
|
1574
1574
|
_classCallCheck(this, Threads);
|
|
@@ -1582,7 +1582,7 @@ var Threads = /*#__PURE__*/function () {
|
|
|
1582
1582
|
return _createClass(Threads, [{
|
|
1583
1583
|
key: "threads",
|
|
1584
1584
|
value: function threads(channelID, requestOptions) {
|
|
1585
|
-
var options = _objectSpread$
|
|
1585
|
+
var options = _objectSpread$5({
|
|
1586
1586
|
method: 'GET',
|
|
1587
1587
|
url: getURL$1('threadsURI'),
|
|
1588
1588
|
rest: {
|
|
@@ -1596,7 +1596,7 @@ var Threads = /*#__PURE__*/function () {
|
|
|
1596
1596
|
}, {
|
|
1597
1597
|
key: "thread",
|
|
1598
1598
|
value: function thread(channelID, threadID, requestOptions) {
|
|
1599
|
-
var options = _objectSpread$
|
|
1599
|
+
var options = _objectSpread$5({
|
|
1600
1600
|
method: 'GET',
|
|
1601
1601
|
url: getURL$1('threadURI'),
|
|
1602
1602
|
rest: {
|
|
@@ -1611,7 +1611,7 @@ var Threads = /*#__PURE__*/function () {
|
|
|
1611
1611
|
}, {
|
|
1612
1612
|
key: "putThreads",
|
|
1613
1613
|
value: function putThreads(channelID, _Threads2, requestOptions) {
|
|
1614
|
-
var options = _objectSpread$
|
|
1614
|
+
var options = _objectSpread$5({
|
|
1615
1615
|
method: 'PUT',
|
|
1616
1616
|
url: getURL$1('threadsURI'),
|
|
1617
1617
|
rest: {
|
|
@@ -1628,7 +1628,7 @@ var Threads = /*#__PURE__*/function () {
|
|
|
1628
1628
|
}, {
|
|
1629
1629
|
key: "putPostReply",
|
|
1630
1630
|
value: function putPostReply(channelID, threadID, postID, reply, requestOptions) {
|
|
1631
|
-
var options = _objectSpread$
|
|
1631
|
+
var options = _objectSpread$5({
|
|
1632
1632
|
method: 'PUT',
|
|
1633
1633
|
url: getURL$1('threadPostRepliesURI'),
|
|
1634
1634
|
rest: {
|
|
@@ -1645,7 +1645,7 @@ var Threads = /*#__PURE__*/function () {
|
|
|
1645
1645
|
}, {
|
|
1646
1646
|
key: "deleteThreads",
|
|
1647
1647
|
value: function deleteThreads(channelID, threadID, requestOptions) {
|
|
1648
|
-
var options = _objectSpread$
|
|
1648
|
+
var options = _objectSpread$5({
|
|
1649
1649
|
method: 'DELETE',
|
|
1650
1650
|
url: getURL$1('threadURI'),
|
|
1651
1651
|
rest: {
|
|
@@ -1727,8 +1727,45 @@ var Interaction = /*#__PURE__*/function () {
|
|
|
1727
1727
|
}]);
|
|
1728
1728
|
}();
|
|
1729
1729
|
|
|
1730
|
-
function ownKeys$
|
|
1731
|
-
function _objectSpread$
|
|
1730
|
+
function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1731
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1732
|
+
var getTraceID = function getTraceID(error) {
|
|
1733
|
+
var _error$response;
|
|
1734
|
+
return 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'];
|
|
1735
|
+
};
|
|
1736
|
+
var normalizeV1OpenAPIError = function normalizeV1OpenAPIError(error) {
|
|
1737
|
+
var _error$response2;
|
|
1738
|
+
var traceid = getTraceID(error);
|
|
1739
|
+
if (error !== null && error !== void 0 && (_error$response2 = error.response) !== null && _error$response2 !== void 0 && _error$response2.data) {
|
|
1740
|
+
return _objectSpread$4(_objectSpread$4({}, error.response.data), {}, {
|
|
1741
|
+
traceid: traceid
|
|
1742
|
+
});
|
|
1743
|
+
}
|
|
1744
|
+
if (error !== null && error !== void 0 && error.response) {
|
|
1745
|
+
return _objectSpread$4(_objectSpread$4({}, error.response), {}, {
|
|
1746
|
+
traceid: traceid
|
|
1747
|
+
});
|
|
1748
|
+
}
|
|
1749
|
+
return error;
|
|
1750
|
+
};
|
|
1751
|
+
var normalizeV2OpenAPIError = function normalizeV2OpenAPIError(error) {
|
|
1752
|
+
var _error$response3;
|
|
1753
|
+
var traceID = getTraceID(error);
|
|
1754
|
+
if (error !== null && error !== void 0 && (_error$response3 = error.response) !== null && _error$response3 !== void 0 && _error$response3.data) {
|
|
1755
|
+
return _objectSpread$4(_objectSpread$4({}, error.response.data), {}, {
|
|
1756
|
+
trace_id: error.response.data.trace_id || traceID
|
|
1757
|
+
});
|
|
1758
|
+
}
|
|
1759
|
+
if (error !== null && error !== void 0 && error.response) {
|
|
1760
|
+
return _objectSpread$4(_objectSpread$4({}, error.response), {}, {
|
|
1761
|
+
trace_id: traceID
|
|
1762
|
+
});
|
|
1763
|
+
}
|
|
1764
|
+
return error;
|
|
1765
|
+
};
|
|
1766
|
+
|
|
1767
|
+
function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1768
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1732
1769
|
var OpenAPI$1 = /*#__PURE__*/function () {
|
|
1733
1770
|
function OpenAPI(config) {
|
|
1734
1771
|
var _this = this;
|
|
@@ -1757,43 +1794,36 @@ var OpenAPI$1 = /*#__PURE__*/function () {
|
|
|
1757
1794
|
// 基础rest请求
|
|
1758
1795
|
_defineProperty(this, "request", /*#__PURE__*/function () {
|
|
1759
1796
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
|
|
1760
|
-
var _this$config, appID, token, botUrl, client;
|
|
1797
|
+
var _this$config, appID, token, requestOptions, botUrl, client, _t;
|
|
1761
1798
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
1762
1799
|
while (1) switch (_context.prev = _context.next) {
|
|
1763
1800
|
case 0:
|
|
1764
1801
|
_this$config = _this.config, appID = _this$config.appID, token = _this$config.token;
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1802
|
+
requestOptions = _objectSpread$3(_objectSpread$3({}, options), {}, {
|
|
1803
|
+
headers: _objectSpread$3({}, options.headers),
|
|
1804
|
+
// QQ OpenAPI must not inherit HTTP(S)_PROXY or ALL_PROXY from the host process.
|
|
1805
|
+
proxy: false
|
|
1806
|
+
}); // 添加 UA
|
|
1807
|
+
addUserAgent(requestOptions.headers);
|
|
1769
1808
|
// 添加鉴权信息
|
|
1770
|
-
addV1Authorization(
|
|
1809
|
+
addV1Authorization(requestOptions.headers, appID, token);
|
|
1771
1810
|
// 组装完整Url
|
|
1772
|
-
botUrl = buildUrl(
|
|
1773
|
-
resty.
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
return Promise.reject(_objectSpread$2(_objectSpread$2({}, error.response), {}, {
|
|
1785
|
-
traceid: traceid
|
|
1786
|
-
}));
|
|
1787
|
-
}
|
|
1788
|
-
return Promise.reject(error);
|
|
1789
|
-
});
|
|
1790
|
-
client = resty.create(options);
|
|
1791
|
-
return _context.abrupt("return", client.request(botUrl, options));
|
|
1792
|
-
case 1:
|
|
1811
|
+
botUrl = buildUrl(requestOptions.url, _this.config.sandbox);
|
|
1812
|
+
client = resty.create(requestOptions);
|
|
1813
|
+
_context.prev = 1;
|
|
1814
|
+
_context.next = 2;
|
|
1815
|
+
return client.request(botUrl, requestOptions);
|
|
1816
|
+
case 2:
|
|
1817
|
+
return _context.abrupt("return", _context.sent);
|
|
1818
|
+
case 3:
|
|
1819
|
+
_context.prev = 3;
|
|
1820
|
+
_t = _context["catch"](1);
|
|
1821
|
+
throw normalizeV1OpenAPIError(_t);
|
|
1822
|
+
case 4:
|
|
1793
1823
|
case "end":
|
|
1794
1824
|
return _context.stop();
|
|
1795
1825
|
}
|
|
1796
|
-
}, _callee);
|
|
1826
|
+
}, _callee, null, [[1, 3]]);
|
|
1797
1827
|
}));
|
|
1798
1828
|
return function (_x) {
|
|
1799
1829
|
return _ref.apply(this, arguments);
|
|
@@ -2032,8 +2062,8 @@ var getURL = function getURL(endpoint) {
|
|
|
2032
2062
|
return apiMap[endpoint];
|
|
2033
2063
|
};
|
|
2034
2064
|
|
|
2035
|
-
function ownKeys$
|
|
2036
|
-
function _objectSpread$
|
|
2065
|
+
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2066
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2037
2067
|
var Group = /*#__PURE__*/function () {
|
|
2038
2068
|
function Group(request, config) {
|
|
2039
2069
|
_classCallCheck(this, Group);
|
|
@@ -2045,7 +2075,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2045
2075
|
return _createClass(Group, [{
|
|
2046
2076
|
key: "getGroupInfo",
|
|
2047
2077
|
value: function getGroupInfo(groupOpenid, requestOptions) {
|
|
2048
|
-
return this.request(_objectSpread$
|
|
2078
|
+
return this.request(_objectSpread$2({
|
|
2049
2079
|
method: 'GET',
|
|
2050
2080
|
url: getURL('groupInfoURI'),
|
|
2051
2081
|
rest: {
|
|
@@ -2056,7 +2086,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2056
2086
|
}, {
|
|
2057
2087
|
key: "getGroupBotState",
|
|
2058
2088
|
value: function getGroupBotState(groupOpenid, requestOptions) {
|
|
2059
|
-
return this.request(_objectSpread$
|
|
2089
|
+
return this.request(_objectSpread$2({
|
|
2060
2090
|
method: 'GET',
|
|
2061
2091
|
url: getURL('groupBotStateURI'),
|
|
2062
2092
|
rest: {
|
|
@@ -2067,7 +2097,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2067
2097
|
}, {
|
|
2068
2098
|
key: "getGroupJoinRequests",
|
|
2069
2099
|
value: function getGroupJoinRequests(groupOpenid, pager, requestOptions) {
|
|
2070
|
-
return this.request(_objectSpread$
|
|
2100
|
+
return this.request(_objectSpread$2({
|
|
2071
2101
|
method: 'GET',
|
|
2072
2102
|
url: getURL('groupJoinRequestListURI'),
|
|
2073
2103
|
rest: {
|
|
@@ -2079,7 +2109,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2079
2109
|
}, {
|
|
2080
2110
|
key: "approveGroupJoinRequest",
|
|
2081
2111
|
value: function approveGroupJoinRequest(groupOpenid, memberOpenid, options, requestOptions) {
|
|
2082
|
-
return this.request(_objectSpread$
|
|
2112
|
+
return this.request(_objectSpread$2({
|
|
2083
2113
|
method: 'POST',
|
|
2084
2114
|
url: getURL('groupJoinRequestApprovalURI'),
|
|
2085
2115
|
rest: {
|
|
@@ -2092,7 +2122,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2092
2122
|
}, {
|
|
2093
2123
|
key: "getGroupRestrictChatSetting",
|
|
2094
2124
|
value: function getGroupRestrictChatSetting(groupOpenid, requestOptions) {
|
|
2095
|
-
return this.request(_objectSpread$
|
|
2125
|
+
return this.request(_objectSpread$2({
|
|
2096
2126
|
method: 'GET',
|
|
2097
2127
|
url: getURL('groupRestrictChatSettingURI'),
|
|
2098
2128
|
rest: {
|
|
@@ -2103,7 +2133,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2103
2133
|
}, {
|
|
2104
2134
|
key: "setGroupRestrictChatSetting",
|
|
2105
2135
|
value: function setGroupRestrictChatSetting(groupOpenid, options, requestOptions) {
|
|
2106
|
-
return this.request(_objectSpread$
|
|
2136
|
+
return this.request(_objectSpread$2({
|
|
2107
2137
|
method: 'POST',
|
|
2108
2138
|
url: getURL('groupRestrictChatSettingURI'),
|
|
2109
2139
|
rest: {
|
|
@@ -2115,7 +2145,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2115
2145
|
}, {
|
|
2116
2146
|
key: "getGroupJoinApprovalStrategies",
|
|
2117
2147
|
value: function getGroupJoinApprovalStrategies(pager, requestOptions) {
|
|
2118
|
-
return this.request(_objectSpread$
|
|
2148
|
+
return this.request(_objectSpread$2({
|
|
2119
2149
|
method: 'GET',
|
|
2120
2150
|
url: getURL('groupJoinApprovalStrategiesURI'),
|
|
2121
2151
|
params: pager || {}
|
|
@@ -2124,7 +2154,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2124
2154
|
}, {
|
|
2125
2155
|
key: "createGroupJoinApprovalStrategy",
|
|
2126
2156
|
value: function createGroupJoinApprovalStrategy(options, requestOptions) {
|
|
2127
|
-
return this.request(_objectSpread$
|
|
2157
|
+
return this.request(_objectSpread$2({
|
|
2128
2158
|
method: 'POST',
|
|
2129
2159
|
url: getURL('groupJoinApprovalStrategiesURI'),
|
|
2130
2160
|
data: options
|
|
@@ -2133,7 +2163,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2133
2163
|
}, {
|
|
2134
2164
|
key: "updateGroupJoinApprovalStrategy",
|
|
2135
2165
|
value: function updateGroupJoinApprovalStrategy(strategyID, options, requestOptions) {
|
|
2136
|
-
return this.request(_objectSpread$
|
|
2166
|
+
return this.request(_objectSpread$2({
|
|
2137
2167
|
method: 'PATCH',
|
|
2138
2168
|
url: getURL('groupJoinApprovalStrategyURI'),
|
|
2139
2169
|
rest: {
|
|
@@ -2145,7 +2175,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2145
2175
|
}, {
|
|
2146
2176
|
key: "deleteGroupJoinApprovalStrategy",
|
|
2147
2177
|
value: function deleteGroupJoinApprovalStrategy(strategyID, requestOptions) {
|
|
2148
|
-
return this.request(_objectSpread$
|
|
2178
|
+
return this.request(_objectSpread$2({
|
|
2149
2179
|
method: 'DELETE',
|
|
2150
2180
|
url: getURL('groupJoinApprovalStrategyURI'),
|
|
2151
2181
|
rest: {
|
|
@@ -2156,7 +2186,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2156
2186
|
}, {
|
|
2157
2187
|
key: "executeGroupJoinApprovalStrategy",
|
|
2158
2188
|
value: function executeGroupJoinApprovalStrategy(strategyID, requestOptions) {
|
|
2159
|
-
return this.request(_objectSpread$
|
|
2189
|
+
return this.request(_objectSpread$2({
|
|
2160
2190
|
method: 'POST',
|
|
2161
2191
|
url: getURL('groupJoinApprovalStrategyExecuteURI'),
|
|
2162
2192
|
rest: {
|
|
@@ -2168,7 +2198,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2168
2198
|
}, {
|
|
2169
2199
|
key: "updateGroupJoinApprovalStrategyWhitelist",
|
|
2170
2200
|
value: function updateGroupJoinApprovalStrategyWhitelist(strategyID, options, requestOptions) {
|
|
2171
|
-
return this.request(_objectSpread$
|
|
2201
|
+
return this.request(_objectSpread$2({
|
|
2172
2202
|
method: 'POST',
|
|
2173
2203
|
url: getURL('groupJoinApprovalStrategyWhitelistURI'),
|
|
2174
2204
|
rest: {
|
|
@@ -2275,10 +2305,12 @@ var Message = /*#__PURE__*/function (_CommonMessage) {
|
|
|
2275
2305
|
}]);
|
|
2276
2306
|
}(Message$1);
|
|
2277
2307
|
|
|
2278
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2279
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2308
|
+
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2309
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2280
2310
|
var isAuthenticationError = function isAuthenticationError(error) {
|
|
2281
|
-
|
|
2311
|
+
var _error$response, _error$response2;
|
|
2312
|
+
var responseData = error === null || error === void 0 || (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data;
|
|
2313
|
+
return (error === null || error === void 0 ? void 0 : error.status) === 401 || (error === null || error === void 0 ? void 0 : error.statusCode) === 401 || (error === null || error === void 0 || (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status) === 401 || (error === null || error === void 0 ? void 0 : error.code) === 11201 || (error === null || error === void 0 ? void 0 : error.err_code) === 40012001 || (responseData === null || responseData === void 0 ? void 0 : responseData.code) === 11201 || (responseData === null || responseData === void 0 ? void 0 : responseData.err_code) === 40012001;
|
|
2282
2314
|
};
|
|
2283
2315
|
var OpenAPI = /*#__PURE__*/function () {
|
|
2284
2316
|
function OpenAPI(config) {
|
|
@@ -2312,8 +2344,10 @@ var OpenAPI = /*#__PURE__*/function () {
|
|
|
2312
2344
|
while (1) switch (_context.prev = _context.next) {
|
|
2313
2345
|
case 0:
|
|
2314
2346
|
forceRefresh = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
|
|
2315
|
-
preparedOptions = _objectSpread(_objectSpread({}, options), {}, {
|
|
2316
|
-
headers: _objectSpread({}, options.headers)
|
|
2347
|
+
preparedOptions = _objectSpread$1(_objectSpread$1({}, options), {}, {
|
|
2348
|
+
headers: _objectSpread$1({}, options.headers),
|
|
2349
|
+
// QQ OpenAPI must not inherit HTTP(S)_PROXY or ALL_PROXY from the host process.
|
|
2350
|
+
proxy: false
|
|
2317
2351
|
});
|
|
2318
2352
|
addUserAgent(preparedOptions.headers);
|
|
2319
2353
|
_context.next = 1;
|
|
@@ -2332,27 +2366,10 @@ var OpenAPI = /*#__PURE__*/function () {
|
|
|
2332
2366
|
}());
|
|
2333
2367
|
_defineProperty(this, "request", /*#__PURE__*/function () {
|
|
2334
2368
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(options) {
|
|
2335
|
-
var botUrl, preparedOptions, _t;
|
|
2369
|
+
var botUrl, preparedOptions, _t, _t2;
|
|
2336
2370
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
2337
2371
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2338
2372
|
case 0:
|
|
2339
|
-
resty.useRes(function (result) {
|
|
2340
|
-
return result;
|
|
2341
|
-
}, function (error) {
|
|
2342
|
-
var _error$response, _error$response2;
|
|
2343
|
-
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'];
|
|
2344
|
-
if (error !== null && error !== void 0 && (_error$response2 = error.response) !== null && _error$response2 !== void 0 && _error$response2.data) {
|
|
2345
|
-
return Promise.reject(_objectSpread(_objectSpread({}, error.response.data), {}, {
|
|
2346
|
-
trace_id: error.response.data.trace_id || traceID
|
|
2347
|
-
}));
|
|
2348
|
-
}
|
|
2349
|
-
if (error !== null && error !== void 0 && error.response) {
|
|
2350
|
-
return Promise.reject(_objectSpread(_objectSpread({}, error.response), {}, {
|
|
2351
|
-
trace_id: traceID
|
|
2352
|
-
}));
|
|
2353
|
-
}
|
|
2354
|
-
return Promise.reject(error);
|
|
2355
|
-
});
|
|
2356
2373
|
botUrl = buildUrl(options.url, _this.config.sandbox);
|
|
2357
2374
|
_context2.next = 1;
|
|
2358
2375
|
return _this.prepareOptions(options);
|
|
@@ -2370,19 +2387,27 @@ var OpenAPI = /*#__PURE__*/function () {
|
|
|
2370
2387
|
_context2.next = 5;
|
|
2371
2388
|
break;
|
|
2372
2389
|
}
|
|
2373
|
-
throw _t;
|
|
2390
|
+
throw normalizeV2OpenAPIError(_t);
|
|
2374
2391
|
case 5:
|
|
2375
2392
|
invalidateV2AccessToken(_this.config.appID);
|
|
2376
2393
|
_context2.next = 6;
|
|
2377
2394
|
return _this.prepareOptions(options, true);
|
|
2378
2395
|
case 6:
|
|
2379
2396
|
preparedOptions = _context2.sent;
|
|
2380
|
-
|
|
2381
|
-
|
|
2397
|
+
_context2.prev = 7;
|
|
2398
|
+
_context2.next = 8;
|
|
2399
|
+
return resty.create(preparedOptions).request(botUrl, preparedOptions);
|
|
2400
|
+
case 8:
|
|
2401
|
+
return _context2.abrupt("return", _context2.sent);
|
|
2402
|
+
case 9:
|
|
2403
|
+
_context2.prev = 9;
|
|
2404
|
+
_t2 = _context2["catch"](7);
|
|
2405
|
+
throw normalizeV2OpenAPIError(_t2);
|
|
2406
|
+
case 10:
|
|
2382
2407
|
case "end":
|
|
2383
2408
|
return _context2.stop();
|
|
2384
2409
|
}
|
|
2385
|
-
}, _callee2, null, [[2, 4]]);
|
|
2410
|
+
}, _callee2, null, [[2, 4], [7, 9]]);
|
|
2386
2411
|
}));
|
|
2387
2412
|
return function (_x2) {
|
|
2388
2413
|
return _ref2.apply(this, arguments);
|
|
@@ -3157,6 +3182,8 @@ var Ws = /*#__PURE__*/function () {
|
|
|
3157
3182
|
}]);
|
|
3158
3183
|
}();
|
|
3159
3184
|
|
|
3185
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3186
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3160
3187
|
var Session = /*#__PURE__*/function () {
|
|
3161
3188
|
function Session(config, authorization, event, sessionRecord) {
|
|
3162
3189
|
_classCallCheck(this, Session);
|
|
@@ -3181,7 +3208,7 @@ var Session = /*#__PURE__*/function () {
|
|
|
3181
3208
|
key: "createSession",
|
|
3182
3209
|
value: function () {
|
|
3183
3210
|
var _createSession = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
3184
|
-
var reqOptions, response, wsData, _response, _t;
|
|
3211
|
+
var reqOptions, requestOptions, response, wsData, _response, _t;
|
|
3185
3212
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
3186
3213
|
while (1) switch (_context.prev = _context.next) {
|
|
3187
3214
|
case 0:
|
|
@@ -3192,8 +3219,11 @@ var Session = /*#__PURE__*/function () {
|
|
|
3192
3219
|
return this.authorization.getAuthorization();
|
|
3193
3220
|
case 1:
|
|
3194
3221
|
reqOptions.headers.Authorization = _context.sent;
|
|
3222
|
+
requestOptions = _objectSpread(_objectSpread({}, reqOptions), {}, {
|
|
3223
|
+
proxy: false
|
|
3224
|
+
});
|
|
3195
3225
|
_context.next = 2;
|
|
3196
|
-
return resty.create(
|
|
3226
|
+
return resty.create(requestOptions).get(requestOptions.url, requestOptions);
|
|
3197
3227
|
case 2:
|
|
3198
3228
|
response = _context.sent;
|
|
3199
3229
|
wsData = response.data;
|
package/lib/index.js
CHANGED
|
@@ -284,7 +284,7 @@ var Guild = /*#__PURE__*/function () {
|
|
|
284
284
|
}]);
|
|
285
285
|
}();
|
|
286
286
|
|
|
287
|
-
var version = "5.0.
|
|
287
|
+
var version = "5.0.4";
|
|
288
288
|
|
|
289
289
|
function getDefaultExportFromCjs (x) {
|
|
290
290
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -1311,8 +1311,8 @@ var Audio = /*#__PURE__*/function () {
|
|
|
1311
1311
|
}]);
|
|
1312
1312
|
}();
|
|
1313
1313
|
|
|
1314
|
-
function ownKeys$
|
|
1315
|
-
function _objectSpread$
|
|
1314
|
+
function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1315
|
+
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1316
1316
|
var Mute = /*#__PURE__*/function () {
|
|
1317
1317
|
function Mute(request, config) {
|
|
1318
1318
|
_classCallCheck(this, Mute);
|
|
@@ -1373,7 +1373,7 @@ var Mute = /*#__PURE__*/function () {
|
|
|
1373
1373
|
guildID: guildID
|
|
1374
1374
|
},
|
|
1375
1375
|
// 将options和userIDList合并到一起
|
|
1376
|
-
data: _objectSpread$
|
|
1376
|
+
data: _objectSpread$6(_objectSpread$6({}, options), {}, {
|
|
1377
1377
|
user_ids: userIDList
|
|
1378
1378
|
})
|
|
1379
1379
|
};
|
|
@@ -1569,8 +1569,8 @@ var Schedule = /*#__PURE__*/function () {
|
|
|
1569
1569
|
}]);
|
|
1570
1570
|
}();
|
|
1571
1571
|
|
|
1572
|
-
function ownKeys$
|
|
1573
|
-
function _objectSpread$
|
|
1572
|
+
function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1573
|
+
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1574
1574
|
var Threads = /*#__PURE__*/function () {
|
|
1575
1575
|
function Threads(request, config) {
|
|
1576
1576
|
_classCallCheck(this, Threads);
|
|
@@ -1584,7 +1584,7 @@ var Threads = /*#__PURE__*/function () {
|
|
|
1584
1584
|
return _createClass(Threads, [{
|
|
1585
1585
|
key: "threads",
|
|
1586
1586
|
value: function threads(channelID, requestOptions) {
|
|
1587
|
-
var options = _objectSpread$
|
|
1587
|
+
var options = _objectSpread$5({
|
|
1588
1588
|
method: 'GET',
|
|
1589
1589
|
url: getURL$1('threadsURI'),
|
|
1590
1590
|
rest: {
|
|
@@ -1598,7 +1598,7 @@ var Threads = /*#__PURE__*/function () {
|
|
|
1598
1598
|
}, {
|
|
1599
1599
|
key: "thread",
|
|
1600
1600
|
value: function thread(channelID, threadID, requestOptions) {
|
|
1601
|
-
var options = _objectSpread$
|
|
1601
|
+
var options = _objectSpread$5({
|
|
1602
1602
|
method: 'GET',
|
|
1603
1603
|
url: getURL$1('threadURI'),
|
|
1604
1604
|
rest: {
|
|
@@ -1613,7 +1613,7 @@ var Threads = /*#__PURE__*/function () {
|
|
|
1613
1613
|
}, {
|
|
1614
1614
|
key: "putThreads",
|
|
1615
1615
|
value: function putThreads(channelID, _Threads2, requestOptions) {
|
|
1616
|
-
var options = _objectSpread$
|
|
1616
|
+
var options = _objectSpread$5({
|
|
1617
1617
|
method: 'PUT',
|
|
1618
1618
|
url: getURL$1('threadsURI'),
|
|
1619
1619
|
rest: {
|
|
@@ -1630,7 +1630,7 @@ var Threads = /*#__PURE__*/function () {
|
|
|
1630
1630
|
}, {
|
|
1631
1631
|
key: "putPostReply",
|
|
1632
1632
|
value: function putPostReply(channelID, threadID, postID, reply, requestOptions) {
|
|
1633
|
-
var options = _objectSpread$
|
|
1633
|
+
var options = _objectSpread$5({
|
|
1634
1634
|
method: 'PUT',
|
|
1635
1635
|
url: getURL$1('threadPostRepliesURI'),
|
|
1636
1636
|
rest: {
|
|
@@ -1647,7 +1647,7 @@ var Threads = /*#__PURE__*/function () {
|
|
|
1647
1647
|
}, {
|
|
1648
1648
|
key: "deleteThreads",
|
|
1649
1649
|
value: function deleteThreads(channelID, threadID, requestOptions) {
|
|
1650
|
-
var options = _objectSpread$
|
|
1650
|
+
var options = _objectSpread$5({
|
|
1651
1651
|
method: 'DELETE',
|
|
1652
1652
|
url: getURL$1('threadURI'),
|
|
1653
1653
|
rest: {
|
|
@@ -1729,8 +1729,45 @@ var Interaction = /*#__PURE__*/function () {
|
|
|
1729
1729
|
}]);
|
|
1730
1730
|
}();
|
|
1731
1731
|
|
|
1732
|
-
function ownKeys$
|
|
1733
|
-
function _objectSpread$
|
|
1732
|
+
function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1733
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1734
|
+
var getTraceID = function getTraceID(error) {
|
|
1735
|
+
var _error$response;
|
|
1736
|
+
return 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'];
|
|
1737
|
+
};
|
|
1738
|
+
var normalizeV1OpenAPIError = function normalizeV1OpenAPIError(error) {
|
|
1739
|
+
var _error$response2;
|
|
1740
|
+
var traceid = getTraceID(error);
|
|
1741
|
+
if (error !== null && error !== void 0 && (_error$response2 = error.response) !== null && _error$response2 !== void 0 && _error$response2.data) {
|
|
1742
|
+
return _objectSpread$4(_objectSpread$4({}, error.response.data), {}, {
|
|
1743
|
+
traceid: traceid
|
|
1744
|
+
});
|
|
1745
|
+
}
|
|
1746
|
+
if (error !== null && error !== void 0 && error.response) {
|
|
1747
|
+
return _objectSpread$4(_objectSpread$4({}, error.response), {}, {
|
|
1748
|
+
traceid: traceid
|
|
1749
|
+
});
|
|
1750
|
+
}
|
|
1751
|
+
return error;
|
|
1752
|
+
};
|
|
1753
|
+
var normalizeV2OpenAPIError = function normalizeV2OpenAPIError(error) {
|
|
1754
|
+
var _error$response3;
|
|
1755
|
+
var traceID = getTraceID(error);
|
|
1756
|
+
if (error !== null && error !== void 0 && (_error$response3 = error.response) !== null && _error$response3 !== void 0 && _error$response3.data) {
|
|
1757
|
+
return _objectSpread$4(_objectSpread$4({}, error.response.data), {}, {
|
|
1758
|
+
trace_id: error.response.data.trace_id || traceID
|
|
1759
|
+
});
|
|
1760
|
+
}
|
|
1761
|
+
if (error !== null && error !== void 0 && error.response) {
|
|
1762
|
+
return _objectSpread$4(_objectSpread$4({}, error.response), {}, {
|
|
1763
|
+
trace_id: traceID
|
|
1764
|
+
});
|
|
1765
|
+
}
|
|
1766
|
+
return error;
|
|
1767
|
+
};
|
|
1768
|
+
|
|
1769
|
+
function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1770
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1734
1771
|
var OpenAPI$1 = /*#__PURE__*/function () {
|
|
1735
1772
|
function OpenAPI(config) {
|
|
1736
1773
|
var _this = this;
|
|
@@ -1759,43 +1796,36 @@ var OpenAPI$1 = /*#__PURE__*/function () {
|
|
|
1759
1796
|
// 基础rest请求
|
|
1760
1797
|
_defineProperty(this, "request", /*#__PURE__*/function () {
|
|
1761
1798
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
|
|
1762
|
-
var _this$config, appID, token, botUrl, client;
|
|
1799
|
+
var _this$config, appID, token, requestOptions, botUrl, client, _t;
|
|
1763
1800
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
1764
1801
|
while (1) switch (_context.prev = _context.next) {
|
|
1765
1802
|
case 0:
|
|
1766
1803
|
_this$config = _this.config, appID = _this$config.appID, token = _this$config.token;
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1804
|
+
requestOptions = _objectSpread$3(_objectSpread$3({}, options), {}, {
|
|
1805
|
+
headers: _objectSpread$3({}, options.headers),
|
|
1806
|
+
// QQ OpenAPI must not inherit HTTP(S)_PROXY or ALL_PROXY from the host process.
|
|
1807
|
+
proxy: false
|
|
1808
|
+
}); // 添加 UA
|
|
1809
|
+
addUserAgent(requestOptions.headers);
|
|
1771
1810
|
// 添加鉴权信息
|
|
1772
|
-
addV1Authorization(
|
|
1811
|
+
addV1Authorization(requestOptions.headers, appID, token);
|
|
1773
1812
|
// 组装完整Url
|
|
1774
|
-
botUrl = buildUrl(
|
|
1775
|
-
resty.
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
return Promise.reject(_objectSpread$2(_objectSpread$2({}, error.response), {}, {
|
|
1787
|
-
traceid: traceid
|
|
1788
|
-
}));
|
|
1789
|
-
}
|
|
1790
|
-
return Promise.reject(error);
|
|
1791
|
-
});
|
|
1792
|
-
client = resty.create(options);
|
|
1793
|
-
return _context.abrupt("return", client.request(botUrl, options));
|
|
1794
|
-
case 1:
|
|
1813
|
+
botUrl = buildUrl(requestOptions.url, _this.config.sandbox);
|
|
1814
|
+
client = resty.create(requestOptions);
|
|
1815
|
+
_context.prev = 1;
|
|
1816
|
+
_context.next = 2;
|
|
1817
|
+
return client.request(botUrl, requestOptions);
|
|
1818
|
+
case 2:
|
|
1819
|
+
return _context.abrupt("return", _context.sent);
|
|
1820
|
+
case 3:
|
|
1821
|
+
_context.prev = 3;
|
|
1822
|
+
_t = _context["catch"](1);
|
|
1823
|
+
throw normalizeV1OpenAPIError(_t);
|
|
1824
|
+
case 4:
|
|
1795
1825
|
case "end":
|
|
1796
1826
|
return _context.stop();
|
|
1797
1827
|
}
|
|
1798
|
-
}, _callee);
|
|
1828
|
+
}, _callee, null, [[1, 3]]);
|
|
1799
1829
|
}));
|
|
1800
1830
|
return function (_x) {
|
|
1801
1831
|
return _ref.apply(this, arguments);
|
|
@@ -2034,8 +2064,8 @@ var getURL = function getURL(endpoint) {
|
|
|
2034
2064
|
return apiMap[endpoint];
|
|
2035
2065
|
};
|
|
2036
2066
|
|
|
2037
|
-
function ownKeys$
|
|
2038
|
-
function _objectSpread$
|
|
2067
|
+
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2068
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2039
2069
|
var Group = /*#__PURE__*/function () {
|
|
2040
2070
|
function Group(request, config) {
|
|
2041
2071
|
_classCallCheck(this, Group);
|
|
@@ -2047,7 +2077,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2047
2077
|
return _createClass(Group, [{
|
|
2048
2078
|
key: "getGroupInfo",
|
|
2049
2079
|
value: function getGroupInfo(groupOpenid, requestOptions) {
|
|
2050
|
-
return this.request(_objectSpread$
|
|
2080
|
+
return this.request(_objectSpread$2({
|
|
2051
2081
|
method: 'GET',
|
|
2052
2082
|
url: getURL('groupInfoURI'),
|
|
2053
2083
|
rest: {
|
|
@@ -2058,7 +2088,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2058
2088
|
}, {
|
|
2059
2089
|
key: "getGroupBotState",
|
|
2060
2090
|
value: function getGroupBotState(groupOpenid, requestOptions) {
|
|
2061
|
-
return this.request(_objectSpread$
|
|
2091
|
+
return this.request(_objectSpread$2({
|
|
2062
2092
|
method: 'GET',
|
|
2063
2093
|
url: getURL('groupBotStateURI'),
|
|
2064
2094
|
rest: {
|
|
@@ -2069,7 +2099,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2069
2099
|
}, {
|
|
2070
2100
|
key: "getGroupJoinRequests",
|
|
2071
2101
|
value: function getGroupJoinRequests(groupOpenid, pager, requestOptions) {
|
|
2072
|
-
return this.request(_objectSpread$
|
|
2102
|
+
return this.request(_objectSpread$2({
|
|
2073
2103
|
method: 'GET',
|
|
2074
2104
|
url: getURL('groupJoinRequestListURI'),
|
|
2075
2105
|
rest: {
|
|
@@ -2081,7 +2111,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2081
2111
|
}, {
|
|
2082
2112
|
key: "approveGroupJoinRequest",
|
|
2083
2113
|
value: function approveGroupJoinRequest(groupOpenid, memberOpenid, options, requestOptions) {
|
|
2084
|
-
return this.request(_objectSpread$
|
|
2114
|
+
return this.request(_objectSpread$2({
|
|
2085
2115
|
method: 'POST',
|
|
2086
2116
|
url: getURL('groupJoinRequestApprovalURI'),
|
|
2087
2117
|
rest: {
|
|
@@ -2094,7 +2124,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2094
2124
|
}, {
|
|
2095
2125
|
key: "getGroupRestrictChatSetting",
|
|
2096
2126
|
value: function getGroupRestrictChatSetting(groupOpenid, requestOptions) {
|
|
2097
|
-
return this.request(_objectSpread$
|
|
2127
|
+
return this.request(_objectSpread$2({
|
|
2098
2128
|
method: 'GET',
|
|
2099
2129
|
url: getURL('groupRestrictChatSettingURI'),
|
|
2100
2130
|
rest: {
|
|
@@ -2105,7 +2135,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2105
2135
|
}, {
|
|
2106
2136
|
key: "setGroupRestrictChatSetting",
|
|
2107
2137
|
value: function setGroupRestrictChatSetting(groupOpenid, options, requestOptions) {
|
|
2108
|
-
return this.request(_objectSpread$
|
|
2138
|
+
return this.request(_objectSpread$2({
|
|
2109
2139
|
method: 'POST',
|
|
2110
2140
|
url: getURL('groupRestrictChatSettingURI'),
|
|
2111
2141
|
rest: {
|
|
@@ -2117,7 +2147,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2117
2147
|
}, {
|
|
2118
2148
|
key: "getGroupJoinApprovalStrategies",
|
|
2119
2149
|
value: function getGroupJoinApprovalStrategies(pager, requestOptions) {
|
|
2120
|
-
return this.request(_objectSpread$
|
|
2150
|
+
return this.request(_objectSpread$2({
|
|
2121
2151
|
method: 'GET',
|
|
2122
2152
|
url: getURL('groupJoinApprovalStrategiesURI'),
|
|
2123
2153
|
params: pager || {}
|
|
@@ -2126,7 +2156,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2126
2156
|
}, {
|
|
2127
2157
|
key: "createGroupJoinApprovalStrategy",
|
|
2128
2158
|
value: function createGroupJoinApprovalStrategy(options, requestOptions) {
|
|
2129
|
-
return this.request(_objectSpread$
|
|
2159
|
+
return this.request(_objectSpread$2({
|
|
2130
2160
|
method: 'POST',
|
|
2131
2161
|
url: getURL('groupJoinApprovalStrategiesURI'),
|
|
2132
2162
|
data: options
|
|
@@ -2135,7 +2165,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2135
2165
|
}, {
|
|
2136
2166
|
key: "updateGroupJoinApprovalStrategy",
|
|
2137
2167
|
value: function updateGroupJoinApprovalStrategy(strategyID, options, requestOptions) {
|
|
2138
|
-
return this.request(_objectSpread$
|
|
2168
|
+
return this.request(_objectSpread$2({
|
|
2139
2169
|
method: 'PATCH',
|
|
2140
2170
|
url: getURL('groupJoinApprovalStrategyURI'),
|
|
2141
2171
|
rest: {
|
|
@@ -2147,7 +2177,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2147
2177
|
}, {
|
|
2148
2178
|
key: "deleteGroupJoinApprovalStrategy",
|
|
2149
2179
|
value: function deleteGroupJoinApprovalStrategy(strategyID, requestOptions) {
|
|
2150
|
-
return this.request(_objectSpread$
|
|
2180
|
+
return this.request(_objectSpread$2({
|
|
2151
2181
|
method: 'DELETE',
|
|
2152
2182
|
url: getURL('groupJoinApprovalStrategyURI'),
|
|
2153
2183
|
rest: {
|
|
@@ -2158,7 +2188,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2158
2188
|
}, {
|
|
2159
2189
|
key: "executeGroupJoinApprovalStrategy",
|
|
2160
2190
|
value: function executeGroupJoinApprovalStrategy(strategyID, requestOptions) {
|
|
2161
|
-
return this.request(_objectSpread$
|
|
2191
|
+
return this.request(_objectSpread$2({
|
|
2162
2192
|
method: 'POST',
|
|
2163
2193
|
url: getURL('groupJoinApprovalStrategyExecuteURI'),
|
|
2164
2194
|
rest: {
|
|
@@ -2170,7 +2200,7 @@ var Group = /*#__PURE__*/function () {
|
|
|
2170
2200
|
}, {
|
|
2171
2201
|
key: "updateGroupJoinApprovalStrategyWhitelist",
|
|
2172
2202
|
value: function updateGroupJoinApprovalStrategyWhitelist(strategyID, options, requestOptions) {
|
|
2173
|
-
return this.request(_objectSpread$
|
|
2203
|
+
return this.request(_objectSpread$2({
|
|
2174
2204
|
method: 'POST',
|
|
2175
2205
|
url: getURL('groupJoinApprovalStrategyWhitelistURI'),
|
|
2176
2206
|
rest: {
|
|
@@ -2277,10 +2307,12 @@ var Message = /*#__PURE__*/function (_CommonMessage) {
|
|
|
2277
2307
|
}]);
|
|
2278
2308
|
}(Message$1);
|
|
2279
2309
|
|
|
2280
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2281
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2310
|
+
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2311
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2282
2312
|
var isAuthenticationError = function isAuthenticationError(error) {
|
|
2283
|
-
|
|
2313
|
+
var _error$response, _error$response2;
|
|
2314
|
+
var responseData = error === null || error === void 0 || (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data;
|
|
2315
|
+
return (error === null || error === void 0 ? void 0 : error.status) === 401 || (error === null || error === void 0 ? void 0 : error.statusCode) === 401 || (error === null || error === void 0 || (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status) === 401 || (error === null || error === void 0 ? void 0 : error.code) === 11201 || (error === null || error === void 0 ? void 0 : error.err_code) === 40012001 || (responseData === null || responseData === void 0 ? void 0 : responseData.code) === 11201 || (responseData === null || responseData === void 0 ? void 0 : responseData.err_code) === 40012001;
|
|
2284
2316
|
};
|
|
2285
2317
|
var OpenAPI = /*#__PURE__*/function () {
|
|
2286
2318
|
function OpenAPI(config) {
|
|
@@ -2314,8 +2346,10 @@ var OpenAPI = /*#__PURE__*/function () {
|
|
|
2314
2346
|
while (1) switch (_context.prev = _context.next) {
|
|
2315
2347
|
case 0:
|
|
2316
2348
|
forceRefresh = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
|
|
2317
|
-
preparedOptions = _objectSpread(_objectSpread({}, options), {}, {
|
|
2318
|
-
headers: _objectSpread({}, options.headers)
|
|
2349
|
+
preparedOptions = _objectSpread$1(_objectSpread$1({}, options), {}, {
|
|
2350
|
+
headers: _objectSpread$1({}, options.headers),
|
|
2351
|
+
// QQ OpenAPI must not inherit HTTP(S)_PROXY or ALL_PROXY from the host process.
|
|
2352
|
+
proxy: false
|
|
2319
2353
|
});
|
|
2320
2354
|
addUserAgent(preparedOptions.headers);
|
|
2321
2355
|
_context.next = 1;
|
|
@@ -2334,27 +2368,10 @@ var OpenAPI = /*#__PURE__*/function () {
|
|
|
2334
2368
|
}());
|
|
2335
2369
|
_defineProperty(this, "request", /*#__PURE__*/function () {
|
|
2336
2370
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(options) {
|
|
2337
|
-
var botUrl, preparedOptions, _t;
|
|
2371
|
+
var botUrl, preparedOptions, _t, _t2;
|
|
2338
2372
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
2339
2373
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2340
2374
|
case 0:
|
|
2341
|
-
resty.useRes(function (result) {
|
|
2342
|
-
return result;
|
|
2343
|
-
}, function (error) {
|
|
2344
|
-
var _error$response, _error$response2;
|
|
2345
|
-
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'];
|
|
2346
|
-
if (error !== null && error !== void 0 && (_error$response2 = error.response) !== null && _error$response2 !== void 0 && _error$response2.data) {
|
|
2347
|
-
return Promise.reject(_objectSpread(_objectSpread({}, error.response.data), {}, {
|
|
2348
|
-
trace_id: error.response.data.trace_id || traceID
|
|
2349
|
-
}));
|
|
2350
|
-
}
|
|
2351
|
-
if (error !== null && error !== void 0 && error.response) {
|
|
2352
|
-
return Promise.reject(_objectSpread(_objectSpread({}, error.response), {}, {
|
|
2353
|
-
trace_id: traceID
|
|
2354
|
-
}));
|
|
2355
|
-
}
|
|
2356
|
-
return Promise.reject(error);
|
|
2357
|
-
});
|
|
2358
2375
|
botUrl = buildUrl(options.url, _this.config.sandbox);
|
|
2359
2376
|
_context2.next = 1;
|
|
2360
2377
|
return _this.prepareOptions(options);
|
|
@@ -2372,19 +2389,27 @@ var OpenAPI = /*#__PURE__*/function () {
|
|
|
2372
2389
|
_context2.next = 5;
|
|
2373
2390
|
break;
|
|
2374
2391
|
}
|
|
2375
|
-
throw _t;
|
|
2392
|
+
throw normalizeV2OpenAPIError(_t);
|
|
2376
2393
|
case 5:
|
|
2377
2394
|
invalidateV2AccessToken(_this.config.appID);
|
|
2378
2395
|
_context2.next = 6;
|
|
2379
2396
|
return _this.prepareOptions(options, true);
|
|
2380
2397
|
case 6:
|
|
2381
2398
|
preparedOptions = _context2.sent;
|
|
2382
|
-
|
|
2383
|
-
|
|
2399
|
+
_context2.prev = 7;
|
|
2400
|
+
_context2.next = 8;
|
|
2401
|
+
return resty.create(preparedOptions).request(botUrl, preparedOptions);
|
|
2402
|
+
case 8:
|
|
2403
|
+
return _context2.abrupt("return", _context2.sent);
|
|
2404
|
+
case 9:
|
|
2405
|
+
_context2.prev = 9;
|
|
2406
|
+
_t2 = _context2["catch"](7);
|
|
2407
|
+
throw normalizeV2OpenAPIError(_t2);
|
|
2408
|
+
case 10:
|
|
2384
2409
|
case "end":
|
|
2385
2410
|
return _context2.stop();
|
|
2386
2411
|
}
|
|
2387
|
-
}, _callee2, null, [[2, 4]]);
|
|
2412
|
+
}, _callee2, null, [[2, 4], [7, 9]]);
|
|
2388
2413
|
}));
|
|
2389
2414
|
return function (_x2) {
|
|
2390
2415
|
return _ref2.apply(this, arguments);
|
|
@@ -3159,6 +3184,8 @@ var Ws = /*#__PURE__*/function () {
|
|
|
3159
3184
|
}]);
|
|
3160
3185
|
}();
|
|
3161
3186
|
|
|
3187
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3188
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3162
3189
|
var Session = /*#__PURE__*/function () {
|
|
3163
3190
|
function Session(config, authorization, event, sessionRecord) {
|
|
3164
3191
|
_classCallCheck(this, Session);
|
|
@@ -3183,7 +3210,7 @@ var Session = /*#__PURE__*/function () {
|
|
|
3183
3210
|
key: "createSession",
|
|
3184
3211
|
value: function () {
|
|
3185
3212
|
var _createSession = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
3186
|
-
var reqOptions, response, wsData, _response, _t;
|
|
3213
|
+
var reqOptions, requestOptions, response, wsData, _response, _t;
|
|
3187
3214
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
3188
3215
|
while (1) switch (_context.prev = _context.next) {
|
|
3189
3216
|
case 0:
|
|
@@ -3194,8 +3221,11 @@ var Session = /*#__PURE__*/function () {
|
|
|
3194
3221
|
return this.authorization.getAuthorization();
|
|
3195
3222
|
case 1:
|
|
3196
3223
|
reqOptions.headers.Authorization = _context.sent;
|
|
3224
|
+
requestOptions = _objectSpread(_objectSpread({}, reqOptions), {}, {
|
|
3225
|
+
proxy: false
|
|
3226
|
+
});
|
|
3197
3227
|
_context.next = 2;
|
|
3198
|
-
return resty.create(
|
|
3228
|
+
return resty.create(requestOptions).get(requestOptions.url, requestOptions);
|
|
3199
3229
|
case 2:
|
|
3200
3230
|
response = _context.sent;
|
|
3201
3231
|
wsData = response.data;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "woodenfish-bot",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.4",
|
|
4
4
|
"description": "woodenfish-bot",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"eslint-config-prettier": "^10.1.8",
|
|
62
62
|
"eslint-plugin-jest": "^29.16.1",
|
|
63
63
|
"eslint-plugin-prettier": "^5.5.6",
|
|
64
|
-
"globals": "^17.
|
|
64
|
+
"globals": "^17.11.0",
|
|
65
65
|
"handlebars": "^4.7.9",
|
|
66
66
|
"inquirer": "^13.4.2",
|
|
67
67
|
"jest": "^30.4.2",
|