@koishijs/plugin-adapter-discord 2.0.0-beta.6 → 2.0.0
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 +2 -2
- package/lib/index.js +478 -359
- package/lib/index.js.map +3 -3
- package/lib/sender.d.ts +7 -6
- 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 +6 -1
- package/lib/ws.d.ts +1 -0
- package/package.json +6 -5
package/lib/index.js
CHANGED
|
@@ -55,14 +55,19 @@ __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
64
|
var import_koishi = __toModule(require("koishi"));
|
|
65
65
|
var AdapterConfig = import_koishi.Schema.intersect([
|
|
66
|
+
import_koishi.Schema.object({
|
|
67
|
+
intents: import_koishi.Schema.object({
|
|
68
|
+
members: import_koishi.Schema.boolean()
|
|
69
|
+
})
|
|
70
|
+
}),
|
|
66
71
|
import_koishi.App.Config.Request,
|
|
67
72
|
import_koishi.Adapter.WebSocketClient.Config
|
|
68
73
|
]);
|
|
@@ -242,63 +247,17 @@ var Sender = class {
|
|
|
242
247
|
constructor(bot, url) {
|
|
243
248
|
this.bot = bot;
|
|
244
249
|
this.url = url;
|
|
250
|
+
this.results = [];
|
|
245
251
|
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
252
|
}
|
|
295
253
|
static from(bot, url) {
|
|
296
|
-
|
|
254
|
+
const sender = new Sender(bot, url);
|
|
255
|
+
return sender.sendMessage.bind(sender);
|
|
297
256
|
}
|
|
298
257
|
async post(data, headers) {
|
|
299
258
|
try {
|
|
300
|
-
const result = await this.bot.http(
|
|
301
|
-
|
|
259
|
+
const result = await this.bot.http.post(this.url, data, { headers });
|
|
260
|
+
this.results.push(result.id);
|
|
302
261
|
} catch (e) {
|
|
303
262
|
this.errors.push(e);
|
|
304
263
|
}
|
|
@@ -322,7 +281,7 @@ var Sender = class {
|
|
|
322
281
|
}
|
|
323
282
|
if (data.url.startsWith("file://")) {
|
|
324
283
|
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);
|
|
284
|
+
return await this.sendEmbed((0, import_fs.readFileSync)(data.url.slice(7)), addition, data.file || filename);
|
|
326
285
|
} else if (data.url.startsWith("base64://")) {
|
|
327
286
|
const a = Buffer.from(data.url.slice(9), "base64");
|
|
328
287
|
return await this.sendEmbed(a, addition, data.file);
|
|
@@ -335,8 +294,9 @@ var Sender = class {
|
|
|
335
294
|
}, "sendDirect");
|
|
336
295
|
const sendDownload = /* @__PURE__ */ __name(async () => {
|
|
337
296
|
const filename = (0, import_path.basename)(data.url);
|
|
338
|
-
const buffer = await this.bot.app.http.get
|
|
339
|
-
accept: type + "/*"
|
|
297
|
+
const buffer = await this.bot.app.http.get(data.url, {
|
|
298
|
+
headers: { accept: type + "/*" },
|
|
299
|
+
responseType: "arraybuffer"
|
|
340
300
|
});
|
|
341
301
|
return this.sendEmbed(buffer, addition, data.file || filename);
|
|
342
302
|
}, "sendDownload");
|
|
@@ -346,8 +306,8 @@ var Sender = class {
|
|
|
346
306
|
} else if (mode === "direct") {
|
|
347
307
|
return sendDirect();
|
|
348
308
|
}
|
|
349
|
-
await this.bot.app.http.head(data.url, {
|
|
350
|
-
accept: type + "/*"
|
|
309
|
+
return await this.bot.app.http.head(data.url, {
|
|
310
|
+
headers: { accept: type + "/*" }
|
|
351
311
|
}).then((headers) => {
|
|
352
312
|
if (headers["content-type"].startsWith(type)) {
|
|
353
313
|
return sendDirect();
|
|
@@ -356,6 +316,53 @@ var Sender = class {
|
|
|
356
316
|
}
|
|
357
317
|
}, sendDownload);
|
|
358
318
|
}
|
|
319
|
+
async sendMessage(content, addition = {}) {
|
|
320
|
+
const chain = import_koishi2.segment.parse(content);
|
|
321
|
+
let textBuffer = "";
|
|
322
|
+
delete addition.content;
|
|
323
|
+
const sendBuffer = /* @__PURE__ */ __name(async () => {
|
|
324
|
+
const content2 = textBuffer.trim();
|
|
325
|
+
if (!content2)
|
|
326
|
+
return;
|
|
327
|
+
await this.post(__spreadProps(__spreadValues({}, addition), { content: content2 }));
|
|
328
|
+
textBuffer = "";
|
|
329
|
+
}, "sendBuffer");
|
|
330
|
+
for (const code of chain) {
|
|
331
|
+
const { type, data } = code;
|
|
332
|
+
if (type === "text") {
|
|
333
|
+
textBuffer += data.content.trim();
|
|
334
|
+
} else if (type === "at" && data.id) {
|
|
335
|
+
textBuffer += `<@${data.id}>`;
|
|
336
|
+
} else if (type === "at" && data.type === "all") {
|
|
337
|
+
textBuffer += `@everyone`;
|
|
338
|
+
} else if (type === "at" && data.type === "here") {
|
|
339
|
+
textBuffer += `@here`;
|
|
340
|
+
} else if (type === "sharp" && data.id) {
|
|
341
|
+
textBuffer += `<#${data.id}>`;
|
|
342
|
+
} else if (type === "face" && data.name && data.id) {
|
|
343
|
+
textBuffer += `<:${data.name}:${data.id}>`;
|
|
344
|
+
} else if ((type === "image" || type === "video") && data.url) {
|
|
345
|
+
await this.sendAsset(type, data, __spreadProps(__spreadValues({}, addition), {
|
|
346
|
+
content: textBuffer.trim()
|
|
347
|
+
}));
|
|
348
|
+
textBuffer = "";
|
|
349
|
+
} else if (type === "share") {
|
|
350
|
+
await sendBuffer();
|
|
351
|
+
await this.post(__spreadProps(__spreadValues({}, addition), {
|
|
352
|
+
embeds: [__spreadValues({}, data)]
|
|
353
|
+
}));
|
|
354
|
+
} else if (type === "record") {
|
|
355
|
+
await this.sendAsset("file", data, __spreadProps(__spreadValues({}, addition), {
|
|
356
|
+
content: textBuffer.trim()
|
|
357
|
+
}));
|
|
358
|
+
textBuffer = "";
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
await sendBuffer();
|
|
362
|
+
if (!this.errors.length)
|
|
363
|
+
return this.results;
|
|
364
|
+
throw new import_es_aggregate_error.default(this.errors);
|
|
365
|
+
}
|
|
359
366
|
};
|
|
360
367
|
__name(Sender, "Sender");
|
|
361
368
|
|
|
@@ -365,50 +372,68 @@ __export(types_exports, {
|
|
|
365
372
|
ActivityFlag: () => ActivityFlag,
|
|
366
373
|
ActivityType: () => ActivityType,
|
|
367
374
|
AllowedMentionType: () => AllowedMentionType,
|
|
368
|
-
|
|
369
|
-
ApplicationCommandPermissionType: () => ApplicationCommandPermissionType,
|
|
370
|
-
ApplicationCommandType: () => ApplicationCommandType,
|
|
375
|
+
ApplicationCommand: () => ApplicationCommand,
|
|
371
376
|
ApplicationFlag: () => ApplicationFlag,
|
|
372
|
-
|
|
373
|
-
|
|
377
|
+
AuditLog: () => AuditLog,
|
|
378
|
+
Channel: () => Channel2,
|
|
374
379
|
ComponentType: () => ComponentType,
|
|
375
380
|
DeviceType: () => DeviceType,
|
|
376
381
|
GatewayIntent: () => GatewayIntent,
|
|
377
382
|
GatewayOpcode: () => GatewayOpcode,
|
|
383
|
+
Guild: () => Guild3,
|
|
378
384
|
GuildFeature: () => GuildFeature,
|
|
385
|
+
GuildScheduledEvent: () => GuildScheduledEvent,
|
|
379
386
|
IntegrationExpireBehavior: () => IntegrationExpireBehavior,
|
|
380
387
|
InteractionCallbackDataFlag: () => InteractionCallbackDataFlag,
|
|
381
388
|
InteractionCallbackType: () => InteractionCallbackType,
|
|
382
389
|
InteractionType: () => InteractionType,
|
|
383
390
|
Internal: () => Internal,
|
|
384
|
-
|
|
391
|
+
Invite: () => Invite,
|
|
385
392
|
MembershipState: () => MembershipState,
|
|
386
|
-
|
|
387
|
-
MessageFlag: () => MessageFlag,
|
|
388
|
-
MessageType: () => MessageType,
|
|
393
|
+
Message: () => Message2,
|
|
389
394
|
Permission: () => Permission,
|
|
390
395
|
StatusType: () => StatusType2,
|
|
391
|
-
|
|
392
|
-
StickerType: () => StickerType,
|
|
396
|
+
Sticker: () => Sticker3,
|
|
393
397
|
SystemChannelFlag: () => SystemChannelFlag,
|
|
394
398
|
UserFlag: () => UserFlag,
|
|
395
399
|
VisibilityType: () => VisibilityType,
|
|
396
|
-
|
|
400
|
+
Webhook: () => Webhook2
|
|
397
401
|
});
|
|
398
402
|
|
|
399
403
|
// plugins/adapter/discord/src/types/internal.ts
|
|
404
|
+
var import_koishi3 = __toModule(require("koishi"));
|
|
400
405
|
var Internal = class {
|
|
401
406
|
constructor(http) {
|
|
402
407
|
this.http = http;
|
|
403
408
|
}
|
|
404
409
|
static define(routes) {
|
|
405
410
|
for (const path in routes) {
|
|
406
|
-
for (const
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
411
|
+
for (const key in routes[path]) {
|
|
412
|
+
const method = key;
|
|
413
|
+
for (const name of (0, import_koishi3.makeArray)(routes[path][method])) {
|
|
414
|
+
Internal.prototype[name] = function(...args) {
|
|
415
|
+
const raw = args.join(", ");
|
|
416
|
+
const url = path.replace(/\{([^}]+)\}/g, () => {
|
|
417
|
+
if (!args.length)
|
|
418
|
+
throw new Error(`too few arguments for ${path}, received ${raw}`);
|
|
419
|
+
return args.shift();
|
|
420
|
+
});
|
|
421
|
+
const config = {};
|
|
422
|
+
if (args.length === 1) {
|
|
423
|
+
if (method === "GET" || method === "DELETE") {
|
|
424
|
+
config.params = args[0];
|
|
425
|
+
} else {
|
|
426
|
+
config.data = args[0];
|
|
427
|
+
}
|
|
428
|
+
} else if (args.length === 2 && method !== "GET" && method !== "DELETE") {
|
|
429
|
+
config.data = args[0];
|
|
430
|
+
config.params = args[1];
|
|
431
|
+
} else if (args.length > 1) {
|
|
432
|
+
throw new Error(`too many arguments for ${path}, received ${raw}`);
|
|
433
|
+
}
|
|
434
|
+
return this.http(method, url, config);
|
|
435
|
+
};
|
|
436
|
+
}
|
|
412
437
|
}
|
|
413
438
|
}
|
|
414
439
|
}
|
|
@@ -435,80 +460,103 @@ Internal.define({
|
|
|
435
460
|
});
|
|
436
461
|
|
|
437
462
|
// plugins/adapter/discord/src/types/audit-log.ts
|
|
438
|
-
var
|
|
439
|
-
(function(
|
|
440
|
-
|
|
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
|
-
|
|
463
|
+
var AuditLog;
|
|
464
|
+
(function(AuditLog2) {
|
|
465
|
+
let Type;
|
|
466
|
+
(function(Type2) {
|
|
467
|
+
Type2[Type2["GUILD_UPDATE"] = 1] = "GUILD_UPDATE";
|
|
468
|
+
Type2[Type2["CHANNEL_CREATE"] = 10] = "CHANNEL_CREATE";
|
|
469
|
+
Type2[Type2["CHANNEL_UPDATE"] = 11] = "CHANNEL_UPDATE";
|
|
470
|
+
Type2[Type2["CHANNEL_DELETE"] = 12] = "CHANNEL_DELETE";
|
|
471
|
+
Type2[Type2["CHANNEL_OVERWRITE_CREATE"] = 13] = "CHANNEL_OVERWRITE_CREATE";
|
|
472
|
+
Type2[Type2["CHANNEL_OVERWRITE_UPDATE"] = 14] = "CHANNEL_OVERWRITE_UPDATE";
|
|
473
|
+
Type2[Type2["CHANNEL_OVERWRITE_DELETE"] = 15] = "CHANNEL_OVERWRITE_DELETE";
|
|
474
|
+
Type2[Type2["MEMBER_KICK"] = 20] = "MEMBER_KICK";
|
|
475
|
+
Type2[Type2["MEMBER_PRUNE"] = 21] = "MEMBER_PRUNE";
|
|
476
|
+
Type2[Type2["MEMBER_BAN_ADD"] = 22] = "MEMBER_BAN_ADD";
|
|
477
|
+
Type2[Type2["MEMBER_BAN_REMOVE"] = 23] = "MEMBER_BAN_REMOVE";
|
|
478
|
+
Type2[Type2["MEMBER_UPDATE"] = 24] = "MEMBER_UPDATE";
|
|
479
|
+
Type2[Type2["MEMBER_ROLE_UPDATE"] = 25] = "MEMBER_ROLE_UPDATE";
|
|
480
|
+
Type2[Type2["MEMBER_MOVE"] = 26] = "MEMBER_MOVE";
|
|
481
|
+
Type2[Type2["MEMBER_DISCONNECT"] = 27] = "MEMBER_DISCONNECT";
|
|
482
|
+
Type2[Type2["BOT_ADD"] = 28] = "BOT_ADD";
|
|
483
|
+
Type2[Type2["ROLE_CREATE"] = 30] = "ROLE_CREATE";
|
|
484
|
+
Type2[Type2["ROLE_UPDATE"] = 31] = "ROLE_UPDATE";
|
|
485
|
+
Type2[Type2["ROLE_DELETE"] = 32] = "ROLE_DELETE";
|
|
486
|
+
Type2[Type2["INVITE_CREATE"] = 40] = "INVITE_CREATE";
|
|
487
|
+
Type2[Type2["INVITE_UPDATE"] = 41] = "INVITE_UPDATE";
|
|
488
|
+
Type2[Type2["INVITE_DELETE"] = 42] = "INVITE_DELETE";
|
|
489
|
+
Type2[Type2["WEBHOOK_CREATE"] = 50] = "WEBHOOK_CREATE";
|
|
490
|
+
Type2[Type2["WEBHOOK_UPDATE"] = 51] = "WEBHOOK_UPDATE";
|
|
491
|
+
Type2[Type2["WEBHOOK_DELETE"] = 52] = "WEBHOOK_DELETE";
|
|
492
|
+
Type2[Type2["EMOJI_CREATE"] = 60] = "EMOJI_CREATE";
|
|
493
|
+
Type2[Type2["EMOJI_UPDATE"] = 61] = "EMOJI_UPDATE";
|
|
494
|
+
Type2[Type2["EMOJI_DELETE"] = 62] = "EMOJI_DELETE";
|
|
495
|
+
Type2[Type2["MESSAGE_DELETE"] = 72] = "MESSAGE_DELETE";
|
|
496
|
+
Type2[Type2["MESSAGE_BULK_DELETE"] = 73] = "MESSAGE_BULK_DELETE";
|
|
497
|
+
Type2[Type2["MESSAGE_PIN"] = 74] = "MESSAGE_PIN";
|
|
498
|
+
Type2[Type2["MESSAGE_UNPIN"] = 75] = "MESSAGE_UNPIN";
|
|
499
|
+
Type2[Type2["INTEGRATION_CREATE"] = 80] = "INTEGRATION_CREATE";
|
|
500
|
+
Type2[Type2["INTEGRATION_UPDATE"] = 81] = "INTEGRATION_UPDATE";
|
|
501
|
+
Type2[Type2["INTEGRATION_DELETE"] = 82] = "INTEGRATION_DELETE";
|
|
502
|
+
Type2[Type2["STAGE_INSTANCE_CREATE"] = 83] = "STAGE_INSTANCE_CREATE";
|
|
503
|
+
Type2[Type2["STAGE_INSTANCE_UPDATE"] = 84] = "STAGE_INSTANCE_UPDATE";
|
|
504
|
+
Type2[Type2["STAGE_INSTANCE_DELETE"] = 85] = "STAGE_INSTANCE_DELETE";
|
|
505
|
+
Type2[Type2["STICKER_CREATE"] = 90] = "STICKER_CREATE";
|
|
506
|
+
Type2[Type2["STICKER_UPDATE"] = 91] = "STICKER_UPDATE";
|
|
507
|
+
Type2[Type2["STICKER_DELETE"] = 92] = "STICKER_DELETE";
|
|
508
|
+
Type2[Type2["THREAD_CREATE"] = 110] = "THREAD_CREATE";
|
|
509
|
+
Type2[Type2["THREAD_UPDATE"] = 111] = "THREAD_UPDATE";
|
|
510
|
+
Type2[Type2["THREAD_DELETE"] = 112] = "THREAD_DELETE";
|
|
511
|
+
})(Type = AuditLog2.Type || (AuditLog2.Type = {}));
|
|
512
|
+
})(AuditLog || (AuditLog = {}));
|
|
485
513
|
Internal.define({
|
|
486
514
|
"/guilds/{guild.id}/audit-logs": {
|
|
487
515
|
GET: "getGuildAuditLog"
|
|
488
516
|
}
|
|
489
517
|
});
|
|
490
518
|
|
|
519
|
+
// plugins/adapter/discord/src/types/ban.ts
|
|
520
|
+
Internal.define({
|
|
521
|
+
"/guilds/{guild.id}/bans": {
|
|
522
|
+
GET: "getGuildBans"
|
|
523
|
+
},
|
|
524
|
+
"/guilds/{guild.id}/bans/{user.id}": {
|
|
525
|
+
GET: "getGuildBan",
|
|
526
|
+
PUT: "createGuildBan",
|
|
527
|
+
DELETE: "removeGuildBan"
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
|
|
491
531
|
// plugins/adapter/discord/src/types/channel.ts
|
|
492
|
-
var
|
|
493
|
-
(function(
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
532
|
+
var Channel2;
|
|
533
|
+
(function(Channel10) {
|
|
534
|
+
let Type;
|
|
535
|
+
(function(Type2) {
|
|
536
|
+
Type2[Type2["GUILD_TEXT"] = 0] = "GUILD_TEXT";
|
|
537
|
+
Type2[Type2["DM"] = 1] = "DM";
|
|
538
|
+
Type2[Type2["GUILD_VOICE"] = 2] = "GUILD_VOICE";
|
|
539
|
+
Type2[Type2["GROUP_DM"] = 3] = "GROUP_DM";
|
|
540
|
+
Type2[Type2["GUILD_CATEGORY"] = 4] = "GUILD_CATEGORY";
|
|
541
|
+
Type2[Type2["GUILD_NEWS"] = 5] = "GUILD_NEWS";
|
|
542
|
+
Type2[Type2["GUILD_STORE"] = 6] = "GUILD_STORE";
|
|
543
|
+
Type2[Type2["GUILD_NEWS_THREAD"] = 10] = "GUILD_NEWS_THREAD";
|
|
544
|
+
Type2[Type2["GUILD_PUBLIC_THREAD"] = 11] = "GUILD_PUBLIC_THREAD";
|
|
545
|
+
Type2[Type2["GUILD_PRIVATE_THREAD"] = 12] = "GUILD_PRIVATE_THREAD";
|
|
546
|
+
Type2[Type2["GUILD_STAGE_VOICE"] = 13] = "GUILD_STAGE_VOICE";
|
|
547
|
+
})(Type = Channel10.Type || (Channel10.Type = {}));
|
|
548
|
+
})(Channel2 || (Channel2 = {}));
|
|
506
549
|
var AllowedMentionType;
|
|
507
550
|
(function(AllowedMentionType2) {
|
|
508
551
|
AllowedMentionType2["ROLE_MENTIONS"] = "roles";
|
|
509
552
|
AllowedMentionType2["USER_MENTIONS"] = "users";
|
|
510
553
|
AllowedMentionType2["EVERYONE_MENTIONS"] = "everyone";
|
|
511
554
|
})(AllowedMentionType || (AllowedMentionType = {}));
|
|
555
|
+
Internal.define({
|
|
556
|
+
"/users/@me/channels": {
|
|
557
|
+
POST: ["createDM", "createGroupDM"]
|
|
558
|
+
}
|
|
559
|
+
});
|
|
512
560
|
Internal.define({
|
|
513
561
|
"/guilds/{guild.id}/channels": {
|
|
514
562
|
GET: "getGuildChannels",
|
|
@@ -526,84 +574,46 @@ Internal.define({
|
|
|
526
574
|
PUT: "editChannelPermissions",
|
|
527
575
|
DELETE: "deleteChannelPermission"
|
|
528
576
|
},
|
|
529
|
-
"/channels/{channel.id}/invites": {
|
|
530
|
-
GET: "getChannelInvites",
|
|
531
|
-
POST: "createChannelInvite"
|
|
532
|
-
},
|
|
533
577
|
"/channels/{channel.id}/followers": {
|
|
534
578
|
POST: "followNewsChannel"
|
|
535
579
|
},
|
|
536
580
|
"/channels/{channel.id}/typing": {
|
|
537
581
|
POST: "triggerTypingIndicator"
|
|
538
582
|
},
|
|
539
|
-
"/channels/{channel.id}/pins": {
|
|
540
|
-
GET: "getPinnedMessages"
|
|
541
|
-
},
|
|
542
|
-
"/channels/{channel.id}/pins/{message.id}": {
|
|
543
|
-
PUT: "pinMessage",
|
|
544
|
-
DELETE: "unpinMessage"
|
|
545
|
-
},
|
|
546
583
|
"/channels/{channel.id}/recipients/{user.id}": {
|
|
547
584
|
PUT: "groupDMAddRecipient",
|
|
548
585
|
DELETE: "groupDMRemoveRecipient"
|
|
549
|
-
},
|
|
550
|
-
"/channels/{channel.id}/messages/{message.id}/threads": {
|
|
551
|
-
POST: "startThreadwithMessage"
|
|
552
|
-
},
|
|
553
|
-
"/channels/{channel.id}/threads": {
|
|
554
|
-
POST: "startThreadwithoutMessage"
|
|
555
|
-
},
|
|
556
|
-
"/channels/{channel.id}/thread-members/@me": {
|
|
557
|
-
PUT: "joinThread",
|
|
558
|
-
DELETE: "leaveThread"
|
|
559
|
-
},
|
|
560
|
-
"/channels/{channel.id}/thread-members/{user.id}": {
|
|
561
|
-
PUT: "addThreadMember",
|
|
562
|
-
DELETE: "removeThreadMember",
|
|
563
|
-
GET: "getThreadMember"
|
|
564
|
-
},
|
|
565
|
-
"/channels/{channel.id}/thread-members": {
|
|
566
|
-
GET: "listThreadMembers"
|
|
567
|
-
},
|
|
568
|
-
"/channels/{channel.id}/threads/active": {
|
|
569
|
-
GET: "listActiveThreads"
|
|
570
|
-
},
|
|
571
|
-
"/channels/{channel.id}/threads/archived/public": {
|
|
572
|
-
GET: "listPublicArchivedThreads"
|
|
573
|
-
},
|
|
574
|
-
"/channels/{channel.id}/threads/archived/private": {
|
|
575
|
-
GET: "listPrivateArchivedThreads"
|
|
576
|
-
},
|
|
577
|
-
"/channels/{channel.id}/users/@me/threads/archived/private": {
|
|
578
|
-
GET: "listJoinedPrivateArchivedThreads"
|
|
579
586
|
}
|
|
580
587
|
});
|
|
581
588
|
|
|
582
589
|
// plugins/adapter/discord/src/types/command.ts
|
|
583
|
-
var
|
|
584
|
-
(function(
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
(
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
(
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
590
|
+
var ApplicationCommand;
|
|
591
|
+
(function(ApplicationCommand3) {
|
|
592
|
+
let Type;
|
|
593
|
+
(function(Type2) {
|
|
594
|
+
Type2[Type2["CHAT_INPUT"] = 1] = "CHAT_INPUT";
|
|
595
|
+
Type2[Type2["USER"] = 2] = "USER";
|
|
596
|
+
Type2[Type2["MESSAGE"] = 3] = "MESSAGE";
|
|
597
|
+
})(Type = ApplicationCommand3.Type || (ApplicationCommand3.Type = {}));
|
|
598
|
+
let OptionType;
|
|
599
|
+
(function(OptionType2) {
|
|
600
|
+
OptionType2[OptionType2["SUB_COMMAND"] = 1] = "SUB_COMMAND";
|
|
601
|
+
OptionType2[OptionType2["SUB_COMMAND_GROUP"] = 2] = "SUB_COMMAND_GROUP";
|
|
602
|
+
OptionType2[OptionType2["STRING"] = 3] = "STRING";
|
|
603
|
+
OptionType2[OptionType2["INTEGER"] = 4] = "INTEGER";
|
|
604
|
+
OptionType2[OptionType2["BOOLEAN"] = 5] = "BOOLEAN";
|
|
605
|
+
OptionType2[OptionType2["USER"] = 6] = "USER";
|
|
606
|
+
OptionType2[OptionType2["CHANNEL"] = 7] = "CHANNEL";
|
|
607
|
+
OptionType2[OptionType2["ROLE"] = 8] = "ROLE";
|
|
608
|
+
OptionType2[OptionType2["MENTIONABLE"] = 9] = "MENTIONABLE";
|
|
609
|
+
OptionType2[OptionType2["NUMBER"] = 10] = "NUMBER";
|
|
610
|
+
})(OptionType = ApplicationCommand3.OptionType || (ApplicationCommand3.OptionType = {}));
|
|
611
|
+
let PermissionType;
|
|
612
|
+
(function(PermissionType2) {
|
|
613
|
+
PermissionType2[PermissionType2["ROLE"] = 1] = "ROLE";
|
|
614
|
+
PermissionType2[PermissionType2["USER"] = 2] = "USER";
|
|
615
|
+
})(PermissionType = ApplicationCommand3.PermissionType || (ApplicationCommand3.PermissionType = {}));
|
|
616
|
+
})(ApplicationCommand || (ApplicationCommand = {}));
|
|
607
617
|
Internal.define({
|
|
608
618
|
"/applications/{application.id}/commands": {
|
|
609
619
|
GET: "getGlobalApplicationCommands",
|
|
@@ -663,22 +673,6 @@ Internal.define({
|
|
|
663
673
|
DELETE: "deleteGuildEmoji"
|
|
664
674
|
}
|
|
665
675
|
});
|
|
666
|
-
Internal.define({
|
|
667
|
-
"/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/@me": {
|
|
668
|
-
PUT: "createReaction",
|
|
669
|
-
DELETE: "deleteOwnReaction"
|
|
670
|
-
},
|
|
671
|
-
"/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/{user.id}": {
|
|
672
|
-
DELETE: "deleteUserReaction"
|
|
673
|
-
},
|
|
674
|
-
"/channels/{channel.id}/messages/{message.id}/reactions/{emoji}": {
|
|
675
|
-
GET: "getReactions",
|
|
676
|
-
DELETE: "deleteAllReactionsforEmoji"
|
|
677
|
-
},
|
|
678
|
-
"/channels/{channel.id}/messages/{message.id}/reactions": {
|
|
679
|
-
DELETE: "deleteAllReactions"
|
|
680
|
-
}
|
|
681
|
-
});
|
|
682
676
|
|
|
683
677
|
// plugins/adapter/discord/src/types/gateway.ts
|
|
684
678
|
var GatewayOpcode;
|
|
@@ -739,12 +733,13 @@ Internal.define({
|
|
|
739
733
|
"/guilds/{guild.id}/members/@me": {
|
|
740
734
|
PATCH: "modifyCurrentMember"
|
|
741
735
|
},
|
|
742
|
-
"/guilds/{guild.id}/members/@me/nick": {
|
|
743
|
-
PATCH: "modifyCurrentUserNick"
|
|
744
|
-
},
|
|
745
736
|
"/guilds/{guild.id}/members/{user.id}/roles/{role.id}": {
|
|
746
737
|
PUT: "addGuildMemberRole",
|
|
747
738
|
DELETE: "removeGuildMemberRole"
|
|
739
|
+
},
|
|
740
|
+
"/guilds/{guild.id}/prune": {
|
|
741
|
+
GET: "getGuildPruneCount",
|
|
742
|
+
POST: "beginGuildPrune"
|
|
748
743
|
}
|
|
749
744
|
});
|
|
750
745
|
|
|
@@ -766,6 +761,20 @@ Internal.define({
|
|
|
766
761
|
});
|
|
767
762
|
|
|
768
763
|
// plugins/adapter/discord/src/types/guild.ts
|
|
764
|
+
var Guild3;
|
|
765
|
+
(function(Guild6) {
|
|
766
|
+
let Params;
|
|
767
|
+
(function(Params2) {
|
|
768
|
+
let WidgetStyleOptions;
|
|
769
|
+
(function(WidgetStyleOptions2) {
|
|
770
|
+
WidgetStyleOptions2["shield"] = "shield";
|
|
771
|
+
WidgetStyleOptions2["banner1"] = "banner1";
|
|
772
|
+
WidgetStyleOptions2["banner2"] = "banner2";
|
|
773
|
+
WidgetStyleOptions2["banner3"] = "banner3";
|
|
774
|
+
WidgetStyleOptions2["banner4"] = "banner4";
|
|
775
|
+
})(WidgetStyleOptions = Params2.WidgetStyleOptions || (Params2.WidgetStyleOptions = {}));
|
|
776
|
+
})(Params = Guild6.Params || (Guild6.Params = {}));
|
|
777
|
+
})(Guild3 || (Guild3 = {}));
|
|
769
778
|
var SystemChannelFlag;
|
|
770
779
|
(function(SystemChannelFlag2) {
|
|
771
780
|
SystemChannelFlag2[SystemChannelFlag2["SUPPRESS_JOIN_NOTIFICATIONS"] = 1] = "SUPPRESS_JOIN_NOTIFICATIONS";
|
|
@@ -801,6 +810,9 @@ Internal.define({
|
|
|
801
810
|
"/users/@me/guilds": {
|
|
802
811
|
GET: "getCurrentUserGuilds"
|
|
803
812
|
},
|
|
813
|
+
"/users/@me/guilds/{guild.id}/member": {
|
|
814
|
+
GET: "getCurrentUserGuildMember"
|
|
815
|
+
},
|
|
804
816
|
"/users/@me/guilds/{guild.id}": {
|
|
805
817
|
DELETE: "leaveGuild"
|
|
806
818
|
}
|
|
@@ -817,42 +829,6 @@ Internal.define({
|
|
|
817
829
|
"/guilds/{guild.id}/preview": {
|
|
818
830
|
GET: "getGuildPreview"
|
|
819
831
|
},
|
|
820
|
-
"/guilds/{guild.id}/threads/active": {
|
|
821
|
-
GET: "listActiveThreads"
|
|
822
|
-
},
|
|
823
|
-
"/guilds/{guild.id}/bans": {
|
|
824
|
-
GET: "getGuildBans"
|
|
825
|
-
},
|
|
826
|
-
"/guilds/{guild.id}/bans/{user.id}": {
|
|
827
|
-
GET: "getGuildBan",
|
|
828
|
-
PUT: "createGuildBan",
|
|
829
|
-
DELETE: "removeGuildBan"
|
|
830
|
-
},
|
|
831
|
-
"/guilds/{guild.id}/roles": {
|
|
832
|
-
GET: "getGuildRoles",
|
|
833
|
-
POST: "createGuildRole",
|
|
834
|
-
PATCH: "modifyGuildRolePositions"
|
|
835
|
-
},
|
|
836
|
-
"/guilds/{guild.id}/roles/{role.id}": {
|
|
837
|
-
PATCH: "modifyGuildRole",
|
|
838
|
-
DELETE: "deleteGuildRole"
|
|
839
|
-
},
|
|
840
|
-
"/guilds/{guild.id}/prune": {
|
|
841
|
-
GET: "getGuildPruneCount",
|
|
842
|
-
POST: "beginGuildPrune"
|
|
843
|
-
},
|
|
844
|
-
"/guilds/{guild.id}/regions": {
|
|
845
|
-
GET: "getGuildVoiceRegions"
|
|
846
|
-
},
|
|
847
|
-
"/guilds/{guild.id}/invites": {
|
|
848
|
-
GET: "getGuildInvites"
|
|
849
|
-
},
|
|
850
|
-
"/guilds/{guild.id}/integrations": {
|
|
851
|
-
GET: "getGuildIntegrations"
|
|
852
|
-
},
|
|
853
|
-
"/guilds/{guild.id}/integrations/{integration.id}": {
|
|
854
|
-
DELETE: "deleteGuildIntegration"
|
|
855
|
-
},
|
|
856
832
|
"/guilds/{guild.id}/widget": {
|
|
857
833
|
GET: "getGuildWidgetSettings",
|
|
858
834
|
PATCH: "modifyGuildWidget"
|
|
@@ -860,21 +836,12 @@ Internal.define({
|
|
|
860
836
|
"/guilds/{guild.id}/widget.json": {
|
|
861
837
|
GET: "getGuildWidget"
|
|
862
838
|
},
|
|
863
|
-
"/guilds/{guild.id}/vanity-url": {
|
|
864
|
-
GET: "getGuildVanityURL"
|
|
865
|
-
},
|
|
866
839
|
"/guilds/{guild.id}/widget.png": {
|
|
867
840
|
GET: "getGuildWidgetImage"
|
|
868
841
|
},
|
|
869
842
|
"/guilds/{guild.id}/welcome-screen": {
|
|
870
843
|
GET: "getGuildWelcomeScreen",
|
|
871
844
|
PATCH: "modifyGuildWelcomeScreen"
|
|
872
|
-
},
|
|
873
|
-
"/guilds/{guild.id}/voice-states/@me": {
|
|
874
|
-
PATCH: "modifyCurrentUserVoiceState"
|
|
875
|
-
},
|
|
876
|
-
"/guilds/{guild.id}/voice-states/{user.id}": {
|
|
877
|
-
PATCH: "modifyUserVoiceState"
|
|
878
845
|
}
|
|
879
846
|
});
|
|
880
847
|
|
|
@@ -884,6 +851,14 @@ var IntegrationExpireBehavior;
|
|
|
884
851
|
IntegrationExpireBehavior2[IntegrationExpireBehavior2["REMOVE_ROLE"] = 0] = "REMOVE_ROLE";
|
|
885
852
|
IntegrationExpireBehavior2[IntegrationExpireBehavior2["KICK"] = 1] = "KICK";
|
|
886
853
|
})(IntegrationExpireBehavior || (IntegrationExpireBehavior = {}));
|
|
854
|
+
Internal.define({
|
|
855
|
+
"/guilds/{guild.id}/integrations": {
|
|
856
|
+
GET: "getGuildIntegrations"
|
|
857
|
+
},
|
|
858
|
+
"/guilds/{guild.id}/integrations/{integration.id}": {
|
|
859
|
+
DELETE: "deleteGuildIntegration"
|
|
860
|
+
}
|
|
861
|
+
});
|
|
887
862
|
|
|
888
863
|
// plugins/adapter/discord/src/types/interaction.ts
|
|
889
864
|
var InteractionType;
|
|
@@ -924,63 +899,79 @@ Internal.define({
|
|
|
924
899
|
});
|
|
925
900
|
|
|
926
901
|
// plugins/adapter/discord/src/types/invite.ts
|
|
927
|
-
var
|
|
928
|
-
(function(
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
902
|
+
var Invite;
|
|
903
|
+
(function(Invite2) {
|
|
904
|
+
let TargetType;
|
|
905
|
+
(function(TargetType2) {
|
|
906
|
+
TargetType2[TargetType2["STREAM"] = 1] = "STREAM";
|
|
907
|
+
TargetType2[TargetType2["EMBEDDED_APPLICATION"] = 2] = "EMBEDDED_APPLICATION";
|
|
908
|
+
})(TargetType = Invite2.TargetType || (Invite2.TargetType = {}));
|
|
909
|
+
})(Invite || (Invite = {}));
|
|
932
910
|
Internal.define({
|
|
933
911
|
"/invites/{invite.code}": {
|
|
934
912
|
GET: "getInvite",
|
|
935
913
|
DELETE: "deleteInvite"
|
|
914
|
+
},
|
|
915
|
+
"/guilds/{guild.id}/invites": {
|
|
916
|
+
GET: "getGuildInvites"
|
|
917
|
+
},
|
|
918
|
+
"/guilds/{guild.id}/vanity-url": {
|
|
919
|
+
GET: "getGuildVanityURL"
|
|
920
|
+
},
|
|
921
|
+
"/channels/{channel.id}/invites": {
|
|
922
|
+
GET: "getChannelInvites",
|
|
923
|
+
POST: "createChannelInvite"
|
|
936
924
|
}
|
|
937
925
|
});
|
|
938
926
|
|
|
939
927
|
// plugins/adapter/discord/src/types/message.ts
|
|
940
|
-
var
|
|
941
|
-
(function(
|
|
942
|
-
|
|
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
|
-
|
|
928
|
+
var Message2;
|
|
929
|
+
(function(Message4) {
|
|
930
|
+
let Type;
|
|
931
|
+
(function(Type2) {
|
|
932
|
+
Type2[Type2["DEFAULT"] = 0] = "DEFAULT";
|
|
933
|
+
Type2[Type2["RECIPIENT_ADD"] = 1] = "RECIPIENT_ADD";
|
|
934
|
+
Type2[Type2["RECIPIENT_REMOVE"] = 2] = "RECIPIENT_REMOVE";
|
|
935
|
+
Type2[Type2["CALL"] = 3] = "CALL";
|
|
936
|
+
Type2[Type2["CHANNEL_NAME_CHANGE"] = 4] = "CHANNEL_NAME_CHANGE";
|
|
937
|
+
Type2[Type2["CHANNEL_ICON_CHANGE"] = 5] = "CHANNEL_ICON_CHANGE";
|
|
938
|
+
Type2[Type2["CHANNEL_PINNED_MESSAGE"] = 6] = "CHANNEL_PINNED_MESSAGE";
|
|
939
|
+
Type2[Type2["GUILD_MEMBER_JOIN"] = 7] = "GUILD_MEMBER_JOIN";
|
|
940
|
+
Type2[Type2["USER_PREMIUM_GUILD_SUBSCRIPTION"] = 8] = "USER_PREMIUM_GUILD_SUBSCRIPTION";
|
|
941
|
+
Type2[Type2["USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1"] = 9] = "USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1";
|
|
942
|
+
Type2[Type2["USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2"] = 10] = "USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2";
|
|
943
|
+
Type2[Type2["USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3"] = 11] = "USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3";
|
|
944
|
+
Type2[Type2["CHANNEL_FOLLOW_ADD"] = 12] = "CHANNEL_FOLLOW_ADD";
|
|
945
|
+
Type2[Type2["GUILD_DISCOVERY_DISQUALIFIED"] = 14] = "GUILD_DISCOVERY_DISQUALIFIED";
|
|
946
|
+
Type2[Type2["GUILD_DISCOVERY_REQUALIFIED"] = 15] = "GUILD_DISCOVERY_REQUALIFIED";
|
|
947
|
+
Type2[Type2["GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING"] = 16] = "GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING";
|
|
948
|
+
Type2[Type2["GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING"] = 17] = "GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING";
|
|
949
|
+
Type2[Type2["THREAD_CREATED"] = 18] = "THREAD_CREATED";
|
|
950
|
+
Type2[Type2["REPLY"] = 19] = "REPLY";
|
|
951
|
+
Type2[Type2["CHAT_INPUT_COMMAND"] = 20] = "CHAT_INPUT_COMMAND";
|
|
952
|
+
Type2[Type2["THREAD_STARTER_MESSAGE"] = 21] = "THREAD_STARTER_MESSAGE";
|
|
953
|
+
Type2[Type2["GUILD_INVITE_REMINDER"] = 22] = "GUILD_INVITE_REMINDER";
|
|
954
|
+
Type2[Type2["CONTEXT_MENU_COMMAND"] = 23] = "CONTEXT_MENU_COMMAND";
|
|
955
|
+
})(Type = Message4.Type || (Message4.Type = {}));
|
|
956
|
+
let ActivityType2;
|
|
957
|
+
(function(ActivityType3) {
|
|
958
|
+
ActivityType3[ActivityType3["JOIN"] = 1] = "JOIN";
|
|
959
|
+
ActivityType3[ActivityType3["SPECTATE"] = 2] = "SPECTATE";
|
|
960
|
+
ActivityType3[ActivityType3["LISTEN"] = 3] = "LISTEN";
|
|
961
|
+
ActivityType3[ActivityType3["JOIN_REQUEST"] = 5] = "JOIN_REQUEST";
|
|
962
|
+
})(ActivityType2 = Message4.ActivityType || (Message4.ActivityType = {}));
|
|
963
|
+
let Flag;
|
|
964
|
+
(function(Flag2) {
|
|
965
|
+
Flag2[Flag2["CROSSPOSTED"] = 1] = "CROSSPOSTED";
|
|
966
|
+
Flag2[Flag2["IS_CROSSPOST"] = 2] = "IS_CROSSPOST";
|
|
967
|
+
Flag2[Flag2["SUPPRESS_EMBEDS"] = 4] = "SUPPRESS_EMBEDS";
|
|
968
|
+
Flag2[Flag2["SOURCE_MESSAGE_DELETED"] = 8] = "SOURCE_MESSAGE_DELETED";
|
|
969
|
+
Flag2[Flag2["URGENT"] = 16] = "URGENT";
|
|
970
|
+
Flag2[Flag2["HAS_THREAD"] = 32] = "HAS_THREAD";
|
|
971
|
+
Flag2[Flag2["EPHEMERAL"] = 64] = "EPHEMERAL";
|
|
972
|
+
Flag2[Flag2["LOADING"] = 128] = "LOADING";
|
|
973
|
+
})(Flag = Message4.Flag || (Message4.Flag = {}));
|
|
974
|
+
})(Message2 || (Message2 = {}));
|
|
984
975
|
Internal.define({
|
|
985
976
|
"/channels/{channel.id}/messages": {
|
|
986
977
|
GET: "getChannelMessages",
|
|
@@ -996,6 +987,13 @@ Internal.define({
|
|
|
996
987
|
},
|
|
997
988
|
"/channels/{channel.id}/messages/bulk-delete": {
|
|
998
989
|
POST: "bulkDeleteMessages"
|
|
990
|
+
},
|
|
991
|
+
"/channels/{channel.id}/pins": {
|
|
992
|
+
GET: "getPinnedMessages"
|
|
993
|
+
},
|
|
994
|
+
"/channels/{channel.id}/pins/{message.id}": {
|
|
995
|
+
PUT: "pinMessage",
|
|
996
|
+
DELETE: "unpinMessage"
|
|
999
997
|
}
|
|
1000
998
|
});
|
|
1001
999
|
|
|
@@ -1027,6 +1025,24 @@ var ActivityFlag;
|
|
|
1027
1025
|
ActivityFlag2[ActivityFlag2["PLAY"] = 32] = "PLAY";
|
|
1028
1026
|
})(ActivityFlag || (ActivityFlag = {}));
|
|
1029
1027
|
|
|
1028
|
+
// plugins/adapter/discord/src/types/reaction.ts
|
|
1029
|
+
Internal.define({
|
|
1030
|
+
"/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/@me": {
|
|
1031
|
+
PUT: "createReaction",
|
|
1032
|
+
DELETE: "deleteOwnReaction"
|
|
1033
|
+
},
|
|
1034
|
+
"/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/{user.id}": {
|
|
1035
|
+
DELETE: "deleteUserReaction"
|
|
1036
|
+
},
|
|
1037
|
+
"/channels/{channel.id}/messages/{message.id}/reactions/{emoji}": {
|
|
1038
|
+
GET: "getReactions",
|
|
1039
|
+
DELETE: "deleteAllReactionsforEmoji"
|
|
1040
|
+
},
|
|
1041
|
+
"/channels/{channel.id}/messages/{message.id}/reactions": {
|
|
1042
|
+
DELETE: "deleteAllReactions"
|
|
1043
|
+
}
|
|
1044
|
+
});
|
|
1045
|
+
|
|
1030
1046
|
// plugins/adapter/discord/src/types/role.ts
|
|
1031
1047
|
var Permission;
|
|
1032
1048
|
(function(Permission2) {
|
|
@@ -1070,6 +1086,53 @@ var Permission;
|
|
|
1070
1086
|
Permission2[Permission2["SEND_MESSAGES_IN_THREADS"] = 64] = "SEND_MESSAGES_IN_THREADS";
|
|
1071
1087
|
Permission2[Permission2["START_EMBEDDED_ACTIVITIES"] = 128] = "START_EMBEDDED_ACTIVITIES";
|
|
1072
1088
|
})(Permission || (Permission = {}));
|
|
1089
|
+
Internal.define({
|
|
1090
|
+
"/guilds/{guild.id}/roles": {
|
|
1091
|
+
GET: "getGuildRoles",
|
|
1092
|
+
POST: "createGuildRole",
|
|
1093
|
+
PATCH: "modifyGuildRolePositions"
|
|
1094
|
+
},
|
|
1095
|
+
"/guilds/{guild.id}/roles/{role.id}": {
|
|
1096
|
+
PATCH: "modifyGuildRole",
|
|
1097
|
+
DELETE: "deleteGuildRole"
|
|
1098
|
+
}
|
|
1099
|
+
});
|
|
1100
|
+
|
|
1101
|
+
// plugins/adapter/discord/src/types/scheduled-event.ts
|
|
1102
|
+
var GuildScheduledEvent;
|
|
1103
|
+
(function(GuildScheduledEvent2) {
|
|
1104
|
+
let PrivacyLevel;
|
|
1105
|
+
(function(PrivacyLevel2) {
|
|
1106
|
+
PrivacyLevel2[PrivacyLevel2["GUILD_ONLY"] = 2] = "GUILD_ONLY";
|
|
1107
|
+
})(PrivacyLevel = GuildScheduledEvent2.PrivacyLevel || (GuildScheduledEvent2.PrivacyLevel = {}));
|
|
1108
|
+
let EntityType;
|
|
1109
|
+
(function(EntityType2) {
|
|
1110
|
+
EntityType2[EntityType2["STAGE_INSTANCE"] = 1] = "STAGE_INSTANCE";
|
|
1111
|
+
EntityType2[EntityType2["VOICE"] = 2] = "VOICE";
|
|
1112
|
+
EntityType2[EntityType2["EXTERNAL"] = 3] = "EXTERNAL";
|
|
1113
|
+
})(EntityType = GuildScheduledEvent2.EntityType || (GuildScheduledEvent2.EntityType = {}));
|
|
1114
|
+
let Status;
|
|
1115
|
+
(function(Status2) {
|
|
1116
|
+
Status2[Status2["SCHEDULED"] = 1] = "SCHEDULED";
|
|
1117
|
+
Status2[Status2["ACTIVE"] = 2] = "ACTIVE";
|
|
1118
|
+
Status2[Status2["COMPLETED"] = 3] = "COMPLETED";
|
|
1119
|
+
Status2[Status2["CANCELLED"] = 4] = "CANCELLED";
|
|
1120
|
+
})(Status = GuildScheduledEvent2.Status || (GuildScheduledEvent2.Status = {}));
|
|
1121
|
+
})(GuildScheduledEvent || (GuildScheduledEvent = {}));
|
|
1122
|
+
Internal.define({
|
|
1123
|
+
"/guilds/{guild.id}/scheduled-events": {
|
|
1124
|
+
GET: "listScheduledEventsforGuild",
|
|
1125
|
+
POST: "createGuildScheduledEvent"
|
|
1126
|
+
},
|
|
1127
|
+
"/guilds/{guild.id}/scheduled-events/{guild_scheduled_event.id}": {
|
|
1128
|
+
GET: "getGuildScheduledEvent",
|
|
1129
|
+
PATCH: "modifyGuildScheduledEvent",
|
|
1130
|
+
DELETE: "deleteGuildScheduledEvent"
|
|
1131
|
+
},
|
|
1132
|
+
"/guilds/{guild.id}/scheduled-events/{guild_scheduled_event.id}/users": {
|
|
1133
|
+
GET: "getGuildScheduledEventUsers"
|
|
1134
|
+
}
|
|
1135
|
+
});
|
|
1073
1136
|
|
|
1074
1137
|
// plugins/adapter/discord/src/types/stage-instance.ts
|
|
1075
1138
|
Internal.define({
|
|
@@ -1084,17 +1147,20 @@ Internal.define({
|
|
|
1084
1147
|
});
|
|
1085
1148
|
|
|
1086
1149
|
// plugins/adapter/discord/src/types/sticker.ts
|
|
1087
|
-
var
|
|
1088
|
-
(function(
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
(
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1150
|
+
var Sticker3;
|
|
1151
|
+
(function(Sticker4) {
|
|
1152
|
+
let Type;
|
|
1153
|
+
(function(Type2) {
|
|
1154
|
+
Type2[Type2["STANDARD"] = 1] = "STANDARD";
|
|
1155
|
+
Type2[Type2["GUILD"] = 2] = "GUILD";
|
|
1156
|
+
})(Type = Sticker4.Type || (Sticker4.Type = {}));
|
|
1157
|
+
let FormatType;
|
|
1158
|
+
(function(FormatType2) {
|
|
1159
|
+
FormatType2[FormatType2["PNG"] = 1] = "PNG";
|
|
1160
|
+
FormatType2[FormatType2["APNG"] = 2] = "APNG";
|
|
1161
|
+
FormatType2[FormatType2["LOTTIE"] = 3] = "LOTTIE";
|
|
1162
|
+
})(FormatType = Sticker4.FormatType || (Sticker4.FormatType = {}));
|
|
1163
|
+
})(Sticker3 || (Sticker3 = {}));
|
|
1098
1164
|
Internal.define({
|
|
1099
1165
|
"/stickers/{sticker.id}": {
|
|
1100
1166
|
GET: "getSticker"
|
|
@@ -1120,6 +1186,40 @@ var MembershipState;
|
|
|
1120
1186
|
MembershipState2[MembershipState2["ACCEPTED"] = 2] = "ACCEPTED";
|
|
1121
1187
|
})(MembershipState || (MembershipState = {}));
|
|
1122
1188
|
|
|
1189
|
+
// plugins/adapter/discord/src/types/thread.ts
|
|
1190
|
+
Internal.define({
|
|
1191
|
+
"/channels/{channel.id}/messages/{message.id}/threads": {
|
|
1192
|
+
POST: "startThreadwithMessage"
|
|
1193
|
+
},
|
|
1194
|
+
"/channels/{channel.id}/threads": {
|
|
1195
|
+
POST: "startThreadwithoutMessage"
|
|
1196
|
+
},
|
|
1197
|
+
"/channels/{channel.id}/thread-members/@me": {
|
|
1198
|
+
PUT: "joinThread",
|
|
1199
|
+
DELETE: "leaveThread"
|
|
1200
|
+
},
|
|
1201
|
+
"/channels/{channel.id}/thread-members/{user.id}": {
|
|
1202
|
+
PUT: "addThreadMember",
|
|
1203
|
+
DELETE: "removeThreadMember",
|
|
1204
|
+
GET: "getThreadMember"
|
|
1205
|
+
},
|
|
1206
|
+
"/channels/{channel.id}/thread-members": {
|
|
1207
|
+
GET: "listThreadMembers"
|
|
1208
|
+
},
|
|
1209
|
+
"/channels/{channel.id}/threads/active": {
|
|
1210
|
+
GET: "listActiveThreads"
|
|
1211
|
+
},
|
|
1212
|
+
"/channels/{channel.id}/threads/archived/public": {
|
|
1213
|
+
GET: "listPublicArchivedThreads"
|
|
1214
|
+
},
|
|
1215
|
+
"/channels/{channel.id}/threads/archived/private": {
|
|
1216
|
+
GET: "listPrivateArchivedThreads"
|
|
1217
|
+
},
|
|
1218
|
+
"/channels/{channel.id}/users/@me/threads/archived/private": {
|
|
1219
|
+
GET: "listJoinedPrivateArchivedThreads"
|
|
1220
|
+
}
|
|
1221
|
+
});
|
|
1222
|
+
|
|
1123
1223
|
// plugins/adapter/discord/src/types/user.ts
|
|
1124
1224
|
var UserFlag;
|
|
1125
1225
|
(function(UserFlag2) {
|
|
@@ -1151,9 +1251,6 @@ Internal.define({
|
|
|
1151
1251
|
"/users/{user.id}": {
|
|
1152
1252
|
GET: "getUser"
|
|
1153
1253
|
},
|
|
1154
|
-
"/users/@me/channels": {
|
|
1155
|
-
POST: "createDM"
|
|
1156
|
-
},
|
|
1157
1254
|
"/users/@me/connections": {
|
|
1158
1255
|
GET: "getUserConnections"
|
|
1159
1256
|
}
|
|
@@ -1163,16 +1260,28 @@ Internal.define({
|
|
|
1163
1260
|
Internal.define({
|
|
1164
1261
|
"/voice/regions": {
|
|
1165
1262
|
GET: "listVoiceRegions"
|
|
1263
|
+
},
|
|
1264
|
+
"/guilds/{guild.id}/regions": {
|
|
1265
|
+
GET: "getGuildVoiceRegions"
|
|
1266
|
+
},
|
|
1267
|
+
"/guilds/{guild.id}/voice-states/@me": {
|
|
1268
|
+
PATCH: "modifyCurrentUserVoiceState"
|
|
1269
|
+
},
|
|
1270
|
+
"/guilds/{guild.id}/voice-states/{user.id}": {
|
|
1271
|
+
PATCH: "modifyUserVoiceState"
|
|
1166
1272
|
}
|
|
1167
1273
|
});
|
|
1168
1274
|
|
|
1169
1275
|
// plugins/adapter/discord/src/types/webhook.ts
|
|
1170
|
-
var
|
|
1171
|
-
(function(
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1276
|
+
var Webhook2;
|
|
1277
|
+
(function(Webhook3) {
|
|
1278
|
+
let Type;
|
|
1279
|
+
(function(Type2) {
|
|
1280
|
+
Type2[Type2["INCOMING"] = 1] = "INCOMING";
|
|
1281
|
+
Type2[Type2["CHANNEL_FOLLOWER"] = 2] = "CHANNEL_FOLLOWER";
|
|
1282
|
+
Type2[Type2["APPLICATION"] = 3] = "APPLICATION";
|
|
1283
|
+
})(Type = Webhook3.Type || (Webhook3.Type = {}));
|
|
1284
|
+
})(Webhook2 || (Webhook2 = {}));
|
|
1176
1285
|
Internal.define({
|
|
1177
1286
|
"/channels/{channel.id}/webhooks": {
|
|
1178
1287
|
POST: "createWebhook",
|
|
@@ -1206,23 +1315,23 @@ Internal.define({
|
|
|
1206
1315
|
});
|
|
1207
1316
|
|
|
1208
1317
|
// plugins/adapter/discord/src/bot.ts
|
|
1209
|
-
var BotConfig =
|
|
1210
|
-
|
|
1211
|
-
token:
|
|
1212
|
-
handleExternalAsset:
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1318
|
+
var BotConfig = import_koishi4.Schema.intersect([
|
|
1319
|
+
import_koishi4.Schema.object({
|
|
1320
|
+
token: import_koishi4.Schema.string().description("机器人的用户令牌。").required(),
|
|
1321
|
+
handleExternalAsset: import_koishi4.Schema.union([
|
|
1322
|
+
import_koishi4.Schema.const("download").description("先下载后发送"),
|
|
1323
|
+
import_koishi4.Schema.const("direct").description("直接发送链接"),
|
|
1324
|
+
import_koishi4.Schema.const("auto").description("发送一个 HEAD 请求,如果返回的 Content-Type 正确,则直接发送链接,否则先下载后发送")
|
|
1216
1325
|
]).description("发送外链资源时采用的方式。").default("auto"),
|
|
1217
|
-
handleMixedContent:
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1326
|
+
handleMixedContent: import_koishi4.Schema.union([
|
|
1327
|
+
import_koishi4.Schema.const("separate").description("将每个不同形式的内容分开发送"),
|
|
1328
|
+
import_koishi4.Schema.const("attach").description("图片前如果有文本内容,则将文本作为图片的附带信息进行发送"),
|
|
1329
|
+
import_koishi4.Schema.const("auto").description("如果图片本身采用直接发送则与前面的文本分开,否则将文本作为图片的附带信息发送")
|
|
1221
1330
|
]).description("发送图文等混合内容时采用的方式。").default("auto")
|
|
1222
1331
|
}),
|
|
1223
|
-
|
|
1332
|
+
import_koishi4.App.Config.Request
|
|
1224
1333
|
]);
|
|
1225
|
-
var DiscordBot = class extends
|
|
1334
|
+
var DiscordBot = class extends import_koishi4.Bot {
|
|
1226
1335
|
constructor(adapter, config) {
|
|
1227
1336
|
super(adapter, config);
|
|
1228
1337
|
this._d = 0;
|
|
@@ -1245,15 +1354,18 @@ var DiscordBot = class extends import_koishi3.Bot {
|
|
|
1245
1354
|
const session = this.createSession({ channelId, content, guildId, subtype: guildId ? "group" : "private" });
|
|
1246
1355
|
if (await this.app.serial(session, "before-send", session))
|
|
1247
1356
|
return;
|
|
1248
|
-
const chain =
|
|
1357
|
+
const chain = import_koishi4.segment.parse(session.content);
|
|
1249
1358
|
const quote = this.parseQuote(chain);
|
|
1250
1359
|
const message_reference = quote ? {
|
|
1251
1360
|
message_id: quote
|
|
1252
1361
|
} : void 0;
|
|
1253
1362
|
const send = Sender.from(this, `/channels/${channelId}/messages`);
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1363
|
+
const results = await send(session.content, { message_reference });
|
|
1364
|
+
for (const id of results) {
|
|
1365
|
+
session.messageId = id;
|
|
1366
|
+
this.app.emit(session, "send", session);
|
|
1367
|
+
}
|
|
1368
|
+
return results;
|
|
1257
1369
|
}
|
|
1258
1370
|
async sendPrivateMessage(channelId, content) {
|
|
1259
1371
|
return this.sendMessage(channelId, content);
|
|
@@ -1262,7 +1374,7 @@ var DiscordBot = class extends import_koishi3.Bot {
|
|
|
1262
1374
|
await this.internal.deleteMessage(channelId, messageId);
|
|
1263
1375
|
}
|
|
1264
1376
|
async editMessage(channelId, messageId, content) {
|
|
1265
|
-
const chain =
|
|
1377
|
+
const chain = import_koishi4.segment.parse(content);
|
|
1266
1378
|
const image = chain.find((v) => v.type === "image");
|
|
1267
1379
|
if (image) {
|
|
1268
1380
|
throw new Error("You can't include embed object(s) while editing message.");
|
|
@@ -1328,10 +1440,10 @@ __name(DiscordBot, "DiscordBot");
|
|
|
1328
1440
|
DiscordBot.schema = AdapterConfig;
|
|
1329
1441
|
|
|
1330
1442
|
// plugins/adapter/discord/src/ws.ts
|
|
1331
|
-
var
|
|
1443
|
+
var import_koishi5 = __toModule(require("koishi"));
|
|
1332
1444
|
var import_ws = __toModule(require("ws"));
|
|
1333
|
-
var logger = new
|
|
1334
|
-
var WebSocketClient = class extends
|
|
1445
|
+
var logger = new import_koishi5.Logger("discord");
|
|
1446
|
+
var WebSocketClient = class extends import_koishi5.Adapter.WebSocketClient {
|
|
1335
1447
|
constructor(ctx, config) {
|
|
1336
1448
|
super(ctx, config);
|
|
1337
1449
|
this.http = ctx.http.extend(__spreadValues({
|
|
@@ -1348,6 +1460,13 @@ var WebSocketClient = class extends import_koishi4.Adapter.WebSocketClient {
|
|
|
1348
1460
|
d: bot._d
|
|
1349
1461
|
}));
|
|
1350
1462
|
}
|
|
1463
|
+
getIntents() {
|
|
1464
|
+
let intents = 0 | GatewayIntent.GUILD_MESSAGES | GatewayIntent.GUILD_MESSAGE_REACTIONS | GatewayIntent.DIRECT_MESSAGES | GatewayIntent.DIRECT_MESSAGE_REACTIONS;
|
|
1465
|
+
if (this.config.intents.members !== false) {
|
|
1466
|
+
intents |= GatewayIntent.GUILD_MEMBERS;
|
|
1467
|
+
}
|
|
1468
|
+
return intents;
|
|
1469
|
+
}
|
|
1351
1470
|
accept(bot) {
|
|
1352
1471
|
if (bot._sessionId) {
|
|
1353
1472
|
logger.debug("resuming");
|
|
@@ -1382,7 +1501,7 @@ var WebSocketClient = class extends import_koishi4.Adapter.WebSocketClient {
|
|
|
1382
1501
|
token: bot.config.token,
|
|
1383
1502
|
properties: {},
|
|
1384
1503
|
compress: false,
|
|
1385
|
-
intents:
|
|
1504
|
+
intents: this.getIntents()
|
|
1386
1505
|
}
|
|
1387
1506
|
}));
|
|
1388
1507
|
}
|
|
@@ -1390,7 +1509,7 @@ var WebSocketClient = class extends import_koishi4.Adapter.WebSocketClient {
|
|
|
1390
1509
|
if (parsed.t === "READY") {
|
|
1391
1510
|
bot._sessionId = parsed.d.session_id;
|
|
1392
1511
|
const self = adaptUser(parsed.d.user);
|
|
1393
|
-
(0,
|
|
1512
|
+
(0, import_koishi5.renameProperty)(self, "selfId", "userId");
|
|
1394
1513
|
Object.assign(bot, self);
|
|
1395
1514
|
logger.debug("session_id " + bot._sessionId);
|
|
1396
1515
|
return bot.resolve();
|
|
@@ -1409,7 +1528,7 @@ __name(WebSocketClient, "WebSocketClient");
|
|
|
1409
1528
|
WebSocketClient.schema = BotConfig;
|
|
1410
1529
|
|
|
1411
1530
|
// plugins/adapter/discord/src/index.ts
|
|
1412
|
-
var src_default =
|
|
1531
|
+
var src_default = import_koishi6.Adapter.define("discord", DiscordBot, WebSocketClient);
|
|
1413
1532
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1414
1533
|
0 && (module.exports = {
|
|
1415
1534
|
AdapterConfig,
|