@koishijs/plugin-adapter-discord 2.0.0-rc.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bot.d.ts +13 -6
- package/lib/index.d.ts +0 -3
- package/lib/index.js +589 -464
- package/lib/index.js.map +3 -3
- package/lib/sender.d.ts +9 -7
- package/lib/types/application.d.ts +8 -2
- package/lib/types/audit-log.d.ts +111 -95
- package/lib/types/ban.d.ts +67 -0
- package/lib/types/channel.d.ts +223 -102
- package/lib/types/command.d.ts +182 -112
- package/lib/types/emoji.d.ts +26 -107
- package/lib/types/gateway.d.ts +8 -2
- package/lib/types/guild-member.d.ts +178 -72
- package/lib/types/guild-scheduled-event.d.ts +167 -0
- package/lib/types/guild-template.d.ts +62 -0
- package/lib/types/guild.d.ts +195 -43
- package/lib/types/index.d.ts +4 -0
- package/lib/types/integration.d.ts +14 -0
- package/lib/types/interaction.d.ts +59 -2
- package/lib/types/internal.d.ts +3 -3
- package/lib/types/invite.d.ts +127 -77
- package/lib/types/message.d.ts +274 -188
- package/lib/types/reaction.d.ts +114 -0
- package/lib/types/role.d.ts +74 -0
- package/lib/types/scheduled-event.d.ts +167 -0
- package/lib/types/stage-instance.d.ts +54 -8
- package/lib/types/sticker.d.ts +117 -48
- package/lib/types/thread.d.ts +201 -0
- package/lib/types/user.d.ts +28 -11
- package/lib/types/voice.d.ts +35 -1
- package/lib/types/webhook.d.ts +150 -37
- package/lib/utils.d.ts +3 -2
- package/lib/ws.d.ts +3 -6
- package/package.json +9 -7
package/lib/index.js
CHANGED
|
@@ -55,16 +55,161 @@ __export(exports, {
|
|
|
55
55
|
adaptUser: () => adaptUser,
|
|
56
56
|
default: () => src_default
|
|
57
57
|
});
|
|
58
|
-
var
|
|
58
|
+
var import_koishi6 = __toModule(require("koishi"));
|
|
59
59
|
|
|
60
60
|
// plugins/adapter/discord/src/bot.ts
|
|
61
|
-
var
|
|
61
|
+
var import_koishi4 = __toModule(require("koishi"));
|
|
62
62
|
|
|
63
63
|
// plugins/adapter/discord/src/utils.ts
|
|
64
|
+
var import_koishi2 = __toModule(require("koishi"));
|
|
65
|
+
|
|
66
|
+
// plugins/adapter/discord/src/sender.ts
|
|
67
|
+
var import_fs = __toModule(require("fs"));
|
|
68
|
+
var import_path = __toModule(require("path"));
|
|
69
|
+
var import_file_type = __toModule(require("file-type"));
|
|
70
|
+
var import_form_data = __toModule(require("form-data"));
|
|
71
|
+
var import_es_aggregate_error = __toModule(require("es-aggregate-error"));
|
|
64
72
|
var import_koishi = __toModule(require("koishi"));
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
|
|
73
|
+
var _Sender = class {
|
|
74
|
+
constructor(bot, url) {
|
|
75
|
+
this.bot = bot;
|
|
76
|
+
this.url = url;
|
|
77
|
+
this.results = [];
|
|
78
|
+
this.errors = [];
|
|
79
|
+
}
|
|
80
|
+
static from(bot, url) {
|
|
81
|
+
const sender = new _Sender(bot, url);
|
|
82
|
+
return sender.sendMessage.bind(sender);
|
|
83
|
+
}
|
|
84
|
+
async post(data, headers) {
|
|
85
|
+
try {
|
|
86
|
+
const result = await this.bot.http.post(this.url, data, { headers });
|
|
87
|
+
this.results.push(result.id);
|
|
88
|
+
} catch (e) {
|
|
89
|
+
this.errors.push(e);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async sendEmbed(fileBuffer, payload_json = {}, filename) {
|
|
93
|
+
const fd = new import_form_data.default();
|
|
94
|
+
const type = await (0, import_file_type.fromBuffer)(fileBuffer);
|
|
95
|
+
filename || (filename = "file." + type.ext);
|
|
96
|
+
fd.append("file", fileBuffer, filename);
|
|
97
|
+
fd.append("payload_json", JSON.stringify(payload_json));
|
|
98
|
+
return this.post(fd, fd.getHeaders());
|
|
99
|
+
}
|
|
100
|
+
async sendContent(content, addition) {
|
|
101
|
+
return this.post(__spreadProps(__spreadValues({}, addition), { content }));
|
|
102
|
+
}
|
|
103
|
+
async sendAsset(type, data, addition) {
|
|
104
|
+
const { handleMixedContent, handleExternalAsset } = this.bot.adapter.config;
|
|
105
|
+
if (handleMixedContent === "separate" && addition.content) {
|
|
106
|
+
await this.post(addition);
|
|
107
|
+
addition.content = "";
|
|
108
|
+
}
|
|
109
|
+
if (data.url.startsWith("file://")) {
|
|
110
|
+
const filename = (0, import_path.basename)(data.url.slice(7));
|
|
111
|
+
return await this.sendEmbed((0, import_fs.readFileSync)(data.url.slice(7)), addition, data.file || filename);
|
|
112
|
+
} else if (data.url.startsWith("base64://")) {
|
|
113
|
+
const a = Buffer.from(data.url.slice(9), "base64");
|
|
114
|
+
return await this.sendEmbed(a, addition, data.file);
|
|
115
|
+
}
|
|
116
|
+
const sendDirect = /* @__PURE__ */ __name(async () => {
|
|
117
|
+
if (addition.content) {
|
|
118
|
+
await this.post(addition);
|
|
119
|
+
}
|
|
120
|
+
return this.post(__spreadProps(__spreadValues({}, addition), { content: data.url }));
|
|
121
|
+
}, "sendDirect");
|
|
122
|
+
const sendDownload = /* @__PURE__ */ __name(async () => {
|
|
123
|
+
const filename = (0, import_path.basename)(data.url);
|
|
124
|
+
const buffer = await this.bot.app.http.get(data.url, {
|
|
125
|
+
headers: { accept: type + "/*" },
|
|
126
|
+
responseType: "arraybuffer"
|
|
127
|
+
});
|
|
128
|
+
return this.sendEmbed(buffer, addition, data.file || filename);
|
|
129
|
+
}, "sendDownload");
|
|
130
|
+
const mode = data.mode || handleExternalAsset;
|
|
131
|
+
if (mode === "download" || handleMixedContent === "attach" && addition.content || type === "file") {
|
|
132
|
+
return sendDownload();
|
|
133
|
+
} else if (mode === "direct") {
|
|
134
|
+
return sendDirect();
|
|
135
|
+
}
|
|
136
|
+
return await this.bot.app.http.head(data.url, {
|
|
137
|
+
headers: { accept: type + "/*" }
|
|
138
|
+
}).then((headers) => {
|
|
139
|
+
if (headers["content-type"].startsWith(type)) {
|
|
140
|
+
return sendDirect();
|
|
141
|
+
} else {
|
|
142
|
+
return sendDownload();
|
|
143
|
+
}
|
|
144
|
+
}, sendDownload);
|
|
145
|
+
}
|
|
146
|
+
async sendMessage(content, addition = {}) {
|
|
147
|
+
const chain = import_koishi.segment.parse(content);
|
|
148
|
+
let textBuffer = "";
|
|
149
|
+
delete addition.content;
|
|
150
|
+
const sendBuffer = /* @__PURE__ */ __name(async () => {
|
|
151
|
+
const content2 = textBuffer.trim();
|
|
152
|
+
if (!content2)
|
|
153
|
+
return;
|
|
154
|
+
await this.post(__spreadProps(__spreadValues({}, addition), { content: content2 }));
|
|
155
|
+
textBuffer = "";
|
|
156
|
+
}, "sendBuffer");
|
|
157
|
+
for (const code of chain) {
|
|
158
|
+
const { type, data } = code;
|
|
159
|
+
if (type === "text") {
|
|
160
|
+
textBuffer += data.content.trim();
|
|
161
|
+
} else if (type === "at" && data.id) {
|
|
162
|
+
textBuffer += `<@${data.id}>`;
|
|
163
|
+
} else if (type === "at" && data.type === "all") {
|
|
164
|
+
textBuffer += `@everyone`;
|
|
165
|
+
} else if (type === "at" && data.type === "here") {
|
|
166
|
+
textBuffer += `@here`;
|
|
167
|
+
} else if (type === "sharp" && data.id) {
|
|
168
|
+
textBuffer += `<#${data.id}>`;
|
|
169
|
+
} else if (type === "face" && data.name && data.id) {
|
|
170
|
+
textBuffer += `<:${data.name}:${data.id}>`;
|
|
171
|
+
} else if ((type === "image" || type === "video") && data.url) {
|
|
172
|
+
await this.sendAsset(type, data, __spreadProps(__spreadValues({}, addition), {
|
|
173
|
+
content: textBuffer.trim()
|
|
174
|
+
}));
|
|
175
|
+
textBuffer = "";
|
|
176
|
+
} else if (type === "share") {
|
|
177
|
+
await sendBuffer();
|
|
178
|
+
await this.post(__spreadProps(__spreadValues({}, addition), {
|
|
179
|
+
embeds: [__spreadValues({}, data)]
|
|
180
|
+
}));
|
|
181
|
+
} else if (type === "record") {
|
|
182
|
+
await this.sendAsset("file", data, __spreadProps(__spreadValues({}, addition), {
|
|
183
|
+
content: textBuffer.trim()
|
|
184
|
+
}));
|
|
185
|
+
textBuffer = "";
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
await sendBuffer();
|
|
189
|
+
if (!this.errors.length)
|
|
190
|
+
return this.results;
|
|
191
|
+
throw new import_es_aggregate_error.default(this.errors);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
var Sender = _Sender;
|
|
195
|
+
__name(Sender, "Sender");
|
|
196
|
+
Sender.Config = import_koishi.Schema.object({
|
|
197
|
+
handleExternalAsset: import_koishi.Schema.union([
|
|
198
|
+
import_koishi.Schema.const("download").description("先下载后发送"),
|
|
199
|
+
import_koishi.Schema.const("direct").description("直接发送链接"),
|
|
200
|
+
import_koishi.Schema.const("auto").description("发送一个 HEAD 请求,根据返回的 Content-Type 决定发送方式")
|
|
201
|
+
]).description("发送外链资源时采用的方式。").default("auto"),
|
|
202
|
+
handleMixedContent: import_koishi.Schema.union([
|
|
203
|
+
import_koishi.Schema.const("separate").description("将每个不同形式的内容分开发送"),
|
|
204
|
+
import_koishi.Schema.const("attach").description("图片前如果有文本内容,则将文本作为图片的附带信息进行发送"),
|
|
205
|
+
import_koishi.Schema.const("auto").description("如果图片本身采用直接发送则与前面的文本分开,否则将文本作为图片的附带信息发送")
|
|
206
|
+
]).description("发送图文等混合内容时采用的方式。").default("auto")
|
|
207
|
+
}).description("发送设置");
|
|
208
|
+
|
|
209
|
+
// plugins/adapter/discord/src/utils.ts
|
|
210
|
+
var AdapterConfig = import_koishi2.Schema.intersect([
|
|
211
|
+
Sender.Config,
|
|
212
|
+
import_koishi2.Adapter.WebSocketClient.Config
|
|
68
213
|
]);
|
|
69
214
|
var adaptUser = /* @__PURE__ */ __name((user) => ({
|
|
70
215
|
userId: user.id,
|
|
@@ -104,40 +249,40 @@ function adaptMessage(bot, meta, session = {}) {
|
|
|
104
249
|
session.content = meta.content.replace(/<@[!&](.+?)>/, (_, id) => {
|
|
105
250
|
var _a2;
|
|
106
251
|
if (meta.mention_roles.includes(id)) {
|
|
107
|
-
return (0,
|
|
252
|
+
return (0, import_koishi2.segment)("at", { role: id });
|
|
108
253
|
} else {
|
|
109
|
-
const user = (_a2 = meta.mentions) == null ? void 0 : _a2.find((u) => u.id === id);
|
|
110
|
-
return
|
|
254
|
+
const user = (_a2 = meta.mentions) == null ? void 0 : _a2.find((u) => u.id === id || `${u.username}#${u.discriminator}` === id);
|
|
255
|
+
return import_koishi2.segment.at(id, { name: user == null ? void 0 : user.username });
|
|
111
256
|
}
|
|
112
|
-
}).replace(/<:(.*):(.+?)>/, (_, name, id) => (0,
|
|
257
|
+
}).replace(/<:(.*):(.+?)>/, (_, name, id) => (0, import_koishi2.segment)("face", { id, name })).replace(/<a:(.*):(.+?)>/, (_, name, id) => (0, import_koishi2.segment)("face", { id, name, animated: true })).replace(/@everyone/, () => (0, import_koishi2.segment)("at", { type: "all" })).replace(/@here/, () => (0, import_koishi2.segment)("at", { type: "here" })).replace(/<#(.+?)>/, (_, id) => {
|
|
113
258
|
var _a2;
|
|
114
259
|
const channel = (_a2 = meta.mention_channels) == null ? void 0 : _a2.find((c) => c.id === id);
|
|
115
|
-
return
|
|
260
|
+
return import_koishi2.segment.sharp(id, { name: channel == null ? void 0 : channel.name });
|
|
116
261
|
});
|
|
117
262
|
}
|
|
118
263
|
if ((_c = meta.attachments) == null ? void 0 : _c.length) {
|
|
119
264
|
session.content += meta.attachments.map((v) => {
|
|
120
265
|
var _a2, _b2, _c2;
|
|
121
266
|
if (v.height && v.width && ((_a2 = v.content_type) == null ? void 0 : _a2.startsWith("image/"))) {
|
|
122
|
-
return (0,
|
|
267
|
+
return (0, import_koishi2.segment)("image", {
|
|
123
268
|
url: v.url,
|
|
124
269
|
proxy_url: v.proxy_url,
|
|
125
270
|
file: v.filename
|
|
126
271
|
});
|
|
127
272
|
} else if (v.height && v.width && ((_b2 = v.content_type) == null ? void 0 : _b2.startsWith("video/"))) {
|
|
128
|
-
return (0,
|
|
273
|
+
return (0, import_koishi2.segment)("video", {
|
|
129
274
|
url: v.url,
|
|
130
275
|
proxy_url: v.proxy_url,
|
|
131
276
|
file: v.filename
|
|
132
277
|
});
|
|
133
278
|
} else if ((_c2 = v.content_type) == null ? void 0 : _c2.startsWith("audio/")) {
|
|
134
|
-
return (0,
|
|
279
|
+
return (0, import_koishi2.segment)("record", {
|
|
135
280
|
url: v.url,
|
|
136
281
|
proxy_url: v.proxy_url,
|
|
137
282
|
file: v.filename
|
|
138
283
|
});
|
|
139
284
|
} else {
|
|
140
|
-
return (0,
|
|
285
|
+
return (0, import_koishi2.segment)("file", {
|
|
141
286
|
url: v.url,
|
|
142
287
|
proxy_url: v.proxy_url,
|
|
143
288
|
file: v.filename
|
|
@@ -147,13 +292,13 @@ function adaptMessage(bot, meta, session = {}) {
|
|
|
147
292
|
}
|
|
148
293
|
for (const embed of meta.embeds) {
|
|
149
294
|
if (embed.image) {
|
|
150
|
-
session.content += (0,
|
|
295
|
+
session.content += (0, import_koishi2.segment)("image", { url: embed.image.url, proxy_url: embed.image.proxy_url });
|
|
151
296
|
}
|
|
152
297
|
if (embed.thumbnail) {
|
|
153
|
-
session.content += (0,
|
|
298
|
+
session.content += (0, import_koishi2.segment)("image", { url: embed.thumbnail.url, proxy_url: embed.thumbnail.proxy_url });
|
|
154
299
|
}
|
|
155
300
|
if (embed.video) {
|
|
156
|
-
session.content += (0,
|
|
301
|
+
session.content += (0, import_koishi2.segment)("video", { url: embed.video.url, proxy_url: embed.video.proxy_url });
|
|
157
302
|
}
|
|
158
303
|
}
|
|
159
304
|
return session;
|
|
@@ -165,7 +310,7 @@ function adaptMessageSession(bot, meta, session = {}) {
|
|
|
165
310
|
session.timestamp = new Date(meta.timestamp).valueOf() || Date.now();
|
|
166
311
|
if (meta.message_reference) {
|
|
167
312
|
const { message_id, channel_id } = meta.message_reference;
|
|
168
|
-
session.content = (0,
|
|
313
|
+
session.content = (0, import_koishi2.segment)("quote", { id: message_id, channelId: channel_id }) + session.content;
|
|
169
314
|
}
|
|
170
315
|
return session;
|
|
171
316
|
}
|
|
@@ -227,189 +372,78 @@ async function adaptSession(bot, input) {
|
|
|
227
372
|
} else {
|
|
228
373
|
return;
|
|
229
374
|
}
|
|
230
|
-
return new
|
|
375
|
+
return new import_koishi2.Session(bot, session);
|
|
231
376
|
}
|
|
232
377
|
__name(adaptSession, "adaptSession");
|
|
233
378
|
|
|
234
|
-
// plugins/adapter/discord/src/sender.ts
|
|
235
|
-
var import_fs = __toModule(require("fs"));
|
|
236
|
-
var import_path = __toModule(require("path"));
|
|
237
|
-
var import_file_type = __toModule(require("file-type"));
|
|
238
|
-
var import_form_data = __toModule(require("form-data"));
|
|
239
|
-
var import_es_aggregate_error = __toModule(require("es-aggregate-error"));
|
|
240
|
-
var import_koishi2 = __toModule(require("koishi"));
|
|
241
|
-
var Sender = class {
|
|
242
|
-
constructor(bot, url) {
|
|
243
|
-
this.bot = bot;
|
|
244
|
-
this.url = url;
|
|
245
|
-
this.errors = [];
|
|
246
|
-
this.sendMessage = async (content, addition = {}) => {
|
|
247
|
-
const chain = import_koishi2.segment.parse(content);
|
|
248
|
-
let messageId = "0";
|
|
249
|
-
let textBuffer = "";
|
|
250
|
-
delete addition.content;
|
|
251
|
-
const sendBuffer = /* @__PURE__ */ __name(async () => {
|
|
252
|
-
const content2 = textBuffer.trim();
|
|
253
|
-
if (!content2)
|
|
254
|
-
return;
|
|
255
|
-
messageId = await this.post(__spreadProps(__spreadValues({}, addition), { content: content2 }));
|
|
256
|
-
textBuffer = "";
|
|
257
|
-
}, "sendBuffer");
|
|
258
|
-
for (const code of chain) {
|
|
259
|
-
const { type, data } = code;
|
|
260
|
-
if (type === "text") {
|
|
261
|
-
textBuffer += data.content.trim();
|
|
262
|
-
} else if (type === "at" && data.id) {
|
|
263
|
-
textBuffer += `<@${data.id}>`;
|
|
264
|
-
} else if (type === "at" && data.type === "all") {
|
|
265
|
-
textBuffer += `@everyone`;
|
|
266
|
-
} else if (type === "at" && data.type === "here") {
|
|
267
|
-
textBuffer += `@here`;
|
|
268
|
-
} else if (type === "sharp" && data.id) {
|
|
269
|
-
textBuffer += `<#${data.id}>`;
|
|
270
|
-
} else if (type === "face" && data.name && data.id) {
|
|
271
|
-
textBuffer += `<:${data.name}:${data.id}>`;
|
|
272
|
-
} else if ((type === "image" || type === "video") && data.url) {
|
|
273
|
-
messageId = await this.sendAsset(type, data, __spreadProps(__spreadValues({}, addition), {
|
|
274
|
-
content: textBuffer.trim()
|
|
275
|
-
}));
|
|
276
|
-
textBuffer = "";
|
|
277
|
-
} else if (type === "share") {
|
|
278
|
-
await sendBuffer();
|
|
279
|
-
messageId = await this.post(__spreadProps(__spreadValues({}, addition), {
|
|
280
|
-
embeds: [__spreadValues({}, data)]
|
|
281
|
-
}));
|
|
282
|
-
} else if (type === "record") {
|
|
283
|
-
await this.sendAsset("file", data, __spreadProps(__spreadValues({}, addition), {
|
|
284
|
-
content: textBuffer.trim()
|
|
285
|
-
}));
|
|
286
|
-
textBuffer = "";
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
await sendBuffer();
|
|
290
|
-
if (!this.errors.length)
|
|
291
|
-
return messageId;
|
|
292
|
-
throw new import_es_aggregate_error.default(this.errors);
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
static from(bot, url) {
|
|
296
|
-
return new Sender(bot, url).sendMessage;
|
|
297
|
-
}
|
|
298
|
-
async post(data, headers) {
|
|
299
|
-
try {
|
|
300
|
-
const result = await this.bot.http.post(this.url, data, { headers });
|
|
301
|
-
return result.id;
|
|
302
|
-
} catch (e) {
|
|
303
|
-
this.errors.push(e);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
async sendEmbed(fileBuffer, payload_json = {}, filename) {
|
|
307
|
-
const fd = new import_form_data.default();
|
|
308
|
-
const type = await (0, import_file_type.fromBuffer)(fileBuffer);
|
|
309
|
-
filename || (filename = "file." + type.ext);
|
|
310
|
-
fd.append("file", fileBuffer, filename);
|
|
311
|
-
fd.append("payload_json", JSON.stringify(payload_json));
|
|
312
|
-
return this.post(fd, fd.getHeaders());
|
|
313
|
-
}
|
|
314
|
-
async sendContent(content, addition) {
|
|
315
|
-
return this.post(__spreadProps(__spreadValues({}, addition), { content }));
|
|
316
|
-
}
|
|
317
|
-
async sendAsset(type, data, addition) {
|
|
318
|
-
const { handleMixedContent, handleExternalAsset } = this.bot.config;
|
|
319
|
-
if (handleMixedContent === "separate" && addition.content) {
|
|
320
|
-
await this.post(addition);
|
|
321
|
-
addition.content = "";
|
|
322
|
-
}
|
|
323
|
-
if (data.url.startsWith("file://")) {
|
|
324
|
-
const filename = (0, import_path.basename)(data.url.slice(7));
|
|
325
|
-
return this.sendEmbed((0, import_fs.readFileSync)(data.url.slice(7)), addition, data.file || filename);
|
|
326
|
-
} else if (data.url.startsWith("base64://")) {
|
|
327
|
-
const a = Buffer.from(data.url.slice(9), "base64");
|
|
328
|
-
return await this.sendEmbed(a, addition, data.file);
|
|
329
|
-
}
|
|
330
|
-
const sendDirect = /* @__PURE__ */ __name(async () => {
|
|
331
|
-
if (addition.content) {
|
|
332
|
-
await this.post(addition);
|
|
333
|
-
}
|
|
334
|
-
return this.post(__spreadProps(__spreadValues({}, addition), { content: data.url }));
|
|
335
|
-
}, "sendDirect");
|
|
336
|
-
const sendDownload = /* @__PURE__ */ __name(async () => {
|
|
337
|
-
const filename = (0, import_path.basename)(data.url);
|
|
338
|
-
const buffer = await this.bot.app.http.get(data.url, {
|
|
339
|
-
headers: { accept: type + "/*" },
|
|
340
|
-
responseType: "arraybuffer"
|
|
341
|
-
});
|
|
342
|
-
return this.sendEmbed(buffer, addition, data.file || filename);
|
|
343
|
-
}, "sendDownload");
|
|
344
|
-
const mode = data.mode || handleExternalAsset;
|
|
345
|
-
if (mode === "download" || handleMixedContent === "attach" && addition.content || type === "file") {
|
|
346
|
-
return sendDownload();
|
|
347
|
-
} else if (mode === "direct") {
|
|
348
|
-
return sendDirect();
|
|
349
|
-
}
|
|
350
|
-
return await this.bot.app.http.head(data.url, {
|
|
351
|
-
headers: { accept: type + "/*" }
|
|
352
|
-
}).then((headers) => {
|
|
353
|
-
if (headers["content-type"].startsWith(type)) {
|
|
354
|
-
return sendDirect();
|
|
355
|
-
} else {
|
|
356
|
-
return sendDownload();
|
|
357
|
-
}
|
|
358
|
-
}, sendDownload);
|
|
359
|
-
}
|
|
360
|
-
};
|
|
361
|
-
__name(Sender, "Sender");
|
|
362
|
-
|
|
363
379
|
// plugins/adapter/discord/src/types/index.ts
|
|
364
380
|
var types_exports = {};
|
|
365
381
|
__export(types_exports, {
|
|
366
382
|
ActivityFlag: () => ActivityFlag,
|
|
367
383
|
ActivityType: () => ActivityType,
|
|
368
384
|
AllowedMentionType: () => AllowedMentionType,
|
|
369
|
-
|
|
370
|
-
ApplicationCommandPermissionType: () => ApplicationCommandPermissionType,
|
|
371
|
-
ApplicationCommandType: () => ApplicationCommandType,
|
|
385
|
+
ApplicationCommand: () => ApplicationCommand,
|
|
372
386
|
ApplicationFlag: () => ApplicationFlag,
|
|
373
|
-
|
|
374
|
-
|
|
387
|
+
AuditLog: () => AuditLog,
|
|
388
|
+
Channel: () => Channel2,
|
|
375
389
|
ComponentType: () => ComponentType,
|
|
376
390
|
DeviceType: () => DeviceType,
|
|
377
391
|
GatewayIntent: () => GatewayIntent,
|
|
378
392
|
GatewayOpcode: () => GatewayOpcode,
|
|
393
|
+
Guild: () => Guild3,
|
|
379
394
|
GuildFeature: () => GuildFeature,
|
|
395
|
+
GuildScheduledEvent: () => GuildScheduledEvent,
|
|
380
396
|
IntegrationExpireBehavior: () => IntegrationExpireBehavior,
|
|
381
397
|
InteractionCallbackDataFlag: () => InteractionCallbackDataFlag,
|
|
382
398
|
InteractionCallbackType: () => InteractionCallbackType,
|
|
383
399
|
InteractionType: () => InteractionType,
|
|
384
400
|
Internal: () => Internal,
|
|
385
|
-
|
|
401
|
+
Invite: () => Invite,
|
|
386
402
|
MembershipState: () => MembershipState,
|
|
387
|
-
|
|
388
|
-
MessageFlag: () => MessageFlag,
|
|
389
|
-
MessageType: () => MessageType,
|
|
403
|
+
Message: () => Message2,
|
|
390
404
|
Permission: () => Permission,
|
|
391
405
|
StatusType: () => StatusType2,
|
|
392
|
-
|
|
393
|
-
StickerType: () => StickerType,
|
|
406
|
+
Sticker: () => Sticker3,
|
|
394
407
|
SystemChannelFlag: () => SystemChannelFlag,
|
|
395
408
|
UserFlag: () => UserFlag,
|
|
396
409
|
VisibilityType: () => VisibilityType,
|
|
397
|
-
|
|
410
|
+
Webhook: () => Webhook2
|
|
398
411
|
});
|
|
399
412
|
|
|
400
413
|
// plugins/adapter/discord/src/types/internal.ts
|
|
414
|
+
var import_koishi3 = __toModule(require("koishi"));
|
|
401
415
|
var Internal = class {
|
|
402
416
|
constructor(http) {
|
|
403
417
|
this.http = http;
|
|
404
418
|
}
|
|
405
419
|
static define(routes) {
|
|
406
420
|
for (const path in routes) {
|
|
407
|
-
for (const
|
|
408
|
-
const
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
421
|
+
for (const key in routes[path]) {
|
|
422
|
+
const method = key;
|
|
423
|
+
for (const name of (0, import_koishi3.makeArray)(routes[path][method])) {
|
|
424
|
+
Internal.prototype[name] = function(...args) {
|
|
425
|
+
const raw = args.join(", ");
|
|
426
|
+
const url = path.replace(/\{([^}]+)\}/g, () => {
|
|
427
|
+
if (!args.length)
|
|
428
|
+
throw new Error(`too few arguments for ${path}, received ${raw}`);
|
|
429
|
+
return args.shift();
|
|
430
|
+
});
|
|
431
|
+
const config = {};
|
|
432
|
+
if (args.length === 1) {
|
|
433
|
+
if (method === "GET" || method === "DELETE") {
|
|
434
|
+
config.params = args[0];
|
|
435
|
+
} else {
|
|
436
|
+
config.data = args[0];
|
|
437
|
+
}
|
|
438
|
+
} else if (args.length === 2 && method !== "GET" && method !== "DELETE") {
|
|
439
|
+
config.data = args[0];
|
|
440
|
+
config.params = args[1];
|
|
441
|
+
} else if (args.length > 1) {
|
|
442
|
+
throw new Error(`too many arguments for ${path}, received ${raw}`);
|
|
443
|
+
}
|
|
444
|
+
return this.http(method, url, config);
|
|
445
|
+
};
|
|
446
|
+
}
|
|
413
447
|
}
|
|
414
448
|
}
|
|
415
449
|
}
|
|
@@ -436,80 +470,103 @@ Internal.define({
|
|
|
436
470
|
});
|
|
437
471
|
|
|
438
472
|
// plugins/adapter/discord/src/types/audit-log.ts
|
|
439
|
-
var
|
|
440
|
-
(function(
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
473
|
+
var AuditLog;
|
|
474
|
+
(function(AuditLog2) {
|
|
475
|
+
let Type;
|
|
476
|
+
(function(Type2) {
|
|
477
|
+
Type2[Type2["GUILD_UPDATE"] = 1] = "GUILD_UPDATE";
|
|
478
|
+
Type2[Type2["CHANNEL_CREATE"] = 10] = "CHANNEL_CREATE";
|
|
479
|
+
Type2[Type2["CHANNEL_UPDATE"] = 11] = "CHANNEL_UPDATE";
|
|
480
|
+
Type2[Type2["CHANNEL_DELETE"] = 12] = "CHANNEL_DELETE";
|
|
481
|
+
Type2[Type2["CHANNEL_OVERWRITE_CREATE"] = 13] = "CHANNEL_OVERWRITE_CREATE";
|
|
482
|
+
Type2[Type2["CHANNEL_OVERWRITE_UPDATE"] = 14] = "CHANNEL_OVERWRITE_UPDATE";
|
|
483
|
+
Type2[Type2["CHANNEL_OVERWRITE_DELETE"] = 15] = "CHANNEL_OVERWRITE_DELETE";
|
|
484
|
+
Type2[Type2["MEMBER_KICK"] = 20] = "MEMBER_KICK";
|
|
485
|
+
Type2[Type2["MEMBER_PRUNE"] = 21] = "MEMBER_PRUNE";
|
|
486
|
+
Type2[Type2["MEMBER_BAN_ADD"] = 22] = "MEMBER_BAN_ADD";
|
|
487
|
+
Type2[Type2["MEMBER_BAN_REMOVE"] = 23] = "MEMBER_BAN_REMOVE";
|
|
488
|
+
Type2[Type2["MEMBER_UPDATE"] = 24] = "MEMBER_UPDATE";
|
|
489
|
+
Type2[Type2["MEMBER_ROLE_UPDATE"] = 25] = "MEMBER_ROLE_UPDATE";
|
|
490
|
+
Type2[Type2["MEMBER_MOVE"] = 26] = "MEMBER_MOVE";
|
|
491
|
+
Type2[Type2["MEMBER_DISCONNECT"] = 27] = "MEMBER_DISCONNECT";
|
|
492
|
+
Type2[Type2["BOT_ADD"] = 28] = "BOT_ADD";
|
|
493
|
+
Type2[Type2["ROLE_CREATE"] = 30] = "ROLE_CREATE";
|
|
494
|
+
Type2[Type2["ROLE_UPDATE"] = 31] = "ROLE_UPDATE";
|
|
495
|
+
Type2[Type2["ROLE_DELETE"] = 32] = "ROLE_DELETE";
|
|
496
|
+
Type2[Type2["INVITE_CREATE"] = 40] = "INVITE_CREATE";
|
|
497
|
+
Type2[Type2["INVITE_UPDATE"] = 41] = "INVITE_UPDATE";
|
|
498
|
+
Type2[Type2["INVITE_DELETE"] = 42] = "INVITE_DELETE";
|
|
499
|
+
Type2[Type2["WEBHOOK_CREATE"] = 50] = "WEBHOOK_CREATE";
|
|
500
|
+
Type2[Type2["WEBHOOK_UPDATE"] = 51] = "WEBHOOK_UPDATE";
|
|
501
|
+
Type2[Type2["WEBHOOK_DELETE"] = 52] = "WEBHOOK_DELETE";
|
|
502
|
+
Type2[Type2["EMOJI_CREATE"] = 60] = "EMOJI_CREATE";
|
|
503
|
+
Type2[Type2["EMOJI_UPDATE"] = 61] = "EMOJI_UPDATE";
|
|
504
|
+
Type2[Type2["EMOJI_DELETE"] = 62] = "EMOJI_DELETE";
|
|
505
|
+
Type2[Type2["MESSAGE_DELETE"] = 72] = "MESSAGE_DELETE";
|
|
506
|
+
Type2[Type2["MESSAGE_BULK_DELETE"] = 73] = "MESSAGE_BULK_DELETE";
|
|
507
|
+
Type2[Type2["MESSAGE_PIN"] = 74] = "MESSAGE_PIN";
|
|
508
|
+
Type2[Type2["MESSAGE_UNPIN"] = 75] = "MESSAGE_UNPIN";
|
|
509
|
+
Type2[Type2["INTEGRATION_CREATE"] = 80] = "INTEGRATION_CREATE";
|
|
510
|
+
Type2[Type2["INTEGRATION_UPDATE"] = 81] = "INTEGRATION_UPDATE";
|
|
511
|
+
Type2[Type2["INTEGRATION_DELETE"] = 82] = "INTEGRATION_DELETE";
|
|
512
|
+
Type2[Type2["STAGE_INSTANCE_CREATE"] = 83] = "STAGE_INSTANCE_CREATE";
|
|
513
|
+
Type2[Type2["STAGE_INSTANCE_UPDATE"] = 84] = "STAGE_INSTANCE_UPDATE";
|
|
514
|
+
Type2[Type2["STAGE_INSTANCE_DELETE"] = 85] = "STAGE_INSTANCE_DELETE";
|
|
515
|
+
Type2[Type2["STICKER_CREATE"] = 90] = "STICKER_CREATE";
|
|
516
|
+
Type2[Type2["STICKER_UPDATE"] = 91] = "STICKER_UPDATE";
|
|
517
|
+
Type2[Type2["STICKER_DELETE"] = 92] = "STICKER_DELETE";
|
|
518
|
+
Type2[Type2["THREAD_CREATE"] = 110] = "THREAD_CREATE";
|
|
519
|
+
Type2[Type2["THREAD_UPDATE"] = 111] = "THREAD_UPDATE";
|
|
520
|
+
Type2[Type2["THREAD_DELETE"] = 112] = "THREAD_DELETE";
|
|
521
|
+
})(Type = AuditLog2.Type || (AuditLog2.Type = {}));
|
|
522
|
+
})(AuditLog || (AuditLog = {}));
|
|
486
523
|
Internal.define({
|
|
487
524
|
"/guilds/{guild.id}/audit-logs": {
|
|
488
525
|
GET: "getGuildAuditLog"
|
|
489
526
|
}
|
|
490
527
|
});
|
|
491
528
|
|
|
529
|
+
// plugins/adapter/discord/src/types/ban.ts
|
|
530
|
+
Internal.define({
|
|
531
|
+
"/guilds/{guild.id}/bans": {
|
|
532
|
+
GET: "getGuildBans"
|
|
533
|
+
},
|
|
534
|
+
"/guilds/{guild.id}/bans/{user.id}": {
|
|
535
|
+
GET: "getGuildBan",
|
|
536
|
+
PUT: "createGuildBan",
|
|
537
|
+
DELETE: "removeGuildBan"
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
|
|
492
541
|
// plugins/adapter/discord/src/types/channel.ts
|
|
493
|
-
var
|
|
494
|
-
(function(
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
542
|
+
var Channel2;
|
|
543
|
+
(function(Channel10) {
|
|
544
|
+
let Type;
|
|
545
|
+
(function(Type2) {
|
|
546
|
+
Type2[Type2["GUILD_TEXT"] = 0] = "GUILD_TEXT";
|
|
547
|
+
Type2[Type2["DM"] = 1] = "DM";
|
|
548
|
+
Type2[Type2["GUILD_VOICE"] = 2] = "GUILD_VOICE";
|
|
549
|
+
Type2[Type2["GROUP_DM"] = 3] = "GROUP_DM";
|
|
550
|
+
Type2[Type2["GUILD_CATEGORY"] = 4] = "GUILD_CATEGORY";
|
|
551
|
+
Type2[Type2["GUILD_NEWS"] = 5] = "GUILD_NEWS";
|
|
552
|
+
Type2[Type2["GUILD_STORE"] = 6] = "GUILD_STORE";
|
|
553
|
+
Type2[Type2["GUILD_NEWS_THREAD"] = 10] = "GUILD_NEWS_THREAD";
|
|
554
|
+
Type2[Type2["GUILD_PUBLIC_THREAD"] = 11] = "GUILD_PUBLIC_THREAD";
|
|
555
|
+
Type2[Type2["GUILD_PRIVATE_THREAD"] = 12] = "GUILD_PRIVATE_THREAD";
|
|
556
|
+
Type2[Type2["GUILD_STAGE_VOICE"] = 13] = "GUILD_STAGE_VOICE";
|
|
557
|
+
})(Type = Channel10.Type || (Channel10.Type = {}));
|
|
558
|
+
})(Channel2 || (Channel2 = {}));
|
|
507
559
|
var AllowedMentionType;
|
|
508
560
|
(function(AllowedMentionType2) {
|
|
509
561
|
AllowedMentionType2["ROLE_MENTIONS"] = "roles";
|
|
510
562
|
AllowedMentionType2["USER_MENTIONS"] = "users";
|
|
511
563
|
AllowedMentionType2["EVERYONE_MENTIONS"] = "everyone";
|
|
512
564
|
})(AllowedMentionType || (AllowedMentionType = {}));
|
|
565
|
+
Internal.define({
|
|
566
|
+
"/users/@me/channels": {
|
|
567
|
+
POST: ["createDM", "createGroupDM"]
|
|
568
|
+
}
|
|
569
|
+
});
|
|
513
570
|
Internal.define({
|
|
514
571
|
"/guilds/{guild.id}/channels": {
|
|
515
572
|
GET: "getGuildChannels",
|
|
@@ -527,84 +584,46 @@ Internal.define({
|
|
|
527
584
|
PUT: "editChannelPermissions",
|
|
528
585
|
DELETE: "deleteChannelPermission"
|
|
529
586
|
},
|
|
530
|
-
"/channels/{channel.id}/invites": {
|
|
531
|
-
GET: "getChannelInvites",
|
|
532
|
-
POST: "createChannelInvite"
|
|
533
|
-
},
|
|
534
587
|
"/channels/{channel.id}/followers": {
|
|
535
588
|
POST: "followNewsChannel"
|
|
536
589
|
},
|
|
537
590
|
"/channels/{channel.id}/typing": {
|
|
538
591
|
POST: "triggerTypingIndicator"
|
|
539
592
|
},
|
|
540
|
-
"/channels/{channel.id}/pins": {
|
|
541
|
-
GET: "getPinnedMessages"
|
|
542
|
-
},
|
|
543
|
-
"/channels/{channel.id}/pins/{message.id}": {
|
|
544
|
-
PUT: "pinMessage",
|
|
545
|
-
DELETE: "unpinMessage"
|
|
546
|
-
},
|
|
547
593
|
"/channels/{channel.id}/recipients/{user.id}": {
|
|
548
594
|
PUT: "groupDMAddRecipient",
|
|
549
595
|
DELETE: "groupDMRemoveRecipient"
|
|
550
|
-
},
|
|
551
|
-
"/channels/{channel.id}/messages/{message.id}/threads": {
|
|
552
|
-
POST: "startThreadwithMessage"
|
|
553
|
-
},
|
|
554
|
-
"/channels/{channel.id}/threads": {
|
|
555
|
-
POST: "startThreadwithoutMessage"
|
|
556
|
-
},
|
|
557
|
-
"/channels/{channel.id}/thread-members/@me": {
|
|
558
|
-
PUT: "joinThread",
|
|
559
|
-
DELETE: "leaveThread"
|
|
560
|
-
},
|
|
561
|
-
"/channels/{channel.id}/thread-members/{user.id}": {
|
|
562
|
-
PUT: "addThreadMember",
|
|
563
|
-
DELETE: "removeThreadMember",
|
|
564
|
-
GET: "getThreadMember"
|
|
565
|
-
},
|
|
566
|
-
"/channels/{channel.id}/thread-members": {
|
|
567
|
-
GET: "listThreadMembers"
|
|
568
|
-
},
|
|
569
|
-
"/channels/{channel.id}/threads/active": {
|
|
570
|
-
GET: "listActiveThreads"
|
|
571
|
-
},
|
|
572
|
-
"/channels/{channel.id}/threads/archived/public": {
|
|
573
|
-
GET: "listPublicArchivedThreads"
|
|
574
|
-
},
|
|
575
|
-
"/channels/{channel.id}/threads/archived/private": {
|
|
576
|
-
GET: "listPrivateArchivedThreads"
|
|
577
|
-
},
|
|
578
|
-
"/channels/{channel.id}/users/@me/threads/archived/private": {
|
|
579
|
-
GET: "listJoinedPrivateArchivedThreads"
|
|
580
596
|
}
|
|
581
597
|
});
|
|
582
598
|
|
|
583
599
|
// plugins/adapter/discord/src/types/command.ts
|
|
584
|
-
var
|
|
585
|
-
(function(
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
(
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
(
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
600
|
+
var ApplicationCommand;
|
|
601
|
+
(function(ApplicationCommand3) {
|
|
602
|
+
let Type;
|
|
603
|
+
(function(Type2) {
|
|
604
|
+
Type2[Type2["CHAT_INPUT"] = 1] = "CHAT_INPUT";
|
|
605
|
+
Type2[Type2["USER"] = 2] = "USER";
|
|
606
|
+
Type2[Type2["MESSAGE"] = 3] = "MESSAGE";
|
|
607
|
+
})(Type = ApplicationCommand3.Type || (ApplicationCommand3.Type = {}));
|
|
608
|
+
let OptionType;
|
|
609
|
+
(function(OptionType2) {
|
|
610
|
+
OptionType2[OptionType2["SUB_COMMAND"] = 1] = "SUB_COMMAND";
|
|
611
|
+
OptionType2[OptionType2["SUB_COMMAND_GROUP"] = 2] = "SUB_COMMAND_GROUP";
|
|
612
|
+
OptionType2[OptionType2["STRING"] = 3] = "STRING";
|
|
613
|
+
OptionType2[OptionType2["INTEGER"] = 4] = "INTEGER";
|
|
614
|
+
OptionType2[OptionType2["BOOLEAN"] = 5] = "BOOLEAN";
|
|
615
|
+
OptionType2[OptionType2["USER"] = 6] = "USER";
|
|
616
|
+
OptionType2[OptionType2["CHANNEL"] = 7] = "CHANNEL";
|
|
617
|
+
OptionType2[OptionType2["ROLE"] = 8] = "ROLE";
|
|
618
|
+
OptionType2[OptionType2["MENTIONABLE"] = 9] = "MENTIONABLE";
|
|
619
|
+
OptionType2[OptionType2["NUMBER"] = 10] = "NUMBER";
|
|
620
|
+
})(OptionType = ApplicationCommand3.OptionType || (ApplicationCommand3.OptionType = {}));
|
|
621
|
+
let PermissionType;
|
|
622
|
+
(function(PermissionType2) {
|
|
623
|
+
PermissionType2[PermissionType2["ROLE"] = 1] = "ROLE";
|
|
624
|
+
PermissionType2[PermissionType2["USER"] = 2] = "USER";
|
|
625
|
+
})(PermissionType = ApplicationCommand3.PermissionType || (ApplicationCommand3.PermissionType = {}));
|
|
626
|
+
})(ApplicationCommand || (ApplicationCommand = {}));
|
|
608
627
|
Internal.define({
|
|
609
628
|
"/applications/{application.id}/commands": {
|
|
610
629
|
GET: "getGlobalApplicationCommands",
|
|
@@ -664,22 +683,6 @@ Internal.define({
|
|
|
664
683
|
DELETE: "deleteGuildEmoji"
|
|
665
684
|
}
|
|
666
685
|
});
|
|
667
|
-
Internal.define({
|
|
668
|
-
"/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/@me": {
|
|
669
|
-
PUT: "createReaction",
|
|
670
|
-
DELETE: "deleteOwnReaction"
|
|
671
|
-
},
|
|
672
|
-
"/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/{user.id}": {
|
|
673
|
-
DELETE: "deleteUserReaction"
|
|
674
|
-
},
|
|
675
|
-
"/channels/{channel.id}/messages/{message.id}/reactions/{emoji}": {
|
|
676
|
-
GET: "getReactions",
|
|
677
|
-
DELETE: "deleteAllReactionsforEmoji"
|
|
678
|
-
},
|
|
679
|
-
"/channels/{channel.id}/messages/{message.id}/reactions": {
|
|
680
|
-
DELETE: "deleteAllReactions"
|
|
681
|
-
}
|
|
682
|
-
});
|
|
683
686
|
|
|
684
687
|
// plugins/adapter/discord/src/types/gateway.ts
|
|
685
688
|
var GatewayOpcode;
|
|
@@ -740,12 +743,13 @@ Internal.define({
|
|
|
740
743
|
"/guilds/{guild.id}/members/@me": {
|
|
741
744
|
PATCH: "modifyCurrentMember"
|
|
742
745
|
},
|
|
743
|
-
"/guilds/{guild.id}/members/@me/nick": {
|
|
744
|
-
PATCH: "modifyCurrentUserNick"
|
|
745
|
-
},
|
|
746
746
|
"/guilds/{guild.id}/members/{user.id}/roles/{role.id}": {
|
|
747
747
|
PUT: "addGuildMemberRole",
|
|
748
748
|
DELETE: "removeGuildMemberRole"
|
|
749
|
+
},
|
|
750
|
+
"/guilds/{guild.id}/prune": {
|
|
751
|
+
GET: "getGuildPruneCount",
|
|
752
|
+
POST: "beginGuildPrune"
|
|
749
753
|
}
|
|
750
754
|
});
|
|
751
755
|
|
|
@@ -767,6 +771,20 @@ Internal.define({
|
|
|
767
771
|
});
|
|
768
772
|
|
|
769
773
|
// plugins/adapter/discord/src/types/guild.ts
|
|
774
|
+
var Guild3;
|
|
775
|
+
(function(Guild6) {
|
|
776
|
+
let Params;
|
|
777
|
+
(function(Params2) {
|
|
778
|
+
let WidgetStyleOptions;
|
|
779
|
+
(function(WidgetStyleOptions2) {
|
|
780
|
+
WidgetStyleOptions2["shield"] = "shield";
|
|
781
|
+
WidgetStyleOptions2["banner1"] = "banner1";
|
|
782
|
+
WidgetStyleOptions2["banner2"] = "banner2";
|
|
783
|
+
WidgetStyleOptions2["banner3"] = "banner3";
|
|
784
|
+
WidgetStyleOptions2["banner4"] = "banner4";
|
|
785
|
+
})(WidgetStyleOptions = Params2.WidgetStyleOptions || (Params2.WidgetStyleOptions = {}));
|
|
786
|
+
})(Params = Guild6.Params || (Guild6.Params = {}));
|
|
787
|
+
})(Guild3 || (Guild3 = {}));
|
|
770
788
|
var SystemChannelFlag;
|
|
771
789
|
(function(SystemChannelFlag2) {
|
|
772
790
|
SystemChannelFlag2[SystemChannelFlag2["SUPPRESS_JOIN_NOTIFICATIONS"] = 1] = "SUPPRESS_JOIN_NOTIFICATIONS";
|
|
@@ -802,6 +820,9 @@ Internal.define({
|
|
|
802
820
|
"/users/@me/guilds": {
|
|
803
821
|
GET: "getCurrentUserGuilds"
|
|
804
822
|
},
|
|
823
|
+
"/users/@me/guilds/{guild.id}/member": {
|
|
824
|
+
GET: "getCurrentUserGuildMember"
|
|
825
|
+
},
|
|
805
826
|
"/users/@me/guilds/{guild.id}": {
|
|
806
827
|
DELETE: "leaveGuild"
|
|
807
828
|
}
|
|
@@ -818,42 +839,6 @@ Internal.define({
|
|
|
818
839
|
"/guilds/{guild.id}/preview": {
|
|
819
840
|
GET: "getGuildPreview"
|
|
820
841
|
},
|
|
821
|
-
"/guilds/{guild.id}/threads/active": {
|
|
822
|
-
GET: "listActiveThreads"
|
|
823
|
-
},
|
|
824
|
-
"/guilds/{guild.id}/bans": {
|
|
825
|
-
GET: "getGuildBans"
|
|
826
|
-
},
|
|
827
|
-
"/guilds/{guild.id}/bans/{user.id}": {
|
|
828
|
-
GET: "getGuildBan",
|
|
829
|
-
PUT: "createGuildBan",
|
|
830
|
-
DELETE: "removeGuildBan"
|
|
831
|
-
},
|
|
832
|
-
"/guilds/{guild.id}/roles": {
|
|
833
|
-
GET: "getGuildRoles",
|
|
834
|
-
POST: "createGuildRole",
|
|
835
|
-
PATCH: "modifyGuildRolePositions"
|
|
836
|
-
},
|
|
837
|
-
"/guilds/{guild.id}/roles/{role.id}": {
|
|
838
|
-
PATCH: "modifyGuildRole",
|
|
839
|
-
DELETE: "deleteGuildRole"
|
|
840
|
-
},
|
|
841
|
-
"/guilds/{guild.id}/prune": {
|
|
842
|
-
GET: "getGuildPruneCount",
|
|
843
|
-
POST: "beginGuildPrune"
|
|
844
|
-
},
|
|
845
|
-
"/guilds/{guild.id}/regions": {
|
|
846
|
-
GET: "getGuildVoiceRegions"
|
|
847
|
-
},
|
|
848
|
-
"/guilds/{guild.id}/invites": {
|
|
849
|
-
GET: "getGuildInvites"
|
|
850
|
-
},
|
|
851
|
-
"/guilds/{guild.id}/integrations": {
|
|
852
|
-
GET: "getGuildIntegrations"
|
|
853
|
-
},
|
|
854
|
-
"/guilds/{guild.id}/integrations/{integration.id}": {
|
|
855
|
-
DELETE: "deleteGuildIntegration"
|
|
856
|
-
},
|
|
857
842
|
"/guilds/{guild.id}/widget": {
|
|
858
843
|
GET: "getGuildWidgetSettings",
|
|
859
844
|
PATCH: "modifyGuildWidget"
|
|
@@ -861,21 +846,12 @@ Internal.define({
|
|
|
861
846
|
"/guilds/{guild.id}/widget.json": {
|
|
862
847
|
GET: "getGuildWidget"
|
|
863
848
|
},
|
|
864
|
-
"/guilds/{guild.id}/vanity-url": {
|
|
865
|
-
GET: "getGuildVanityURL"
|
|
866
|
-
},
|
|
867
849
|
"/guilds/{guild.id}/widget.png": {
|
|
868
850
|
GET: "getGuildWidgetImage"
|
|
869
851
|
},
|
|
870
852
|
"/guilds/{guild.id}/welcome-screen": {
|
|
871
853
|
GET: "getGuildWelcomeScreen",
|
|
872
854
|
PATCH: "modifyGuildWelcomeScreen"
|
|
873
|
-
},
|
|
874
|
-
"/guilds/{guild.id}/voice-states/@me": {
|
|
875
|
-
PATCH: "modifyCurrentUserVoiceState"
|
|
876
|
-
},
|
|
877
|
-
"/guilds/{guild.id}/voice-states/{user.id}": {
|
|
878
|
-
PATCH: "modifyUserVoiceState"
|
|
879
855
|
}
|
|
880
856
|
});
|
|
881
857
|
|
|
@@ -885,6 +861,14 @@ var IntegrationExpireBehavior;
|
|
|
885
861
|
IntegrationExpireBehavior2[IntegrationExpireBehavior2["REMOVE_ROLE"] = 0] = "REMOVE_ROLE";
|
|
886
862
|
IntegrationExpireBehavior2[IntegrationExpireBehavior2["KICK"] = 1] = "KICK";
|
|
887
863
|
})(IntegrationExpireBehavior || (IntegrationExpireBehavior = {}));
|
|
864
|
+
Internal.define({
|
|
865
|
+
"/guilds/{guild.id}/integrations": {
|
|
866
|
+
GET: "getGuildIntegrations"
|
|
867
|
+
},
|
|
868
|
+
"/guilds/{guild.id}/integrations/{integration.id}": {
|
|
869
|
+
DELETE: "deleteGuildIntegration"
|
|
870
|
+
}
|
|
871
|
+
});
|
|
888
872
|
|
|
889
873
|
// plugins/adapter/discord/src/types/interaction.ts
|
|
890
874
|
var InteractionType;
|
|
@@ -925,63 +909,79 @@ Internal.define({
|
|
|
925
909
|
});
|
|
926
910
|
|
|
927
911
|
// plugins/adapter/discord/src/types/invite.ts
|
|
928
|
-
var
|
|
929
|
-
(function(
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
912
|
+
var Invite;
|
|
913
|
+
(function(Invite2) {
|
|
914
|
+
let TargetType;
|
|
915
|
+
(function(TargetType2) {
|
|
916
|
+
TargetType2[TargetType2["STREAM"] = 1] = "STREAM";
|
|
917
|
+
TargetType2[TargetType2["EMBEDDED_APPLICATION"] = 2] = "EMBEDDED_APPLICATION";
|
|
918
|
+
})(TargetType = Invite2.TargetType || (Invite2.TargetType = {}));
|
|
919
|
+
})(Invite || (Invite = {}));
|
|
933
920
|
Internal.define({
|
|
934
921
|
"/invites/{invite.code}": {
|
|
935
922
|
GET: "getInvite",
|
|
936
923
|
DELETE: "deleteInvite"
|
|
924
|
+
},
|
|
925
|
+
"/guilds/{guild.id}/invites": {
|
|
926
|
+
GET: "getGuildInvites"
|
|
927
|
+
},
|
|
928
|
+
"/guilds/{guild.id}/vanity-url": {
|
|
929
|
+
GET: "getGuildVanityURL"
|
|
930
|
+
},
|
|
931
|
+
"/channels/{channel.id}/invites": {
|
|
932
|
+
GET: "getChannelInvites",
|
|
933
|
+
POST: "createChannelInvite"
|
|
937
934
|
}
|
|
938
935
|
});
|
|
939
936
|
|
|
940
937
|
// plugins/adapter/discord/src/types/message.ts
|
|
941
|
-
var
|
|
942
|
-
(function(
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
(
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
(
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
938
|
+
var Message2;
|
|
939
|
+
(function(Message4) {
|
|
940
|
+
let Type;
|
|
941
|
+
(function(Type2) {
|
|
942
|
+
Type2[Type2["DEFAULT"] = 0] = "DEFAULT";
|
|
943
|
+
Type2[Type2["RECIPIENT_ADD"] = 1] = "RECIPIENT_ADD";
|
|
944
|
+
Type2[Type2["RECIPIENT_REMOVE"] = 2] = "RECIPIENT_REMOVE";
|
|
945
|
+
Type2[Type2["CALL"] = 3] = "CALL";
|
|
946
|
+
Type2[Type2["CHANNEL_NAME_CHANGE"] = 4] = "CHANNEL_NAME_CHANGE";
|
|
947
|
+
Type2[Type2["CHANNEL_ICON_CHANGE"] = 5] = "CHANNEL_ICON_CHANGE";
|
|
948
|
+
Type2[Type2["CHANNEL_PINNED_MESSAGE"] = 6] = "CHANNEL_PINNED_MESSAGE";
|
|
949
|
+
Type2[Type2["GUILD_MEMBER_JOIN"] = 7] = "GUILD_MEMBER_JOIN";
|
|
950
|
+
Type2[Type2["USER_PREMIUM_GUILD_SUBSCRIPTION"] = 8] = "USER_PREMIUM_GUILD_SUBSCRIPTION";
|
|
951
|
+
Type2[Type2["USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1"] = 9] = "USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1";
|
|
952
|
+
Type2[Type2["USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2"] = 10] = "USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2";
|
|
953
|
+
Type2[Type2["USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3"] = 11] = "USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3";
|
|
954
|
+
Type2[Type2["CHANNEL_FOLLOW_ADD"] = 12] = "CHANNEL_FOLLOW_ADD";
|
|
955
|
+
Type2[Type2["GUILD_DISCOVERY_DISQUALIFIED"] = 14] = "GUILD_DISCOVERY_DISQUALIFIED";
|
|
956
|
+
Type2[Type2["GUILD_DISCOVERY_REQUALIFIED"] = 15] = "GUILD_DISCOVERY_REQUALIFIED";
|
|
957
|
+
Type2[Type2["GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING"] = 16] = "GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING";
|
|
958
|
+
Type2[Type2["GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING"] = 17] = "GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING";
|
|
959
|
+
Type2[Type2["THREAD_CREATED"] = 18] = "THREAD_CREATED";
|
|
960
|
+
Type2[Type2["REPLY"] = 19] = "REPLY";
|
|
961
|
+
Type2[Type2["CHAT_INPUT_COMMAND"] = 20] = "CHAT_INPUT_COMMAND";
|
|
962
|
+
Type2[Type2["THREAD_STARTER_MESSAGE"] = 21] = "THREAD_STARTER_MESSAGE";
|
|
963
|
+
Type2[Type2["GUILD_INVITE_REMINDER"] = 22] = "GUILD_INVITE_REMINDER";
|
|
964
|
+
Type2[Type2["CONTEXT_MENU_COMMAND"] = 23] = "CONTEXT_MENU_COMMAND";
|
|
965
|
+
})(Type = Message4.Type || (Message4.Type = {}));
|
|
966
|
+
let ActivityType2;
|
|
967
|
+
(function(ActivityType3) {
|
|
968
|
+
ActivityType3[ActivityType3["JOIN"] = 1] = "JOIN";
|
|
969
|
+
ActivityType3[ActivityType3["SPECTATE"] = 2] = "SPECTATE";
|
|
970
|
+
ActivityType3[ActivityType3["LISTEN"] = 3] = "LISTEN";
|
|
971
|
+
ActivityType3[ActivityType3["JOIN_REQUEST"] = 5] = "JOIN_REQUEST";
|
|
972
|
+
})(ActivityType2 = Message4.ActivityType || (Message4.ActivityType = {}));
|
|
973
|
+
let Flag;
|
|
974
|
+
(function(Flag2) {
|
|
975
|
+
Flag2[Flag2["CROSSPOSTED"] = 1] = "CROSSPOSTED";
|
|
976
|
+
Flag2[Flag2["IS_CROSSPOST"] = 2] = "IS_CROSSPOST";
|
|
977
|
+
Flag2[Flag2["SUPPRESS_EMBEDS"] = 4] = "SUPPRESS_EMBEDS";
|
|
978
|
+
Flag2[Flag2["SOURCE_MESSAGE_DELETED"] = 8] = "SOURCE_MESSAGE_DELETED";
|
|
979
|
+
Flag2[Flag2["URGENT"] = 16] = "URGENT";
|
|
980
|
+
Flag2[Flag2["HAS_THREAD"] = 32] = "HAS_THREAD";
|
|
981
|
+
Flag2[Flag2["EPHEMERAL"] = 64] = "EPHEMERAL";
|
|
982
|
+
Flag2[Flag2["LOADING"] = 128] = "LOADING";
|
|
983
|
+
})(Flag = Message4.Flag || (Message4.Flag = {}));
|
|
984
|
+
})(Message2 || (Message2 = {}));
|
|
985
985
|
Internal.define({
|
|
986
986
|
"/channels/{channel.id}/messages": {
|
|
987
987
|
GET: "getChannelMessages",
|
|
@@ -997,6 +997,13 @@ Internal.define({
|
|
|
997
997
|
},
|
|
998
998
|
"/channels/{channel.id}/messages/bulk-delete": {
|
|
999
999
|
POST: "bulkDeleteMessages"
|
|
1000
|
+
},
|
|
1001
|
+
"/channels/{channel.id}/pins": {
|
|
1002
|
+
GET: "getPinnedMessages"
|
|
1003
|
+
},
|
|
1004
|
+
"/channels/{channel.id}/pins/{message.id}": {
|
|
1005
|
+
PUT: "pinMessage",
|
|
1006
|
+
DELETE: "unpinMessage"
|
|
1000
1007
|
}
|
|
1001
1008
|
});
|
|
1002
1009
|
|
|
@@ -1028,6 +1035,24 @@ var ActivityFlag;
|
|
|
1028
1035
|
ActivityFlag2[ActivityFlag2["PLAY"] = 32] = "PLAY";
|
|
1029
1036
|
})(ActivityFlag || (ActivityFlag = {}));
|
|
1030
1037
|
|
|
1038
|
+
// plugins/adapter/discord/src/types/reaction.ts
|
|
1039
|
+
Internal.define({
|
|
1040
|
+
"/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/@me": {
|
|
1041
|
+
PUT: "createReaction",
|
|
1042
|
+
DELETE: "deleteOwnReaction"
|
|
1043
|
+
},
|
|
1044
|
+
"/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/{user.id}": {
|
|
1045
|
+
DELETE: "deleteUserReaction"
|
|
1046
|
+
},
|
|
1047
|
+
"/channels/{channel.id}/messages/{message.id}/reactions/{emoji}": {
|
|
1048
|
+
GET: "getReactions",
|
|
1049
|
+
DELETE: "deleteAllReactionsforEmoji"
|
|
1050
|
+
},
|
|
1051
|
+
"/channels/{channel.id}/messages/{message.id}/reactions": {
|
|
1052
|
+
DELETE: "deleteAllReactions"
|
|
1053
|
+
}
|
|
1054
|
+
});
|
|
1055
|
+
|
|
1031
1056
|
// plugins/adapter/discord/src/types/role.ts
|
|
1032
1057
|
var Permission;
|
|
1033
1058
|
(function(Permission2) {
|
|
@@ -1071,6 +1096,53 @@ var Permission;
|
|
|
1071
1096
|
Permission2[Permission2["SEND_MESSAGES_IN_THREADS"] = 64] = "SEND_MESSAGES_IN_THREADS";
|
|
1072
1097
|
Permission2[Permission2["START_EMBEDDED_ACTIVITIES"] = 128] = "START_EMBEDDED_ACTIVITIES";
|
|
1073
1098
|
})(Permission || (Permission = {}));
|
|
1099
|
+
Internal.define({
|
|
1100
|
+
"/guilds/{guild.id}/roles": {
|
|
1101
|
+
GET: "getGuildRoles",
|
|
1102
|
+
POST: "createGuildRole",
|
|
1103
|
+
PATCH: "modifyGuildRolePositions"
|
|
1104
|
+
},
|
|
1105
|
+
"/guilds/{guild.id}/roles/{role.id}": {
|
|
1106
|
+
PATCH: "modifyGuildRole",
|
|
1107
|
+
DELETE: "deleteGuildRole"
|
|
1108
|
+
}
|
|
1109
|
+
});
|
|
1110
|
+
|
|
1111
|
+
// plugins/adapter/discord/src/types/scheduled-event.ts
|
|
1112
|
+
var GuildScheduledEvent;
|
|
1113
|
+
(function(GuildScheduledEvent2) {
|
|
1114
|
+
let PrivacyLevel;
|
|
1115
|
+
(function(PrivacyLevel2) {
|
|
1116
|
+
PrivacyLevel2[PrivacyLevel2["GUILD_ONLY"] = 2] = "GUILD_ONLY";
|
|
1117
|
+
})(PrivacyLevel = GuildScheduledEvent2.PrivacyLevel || (GuildScheduledEvent2.PrivacyLevel = {}));
|
|
1118
|
+
let EntityType;
|
|
1119
|
+
(function(EntityType2) {
|
|
1120
|
+
EntityType2[EntityType2["STAGE_INSTANCE"] = 1] = "STAGE_INSTANCE";
|
|
1121
|
+
EntityType2[EntityType2["VOICE"] = 2] = "VOICE";
|
|
1122
|
+
EntityType2[EntityType2["EXTERNAL"] = 3] = "EXTERNAL";
|
|
1123
|
+
})(EntityType = GuildScheduledEvent2.EntityType || (GuildScheduledEvent2.EntityType = {}));
|
|
1124
|
+
let Status;
|
|
1125
|
+
(function(Status2) {
|
|
1126
|
+
Status2[Status2["SCHEDULED"] = 1] = "SCHEDULED";
|
|
1127
|
+
Status2[Status2["ACTIVE"] = 2] = "ACTIVE";
|
|
1128
|
+
Status2[Status2["COMPLETED"] = 3] = "COMPLETED";
|
|
1129
|
+
Status2[Status2["CANCELLED"] = 4] = "CANCELLED";
|
|
1130
|
+
})(Status = GuildScheduledEvent2.Status || (GuildScheduledEvent2.Status = {}));
|
|
1131
|
+
})(GuildScheduledEvent || (GuildScheduledEvent = {}));
|
|
1132
|
+
Internal.define({
|
|
1133
|
+
"/guilds/{guild.id}/scheduled-events": {
|
|
1134
|
+
GET: "listScheduledEventsforGuild",
|
|
1135
|
+
POST: "createGuildScheduledEvent"
|
|
1136
|
+
},
|
|
1137
|
+
"/guilds/{guild.id}/scheduled-events/{guild_scheduled_event.id}": {
|
|
1138
|
+
GET: "getGuildScheduledEvent",
|
|
1139
|
+
PATCH: "modifyGuildScheduledEvent",
|
|
1140
|
+
DELETE: "deleteGuildScheduledEvent"
|
|
1141
|
+
},
|
|
1142
|
+
"/guilds/{guild.id}/scheduled-events/{guild_scheduled_event.id}/users": {
|
|
1143
|
+
GET: "getGuildScheduledEventUsers"
|
|
1144
|
+
}
|
|
1145
|
+
});
|
|
1074
1146
|
|
|
1075
1147
|
// plugins/adapter/discord/src/types/stage-instance.ts
|
|
1076
1148
|
Internal.define({
|
|
@@ -1085,17 +1157,20 @@ Internal.define({
|
|
|
1085
1157
|
});
|
|
1086
1158
|
|
|
1087
1159
|
// plugins/adapter/discord/src/types/sticker.ts
|
|
1088
|
-
var
|
|
1089
|
-
(function(
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
(
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1160
|
+
var Sticker3;
|
|
1161
|
+
(function(Sticker4) {
|
|
1162
|
+
let Type;
|
|
1163
|
+
(function(Type2) {
|
|
1164
|
+
Type2[Type2["STANDARD"] = 1] = "STANDARD";
|
|
1165
|
+
Type2[Type2["GUILD"] = 2] = "GUILD";
|
|
1166
|
+
})(Type = Sticker4.Type || (Sticker4.Type = {}));
|
|
1167
|
+
let FormatType;
|
|
1168
|
+
(function(FormatType2) {
|
|
1169
|
+
FormatType2[FormatType2["PNG"] = 1] = "PNG";
|
|
1170
|
+
FormatType2[FormatType2["APNG"] = 2] = "APNG";
|
|
1171
|
+
FormatType2[FormatType2["LOTTIE"] = 3] = "LOTTIE";
|
|
1172
|
+
})(FormatType = Sticker4.FormatType || (Sticker4.FormatType = {}));
|
|
1173
|
+
})(Sticker3 || (Sticker3 = {}));
|
|
1099
1174
|
Internal.define({
|
|
1100
1175
|
"/stickers/{sticker.id}": {
|
|
1101
1176
|
GET: "getSticker"
|
|
@@ -1121,6 +1196,40 @@ var MembershipState;
|
|
|
1121
1196
|
MembershipState2[MembershipState2["ACCEPTED"] = 2] = "ACCEPTED";
|
|
1122
1197
|
})(MembershipState || (MembershipState = {}));
|
|
1123
1198
|
|
|
1199
|
+
// plugins/adapter/discord/src/types/thread.ts
|
|
1200
|
+
Internal.define({
|
|
1201
|
+
"/channels/{channel.id}/messages/{message.id}/threads": {
|
|
1202
|
+
POST: "startThreadwithMessage"
|
|
1203
|
+
},
|
|
1204
|
+
"/channels/{channel.id}/threads": {
|
|
1205
|
+
POST: "startThreadwithoutMessage"
|
|
1206
|
+
},
|
|
1207
|
+
"/channels/{channel.id}/thread-members/@me": {
|
|
1208
|
+
PUT: "joinThread",
|
|
1209
|
+
DELETE: "leaveThread"
|
|
1210
|
+
},
|
|
1211
|
+
"/channels/{channel.id}/thread-members/{user.id}": {
|
|
1212
|
+
PUT: "addThreadMember",
|
|
1213
|
+
DELETE: "removeThreadMember",
|
|
1214
|
+
GET: "getThreadMember"
|
|
1215
|
+
},
|
|
1216
|
+
"/channels/{channel.id}/thread-members": {
|
|
1217
|
+
GET: "listThreadMembers"
|
|
1218
|
+
},
|
|
1219
|
+
"/channels/{channel.id}/threads/active": {
|
|
1220
|
+
GET: "listActiveThreads"
|
|
1221
|
+
},
|
|
1222
|
+
"/channels/{channel.id}/threads/archived/public": {
|
|
1223
|
+
GET: "listPublicArchivedThreads"
|
|
1224
|
+
},
|
|
1225
|
+
"/channels/{channel.id}/threads/archived/private": {
|
|
1226
|
+
GET: "listPrivateArchivedThreads"
|
|
1227
|
+
},
|
|
1228
|
+
"/channels/{channel.id}/users/@me/threads/archived/private": {
|
|
1229
|
+
GET: "listJoinedPrivateArchivedThreads"
|
|
1230
|
+
}
|
|
1231
|
+
});
|
|
1232
|
+
|
|
1124
1233
|
// plugins/adapter/discord/src/types/user.ts
|
|
1125
1234
|
var UserFlag;
|
|
1126
1235
|
(function(UserFlag2) {
|
|
@@ -1152,9 +1261,6 @@ Internal.define({
|
|
|
1152
1261
|
"/users/{user.id}": {
|
|
1153
1262
|
GET: "getUser"
|
|
1154
1263
|
},
|
|
1155
|
-
"/users/@me/channels": {
|
|
1156
|
-
POST: "createDM"
|
|
1157
|
-
},
|
|
1158
1264
|
"/users/@me/connections": {
|
|
1159
1265
|
GET: "getUserConnections"
|
|
1160
1266
|
}
|
|
@@ -1164,16 +1270,28 @@ Internal.define({
|
|
|
1164
1270
|
Internal.define({
|
|
1165
1271
|
"/voice/regions": {
|
|
1166
1272
|
GET: "listVoiceRegions"
|
|
1273
|
+
},
|
|
1274
|
+
"/guilds/{guild.id}/regions": {
|
|
1275
|
+
GET: "getGuildVoiceRegions"
|
|
1276
|
+
},
|
|
1277
|
+
"/guilds/{guild.id}/voice-states/@me": {
|
|
1278
|
+
PATCH: "modifyCurrentUserVoiceState"
|
|
1279
|
+
},
|
|
1280
|
+
"/guilds/{guild.id}/voice-states/{user.id}": {
|
|
1281
|
+
PATCH: "modifyUserVoiceState"
|
|
1167
1282
|
}
|
|
1168
1283
|
});
|
|
1169
1284
|
|
|
1170
1285
|
// plugins/adapter/discord/src/types/webhook.ts
|
|
1171
|
-
var
|
|
1172
|
-
(function(
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1286
|
+
var Webhook2;
|
|
1287
|
+
(function(Webhook3) {
|
|
1288
|
+
let Type;
|
|
1289
|
+
(function(Type2) {
|
|
1290
|
+
Type2[Type2["INCOMING"] = 1] = "INCOMING";
|
|
1291
|
+
Type2[Type2["CHANNEL_FOLLOWER"] = 2] = "CHANNEL_FOLLOWER";
|
|
1292
|
+
Type2[Type2["APPLICATION"] = 3] = "APPLICATION";
|
|
1293
|
+
})(Type = Webhook3.Type || (Webhook3.Type = {}));
|
|
1294
|
+
})(Webhook2 || (Webhook2 = {}));
|
|
1177
1295
|
Internal.define({
|
|
1178
1296
|
"/channels/{channel.id}/webhooks": {
|
|
1179
1297
|
POST: "createWebhook",
|
|
@@ -1207,32 +1325,43 @@ Internal.define({
|
|
|
1207
1325
|
});
|
|
1208
1326
|
|
|
1209
1327
|
// plugins/adapter/discord/src/bot.ts
|
|
1210
|
-
var BotConfig =
|
|
1211
|
-
|
|
1212
|
-
token:
|
|
1213
|
-
handleExternalAsset: import_koishi3.Schema.union([
|
|
1214
|
-
import_koishi3.Schema.const("download").description("先下载后发送"),
|
|
1215
|
-
import_koishi3.Schema.const("direct").description("直接发送链接"),
|
|
1216
|
-
import_koishi3.Schema.const("auto").description("发送一个 HEAD 请求,如果返回的 Content-Type 正确,则直接发送链接,否则先下载后发送")
|
|
1217
|
-
]).description("发送外链资源时采用的方式。").default("auto"),
|
|
1218
|
-
handleMixedContent: import_koishi3.Schema.union([
|
|
1219
|
-
import_koishi3.Schema.const("separate").description("将每个不同形式的内容分开发送"),
|
|
1220
|
-
import_koishi3.Schema.const("attach").description("图片前如果有文本内容,则将文本作为图片的附带信息进行发送"),
|
|
1221
|
-
import_koishi3.Schema.const("auto").description("如果图片本身采用直接发送则与前面的文本分开,否则将文本作为图片的附带信息发送")
|
|
1222
|
-
]).description("发送图文等混合内容时采用的方式。").default("auto")
|
|
1328
|
+
var BotConfig = import_koishi4.Schema.intersect([
|
|
1329
|
+
import_koishi4.Schema.object({
|
|
1330
|
+
token: import_koishi4.Schema.string().description("机器人的用户令牌。").role("secret").required()
|
|
1223
1331
|
}),
|
|
1224
|
-
|
|
1332
|
+
import_koishi4.Schema.object({
|
|
1333
|
+
gateway: import_koishi4.Schema.string().role("url").default("wss://gateway.discord.gg/?v=8&encoding=json").description("要连接的 WebSocket 网关。"),
|
|
1334
|
+
intents: import_koishi4.Schema.object({
|
|
1335
|
+
members: import_koishi4.Schema.boolean().description("启用 GUILD_MEMBERS 推送。").default(true),
|
|
1336
|
+
presence: import_koishi4.Schema.boolean().description("启用 GUILD_PRESENCES 推送。").default(false)
|
|
1337
|
+
})
|
|
1338
|
+
}).description("推送设置"),
|
|
1339
|
+
import_koishi4.Quester.createSchema({
|
|
1340
|
+
endpoint: "https://discord.com/api/v8"
|
|
1341
|
+
})
|
|
1225
1342
|
]);
|
|
1226
|
-
var DiscordBot = class extends
|
|
1343
|
+
var DiscordBot = class extends import_koishi4.Bot {
|
|
1227
1344
|
constructor(adapter, config) {
|
|
1228
1345
|
super(adapter, config);
|
|
1229
1346
|
this._d = 0;
|
|
1230
1347
|
this._sessionId = "";
|
|
1231
|
-
this.http = adapter.http.extend({
|
|
1232
|
-
headers: {
|
|
1233
|
-
|
|
1348
|
+
this.http = adapter.ctx.http.extend(__spreadProps(__spreadValues({}, config), {
|
|
1349
|
+
headers: __spreadValues({
|
|
1350
|
+
Authorization: `Bot ${config.token}`
|
|
1351
|
+
}, config.headers)
|
|
1352
|
+
}));
|
|
1234
1353
|
this.internal = new Internal(this.http);
|
|
1235
1354
|
}
|
|
1355
|
+
getIntents() {
|
|
1356
|
+
let intents = 0 | GatewayIntent.GUILD_MESSAGES | GatewayIntent.GUILD_MESSAGE_REACTIONS | GatewayIntent.DIRECT_MESSAGES | GatewayIntent.DIRECT_MESSAGE_REACTIONS;
|
|
1357
|
+
if (this.config.intents.members) {
|
|
1358
|
+
intents |= GatewayIntent.GUILD_MEMBERS;
|
|
1359
|
+
}
|
|
1360
|
+
if (this.config.intents.presence) {
|
|
1361
|
+
intents |= GatewayIntent.GUILD_PRESENCES;
|
|
1362
|
+
}
|
|
1363
|
+
return intents;
|
|
1364
|
+
}
|
|
1236
1365
|
async getSelf() {
|
|
1237
1366
|
const data = await this.internal.getCurrentUser();
|
|
1238
1367
|
return adaptUser(data);
|
|
@@ -1246,15 +1375,18 @@ var DiscordBot = class extends import_koishi3.Bot {
|
|
|
1246
1375
|
const session = this.createSession({ channelId, content, guildId, subtype: guildId ? "group" : "private" });
|
|
1247
1376
|
if (await this.app.serial(session, "before-send", session))
|
|
1248
1377
|
return;
|
|
1249
|
-
const chain =
|
|
1378
|
+
const chain = import_koishi4.segment.parse(session.content);
|
|
1250
1379
|
const quote = this.parseQuote(chain);
|
|
1251
1380
|
const message_reference = quote ? {
|
|
1252
1381
|
message_id: quote
|
|
1253
1382
|
} : void 0;
|
|
1254
1383
|
const send = Sender.from(this, `/channels/${channelId}/messages`);
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1384
|
+
const results = await send(session.content, { message_reference });
|
|
1385
|
+
for (const id of results) {
|
|
1386
|
+
session.messageId = id;
|
|
1387
|
+
this.app.emit(session, "send", session);
|
|
1388
|
+
}
|
|
1389
|
+
return results;
|
|
1258
1390
|
}
|
|
1259
1391
|
async sendPrivateMessage(channelId, content) {
|
|
1260
1392
|
return this.sendMessage(channelId, content);
|
|
@@ -1263,7 +1395,7 @@ var DiscordBot = class extends import_koishi3.Bot {
|
|
|
1263
1395
|
await this.internal.deleteMessage(channelId, messageId);
|
|
1264
1396
|
}
|
|
1265
1397
|
async editMessage(channelId, messageId, content) {
|
|
1266
|
-
const chain =
|
|
1398
|
+
const chain = import_koishi4.segment.parse(content);
|
|
1267
1399
|
const image = chain.find((v) => v.type === "image");
|
|
1268
1400
|
if (image) {
|
|
1269
1401
|
throw new Error("You can't include embed object(s) while editing message.");
|
|
@@ -1329,18 +1461,12 @@ __name(DiscordBot, "DiscordBot");
|
|
|
1329
1461
|
DiscordBot.schema = AdapterConfig;
|
|
1330
1462
|
|
|
1331
1463
|
// plugins/adapter/discord/src/ws.ts
|
|
1332
|
-
var
|
|
1464
|
+
var import_koishi5 = __toModule(require("koishi"));
|
|
1333
1465
|
var import_ws = __toModule(require("ws"));
|
|
1334
|
-
var logger = new
|
|
1335
|
-
var WebSocketClient = class extends
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
this.http = ctx.http.extend(__spreadValues({
|
|
1339
|
-
endpoint: "https://discord.com/api/v8"
|
|
1340
|
-
}, config.request));
|
|
1341
|
-
}
|
|
1342
|
-
prepare() {
|
|
1343
|
-
return new import_ws.default("wss://gateway.discord.gg/?v=8&encoding=json");
|
|
1466
|
+
var logger = new import_koishi5.Logger("discord");
|
|
1467
|
+
var WebSocketClient = class extends import_koishi5.Adapter.WebSocketClient {
|
|
1468
|
+
prepare(bot) {
|
|
1469
|
+
return new import_ws.default(bot.config.gateway);
|
|
1344
1470
|
}
|
|
1345
1471
|
heartbeat(bot) {
|
|
1346
1472
|
logger.debug(`heartbeat d ${bot._d}`);
|
|
@@ -1362,10 +1488,9 @@ var WebSocketClient = class extends import_koishi4.Adapter.WebSocketClient {
|
|
|
1362
1488
|
}));
|
|
1363
1489
|
}
|
|
1364
1490
|
bot.socket.on("message", async (data) => {
|
|
1365
|
-
data = data.toString();
|
|
1366
1491
|
let parsed;
|
|
1367
1492
|
try {
|
|
1368
|
-
parsed = JSON.parse(data);
|
|
1493
|
+
parsed = JSON.parse(data.toString());
|
|
1369
1494
|
} catch (error) {
|
|
1370
1495
|
return logger.warn("cannot parse message", data);
|
|
1371
1496
|
}
|
|
@@ -1383,7 +1508,7 @@ var WebSocketClient = class extends import_koishi4.Adapter.WebSocketClient {
|
|
|
1383
1508
|
token: bot.config.token,
|
|
1384
1509
|
properties: {},
|
|
1385
1510
|
compress: false,
|
|
1386
|
-
intents:
|
|
1511
|
+
intents: bot.getIntents()
|
|
1387
1512
|
}
|
|
1388
1513
|
}));
|
|
1389
1514
|
}
|
|
@@ -1391,7 +1516,7 @@ var WebSocketClient = class extends import_koishi4.Adapter.WebSocketClient {
|
|
|
1391
1516
|
if (parsed.t === "READY") {
|
|
1392
1517
|
bot._sessionId = parsed.d.session_id;
|
|
1393
1518
|
const self = adaptUser(parsed.d.user);
|
|
1394
|
-
(0,
|
|
1519
|
+
(0, import_koishi5.renameProperty)(self, "selfId", "userId");
|
|
1395
1520
|
Object.assign(bot, self);
|
|
1396
1521
|
logger.debug("session_id " + bot._sessionId);
|
|
1397
1522
|
return bot.resolve();
|
|
@@ -1410,7 +1535,7 @@ __name(WebSocketClient, "WebSocketClient");
|
|
|
1410
1535
|
WebSocketClient.schema = BotConfig;
|
|
1411
1536
|
|
|
1412
1537
|
// plugins/adapter/discord/src/index.ts
|
|
1413
|
-
var src_default =
|
|
1538
|
+
var src_default = import_koishi6.Adapter.define("discord", DiscordBot, WebSocketClient);
|
|
1414
1539
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1415
1540
|
0 && (module.exports = {
|
|
1416
1541
|
AdapterConfig,
|