@koishijs/plugin-adapter-discord 2.0.0-beta.7 → 2.0.1
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 +588 -462
- 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 +4 -3
- package/lib/ws.d.ts +3 -6
- package/package.json +7 -6
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
254
|
const user = (_a2 = meta.mentions) == null ? void 0 : _a2.find((u) => u.id === id);
|
|
110
|
-
return
|
|
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,188 +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.arraybuffer(data.url, {}, {
|
|
339
|
-
accept: type + "/*"
|
|
340
|
-
});
|
|
341
|
-
return this.sendEmbed(buffer, addition, data.file || filename);
|
|
342
|
-
}, "sendDownload");
|
|
343
|
-
const mode = data.mode || handleExternalAsset;
|
|
344
|
-
if (mode === "download" || handleMixedContent === "attach" && addition.content || type === "file") {
|
|
345
|
-
return sendDownload();
|
|
346
|
-
} else if (mode === "direct") {
|
|
347
|
-
return sendDirect();
|
|
348
|
-
}
|
|
349
|
-
await this.bot.app.http.head(data.url, {}, {
|
|
350
|
-
accept: type + "/*"
|
|
351
|
-
}).then((headers) => {
|
|
352
|
-
if (headers["content-type"].startsWith(type)) {
|
|
353
|
-
return sendDirect();
|
|
354
|
-
} else {
|
|
355
|
-
return sendDownload();
|
|
356
|
-
}
|
|
357
|
-
}, sendDownload);
|
|
358
|
-
}
|
|
359
|
-
};
|
|
360
|
-
__name(Sender, "Sender");
|
|
361
|
-
|
|
362
379
|
// plugins/adapter/discord/src/types/index.ts
|
|
363
380
|
var types_exports = {};
|
|
364
381
|
__export(types_exports, {
|
|
365
382
|
ActivityFlag: () => ActivityFlag,
|
|
366
383
|
ActivityType: () => ActivityType,
|
|
367
384
|
AllowedMentionType: () => AllowedMentionType,
|
|
368
|
-
|
|
369
|
-
ApplicationCommandPermissionType: () => ApplicationCommandPermissionType,
|
|
370
|
-
ApplicationCommandType: () => ApplicationCommandType,
|
|
385
|
+
ApplicationCommand: () => ApplicationCommand,
|
|
371
386
|
ApplicationFlag: () => ApplicationFlag,
|
|
372
|
-
|
|
373
|
-
|
|
387
|
+
AuditLog: () => AuditLog,
|
|
388
|
+
Channel: () => Channel2,
|
|
374
389
|
ComponentType: () => ComponentType,
|
|
375
390
|
DeviceType: () => DeviceType,
|
|
376
391
|
GatewayIntent: () => GatewayIntent,
|
|
377
392
|
GatewayOpcode: () => GatewayOpcode,
|
|
393
|
+
Guild: () => Guild3,
|
|
378
394
|
GuildFeature: () => GuildFeature,
|
|
395
|
+
GuildScheduledEvent: () => GuildScheduledEvent,
|
|
379
396
|
IntegrationExpireBehavior: () => IntegrationExpireBehavior,
|
|
380
397
|
InteractionCallbackDataFlag: () => InteractionCallbackDataFlag,
|
|
381
398
|
InteractionCallbackType: () => InteractionCallbackType,
|
|
382
399
|
InteractionType: () => InteractionType,
|
|
383
400
|
Internal: () => Internal,
|
|
384
|
-
|
|
401
|
+
Invite: () => Invite,
|
|
385
402
|
MembershipState: () => MembershipState,
|
|
386
|
-
|
|
387
|
-
MessageFlag: () => MessageFlag,
|
|
388
|
-
MessageType: () => MessageType,
|
|
403
|
+
Message: () => Message2,
|
|
389
404
|
Permission: () => Permission,
|
|
390
405
|
StatusType: () => StatusType2,
|
|
391
|
-
|
|
392
|
-
StickerType: () => StickerType,
|
|
406
|
+
Sticker: () => Sticker3,
|
|
393
407
|
SystemChannelFlag: () => SystemChannelFlag,
|
|
394
408
|
UserFlag: () => UserFlag,
|
|
395
409
|
VisibilityType: () => VisibilityType,
|
|
396
|
-
|
|
410
|
+
Webhook: () => Webhook2
|
|
397
411
|
});
|
|
398
412
|
|
|
399
413
|
// plugins/adapter/discord/src/types/internal.ts
|
|
414
|
+
var import_koishi3 = __toModule(require("koishi"));
|
|
400
415
|
var Internal = class {
|
|
401
416
|
constructor(http) {
|
|
402
417
|
this.http = http;
|
|
403
418
|
}
|
|
404
419
|
static define(routes) {
|
|
405
420
|
for (const path in routes) {
|
|
406
|
-
for (const
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
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
|
+
}
|
|
412
447
|
}
|
|
413
448
|
}
|
|
414
449
|
}
|
|
@@ -435,80 +470,103 @@ Internal.define({
|
|
|
435
470
|
});
|
|
436
471
|
|
|
437
472
|
// 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
|
-
|
|
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 = {}));
|
|
485
523
|
Internal.define({
|
|
486
524
|
"/guilds/{guild.id}/audit-logs": {
|
|
487
525
|
GET: "getGuildAuditLog"
|
|
488
526
|
}
|
|
489
527
|
});
|
|
490
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
|
+
|
|
491
541
|
// plugins/adapter/discord/src/types/channel.ts
|
|
492
|
-
var
|
|
493
|
-
(function(
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
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 = {}));
|
|
506
559
|
var AllowedMentionType;
|
|
507
560
|
(function(AllowedMentionType2) {
|
|
508
561
|
AllowedMentionType2["ROLE_MENTIONS"] = "roles";
|
|
509
562
|
AllowedMentionType2["USER_MENTIONS"] = "users";
|
|
510
563
|
AllowedMentionType2["EVERYONE_MENTIONS"] = "everyone";
|
|
511
564
|
})(AllowedMentionType || (AllowedMentionType = {}));
|
|
565
|
+
Internal.define({
|
|
566
|
+
"/users/@me/channels": {
|
|
567
|
+
POST: ["createDM", "createGroupDM"]
|
|
568
|
+
}
|
|
569
|
+
});
|
|
512
570
|
Internal.define({
|
|
513
571
|
"/guilds/{guild.id}/channels": {
|
|
514
572
|
GET: "getGuildChannels",
|
|
@@ -526,84 +584,46 @@ Internal.define({
|
|
|
526
584
|
PUT: "editChannelPermissions",
|
|
527
585
|
DELETE: "deleteChannelPermission"
|
|
528
586
|
},
|
|
529
|
-
"/channels/{channel.id}/invites": {
|
|
530
|
-
GET: "getChannelInvites",
|
|
531
|
-
POST: "createChannelInvite"
|
|
532
|
-
},
|
|
533
587
|
"/channels/{channel.id}/followers": {
|
|
534
588
|
POST: "followNewsChannel"
|
|
535
589
|
},
|
|
536
590
|
"/channels/{channel.id}/typing": {
|
|
537
591
|
POST: "triggerTypingIndicator"
|
|
538
592
|
},
|
|
539
|
-
"/channels/{channel.id}/pins": {
|
|
540
|
-
GET: "getPinnedMessages"
|
|
541
|
-
},
|
|
542
|
-
"/channels/{channel.id}/pins/{message.id}": {
|
|
543
|
-
PUT: "pinMessage",
|
|
544
|
-
DELETE: "unpinMessage"
|
|
545
|
-
},
|
|
546
593
|
"/channels/{channel.id}/recipients/{user.id}": {
|
|
547
594
|
PUT: "groupDMAddRecipient",
|
|
548
595
|
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
596
|
}
|
|
580
597
|
});
|
|
581
598
|
|
|
582
599
|
// 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
|
-
|
|
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 = {}));
|
|
607
627
|
Internal.define({
|
|
608
628
|
"/applications/{application.id}/commands": {
|
|
609
629
|
GET: "getGlobalApplicationCommands",
|
|
@@ -663,22 +683,6 @@ Internal.define({
|
|
|
663
683
|
DELETE: "deleteGuildEmoji"
|
|
664
684
|
}
|
|
665
685
|
});
|
|
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
686
|
|
|
683
687
|
// plugins/adapter/discord/src/types/gateway.ts
|
|
684
688
|
var GatewayOpcode;
|
|
@@ -739,12 +743,13 @@ Internal.define({
|
|
|
739
743
|
"/guilds/{guild.id}/members/@me": {
|
|
740
744
|
PATCH: "modifyCurrentMember"
|
|
741
745
|
},
|
|
742
|
-
"/guilds/{guild.id}/members/@me/nick": {
|
|
743
|
-
PATCH: "modifyCurrentUserNick"
|
|
744
|
-
},
|
|
745
746
|
"/guilds/{guild.id}/members/{user.id}/roles/{role.id}": {
|
|
746
747
|
PUT: "addGuildMemberRole",
|
|
747
748
|
DELETE: "removeGuildMemberRole"
|
|
749
|
+
},
|
|
750
|
+
"/guilds/{guild.id}/prune": {
|
|
751
|
+
GET: "getGuildPruneCount",
|
|
752
|
+
POST: "beginGuildPrune"
|
|
748
753
|
}
|
|
749
754
|
});
|
|
750
755
|
|
|
@@ -766,6 +771,20 @@ Internal.define({
|
|
|
766
771
|
});
|
|
767
772
|
|
|
768
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 = {}));
|
|
769
788
|
var SystemChannelFlag;
|
|
770
789
|
(function(SystemChannelFlag2) {
|
|
771
790
|
SystemChannelFlag2[SystemChannelFlag2["SUPPRESS_JOIN_NOTIFICATIONS"] = 1] = "SUPPRESS_JOIN_NOTIFICATIONS";
|
|
@@ -801,6 +820,9 @@ Internal.define({
|
|
|
801
820
|
"/users/@me/guilds": {
|
|
802
821
|
GET: "getCurrentUserGuilds"
|
|
803
822
|
},
|
|
823
|
+
"/users/@me/guilds/{guild.id}/member": {
|
|
824
|
+
GET: "getCurrentUserGuildMember"
|
|
825
|
+
},
|
|
804
826
|
"/users/@me/guilds/{guild.id}": {
|
|
805
827
|
DELETE: "leaveGuild"
|
|
806
828
|
}
|
|
@@ -817,42 +839,6 @@ Internal.define({
|
|
|
817
839
|
"/guilds/{guild.id}/preview": {
|
|
818
840
|
GET: "getGuildPreview"
|
|
819
841
|
},
|
|
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
842
|
"/guilds/{guild.id}/widget": {
|
|
857
843
|
GET: "getGuildWidgetSettings",
|
|
858
844
|
PATCH: "modifyGuildWidget"
|
|
@@ -860,21 +846,12 @@ Internal.define({
|
|
|
860
846
|
"/guilds/{guild.id}/widget.json": {
|
|
861
847
|
GET: "getGuildWidget"
|
|
862
848
|
},
|
|
863
|
-
"/guilds/{guild.id}/vanity-url": {
|
|
864
|
-
GET: "getGuildVanityURL"
|
|
865
|
-
},
|
|
866
849
|
"/guilds/{guild.id}/widget.png": {
|
|
867
850
|
GET: "getGuildWidgetImage"
|
|
868
851
|
},
|
|
869
852
|
"/guilds/{guild.id}/welcome-screen": {
|
|
870
853
|
GET: "getGuildWelcomeScreen",
|
|
871
854
|
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
855
|
}
|
|
879
856
|
});
|
|
880
857
|
|
|
@@ -884,6 +861,14 @@ var IntegrationExpireBehavior;
|
|
|
884
861
|
IntegrationExpireBehavior2[IntegrationExpireBehavior2["REMOVE_ROLE"] = 0] = "REMOVE_ROLE";
|
|
885
862
|
IntegrationExpireBehavior2[IntegrationExpireBehavior2["KICK"] = 1] = "KICK";
|
|
886
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
|
+
});
|
|
887
872
|
|
|
888
873
|
// plugins/adapter/discord/src/types/interaction.ts
|
|
889
874
|
var InteractionType;
|
|
@@ -924,63 +909,79 @@ Internal.define({
|
|
|
924
909
|
});
|
|
925
910
|
|
|
926
911
|
// plugins/adapter/discord/src/types/invite.ts
|
|
927
|
-
var
|
|
928
|
-
(function(
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
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 = {}));
|
|
932
920
|
Internal.define({
|
|
933
921
|
"/invites/{invite.code}": {
|
|
934
922
|
GET: "getInvite",
|
|
935
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"
|
|
936
934
|
}
|
|
937
935
|
});
|
|
938
936
|
|
|
939
937
|
// 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
|
-
|
|
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 = {}));
|
|
984
985
|
Internal.define({
|
|
985
986
|
"/channels/{channel.id}/messages": {
|
|
986
987
|
GET: "getChannelMessages",
|
|
@@ -996,6 +997,13 @@ Internal.define({
|
|
|
996
997
|
},
|
|
997
998
|
"/channels/{channel.id}/messages/bulk-delete": {
|
|
998
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"
|
|
999
1007
|
}
|
|
1000
1008
|
});
|
|
1001
1009
|
|
|
@@ -1027,6 +1035,24 @@ var ActivityFlag;
|
|
|
1027
1035
|
ActivityFlag2[ActivityFlag2["PLAY"] = 32] = "PLAY";
|
|
1028
1036
|
})(ActivityFlag || (ActivityFlag = {}));
|
|
1029
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
|
+
|
|
1030
1056
|
// plugins/adapter/discord/src/types/role.ts
|
|
1031
1057
|
var Permission;
|
|
1032
1058
|
(function(Permission2) {
|
|
@@ -1070,6 +1096,53 @@ var Permission;
|
|
|
1070
1096
|
Permission2[Permission2["SEND_MESSAGES_IN_THREADS"] = 64] = "SEND_MESSAGES_IN_THREADS";
|
|
1071
1097
|
Permission2[Permission2["START_EMBEDDED_ACTIVITIES"] = 128] = "START_EMBEDDED_ACTIVITIES";
|
|
1072
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
|
+
});
|
|
1073
1146
|
|
|
1074
1147
|
// plugins/adapter/discord/src/types/stage-instance.ts
|
|
1075
1148
|
Internal.define({
|
|
@@ -1084,17 +1157,20 @@ Internal.define({
|
|
|
1084
1157
|
});
|
|
1085
1158
|
|
|
1086
1159
|
// plugins/adapter/discord/src/types/sticker.ts
|
|
1087
|
-
var
|
|
1088
|
-
(function(
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
(
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
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 = {}));
|
|
1098
1174
|
Internal.define({
|
|
1099
1175
|
"/stickers/{sticker.id}": {
|
|
1100
1176
|
GET: "getSticker"
|
|
@@ -1120,6 +1196,40 @@ var MembershipState;
|
|
|
1120
1196
|
MembershipState2[MembershipState2["ACCEPTED"] = 2] = "ACCEPTED";
|
|
1121
1197
|
})(MembershipState || (MembershipState = {}));
|
|
1122
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
|
+
|
|
1123
1233
|
// plugins/adapter/discord/src/types/user.ts
|
|
1124
1234
|
var UserFlag;
|
|
1125
1235
|
(function(UserFlag2) {
|
|
@@ -1151,9 +1261,6 @@ Internal.define({
|
|
|
1151
1261
|
"/users/{user.id}": {
|
|
1152
1262
|
GET: "getUser"
|
|
1153
1263
|
},
|
|
1154
|
-
"/users/@me/channels": {
|
|
1155
|
-
POST: "createDM"
|
|
1156
|
-
},
|
|
1157
1264
|
"/users/@me/connections": {
|
|
1158
1265
|
GET: "getUserConnections"
|
|
1159
1266
|
}
|
|
@@ -1163,16 +1270,28 @@ Internal.define({
|
|
|
1163
1270
|
Internal.define({
|
|
1164
1271
|
"/voice/regions": {
|
|
1165
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"
|
|
1166
1282
|
}
|
|
1167
1283
|
});
|
|
1168
1284
|
|
|
1169
1285
|
// plugins/adapter/discord/src/types/webhook.ts
|
|
1170
|
-
var
|
|
1171
|
-
(function(
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
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 = {}));
|
|
1176
1295
|
Internal.define({
|
|
1177
1296
|
"/channels/{channel.id}/webhooks": {
|
|
1178
1297
|
POST: "createWebhook",
|
|
@@ -1206,32 +1325,43 @@ Internal.define({
|
|
|
1206
1325
|
});
|
|
1207
1326
|
|
|
1208
1327
|
// plugins/adapter/discord/src/bot.ts
|
|
1209
|
-
var BotConfig =
|
|
1210
|
-
|
|
1211
|
-
token:
|
|
1212
|
-
handleExternalAsset: import_koishi3.Schema.union([
|
|
1213
|
-
import_koishi3.Schema.const("download").description("先下载后发送"),
|
|
1214
|
-
import_koishi3.Schema.const("direct").description("直接发送链接"),
|
|
1215
|
-
import_koishi3.Schema.const("auto").description("发送一个 HEAD 请求,如果返回的 Content-Type 正确,则直接发送链接,否则先下载后发送")
|
|
1216
|
-
]).description("发送外链资源时采用的方式。").default("auto"),
|
|
1217
|
-
handleMixedContent: import_koishi3.Schema.union([
|
|
1218
|
-
import_koishi3.Schema.const("separate").description("将每个不同形式的内容分开发送"),
|
|
1219
|
-
import_koishi3.Schema.const("attach").description("图片前如果有文本内容,则将文本作为图片的附带信息进行发送"),
|
|
1220
|
-
import_koishi3.Schema.const("auto").description("如果图片本身采用直接发送则与前面的文本分开,否则将文本作为图片的附带信息发送")
|
|
1221
|
-
]).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()
|
|
1222
1331
|
}),
|
|
1223
|
-
|
|
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
|
+
})
|
|
1224
1342
|
]);
|
|
1225
|
-
var DiscordBot = class extends
|
|
1343
|
+
var DiscordBot = class extends import_koishi4.Bot {
|
|
1226
1344
|
constructor(adapter, config) {
|
|
1227
1345
|
super(adapter, config);
|
|
1228
1346
|
this._d = 0;
|
|
1229
1347
|
this._sessionId = "";
|
|
1230
|
-
this.http = adapter.http.extend({
|
|
1231
|
-
headers: {
|
|
1232
|
-
|
|
1348
|
+
this.http = adapter.ctx.http.extend(__spreadProps(__spreadValues({}, config), {
|
|
1349
|
+
headers: __spreadValues({
|
|
1350
|
+
Authorization: `Bot ${config.token}`
|
|
1351
|
+
}, config.headers)
|
|
1352
|
+
}));
|
|
1233
1353
|
this.internal = new Internal(this.http);
|
|
1234
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
|
+
}
|
|
1235
1365
|
async getSelf() {
|
|
1236
1366
|
const data = await this.internal.getCurrentUser();
|
|
1237
1367
|
return adaptUser(data);
|
|
@@ -1245,15 +1375,18 @@ var DiscordBot = class extends import_koishi3.Bot {
|
|
|
1245
1375
|
const session = this.createSession({ channelId, content, guildId, subtype: guildId ? "group" : "private" });
|
|
1246
1376
|
if (await this.app.serial(session, "before-send", session))
|
|
1247
1377
|
return;
|
|
1248
|
-
const chain =
|
|
1378
|
+
const chain = import_koishi4.segment.parse(session.content);
|
|
1249
1379
|
const quote = this.parseQuote(chain);
|
|
1250
1380
|
const message_reference = quote ? {
|
|
1251
1381
|
message_id: quote
|
|
1252
1382
|
} : void 0;
|
|
1253
1383
|
const send = Sender.from(this, `/channels/${channelId}/messages`);
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
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;
|
|
1257
1390
|
}
|
|
1258
1391
|
async sendPrivateMessage(channelId, content) {
|
|
1259
1392
|
return this.sendMessage(channelId, content);
|
|
@@ -1262,7 +1395,7 @@ var DiscordBot = class extends import_koishi3.Bot {
|
|
|
1262
1395
|
await this.internal.deleteMessage(channelId, messageId);
|
|
1263
1396
|
}
|
|
1264
1397
|
async editMessage(channelId, messageId, content) {
|
|
1265
|
-
const chain =
|
|
1398
|
+
const chain = import_koishi4.segment.parse(content);
|
|
1266
1399
|
const image = chain.find((v) => v.type === "image");
|
|
1267
1400
|
if (image) {
|
|
1268
1401
|
throw new Error("You can't include embed object(s) while editing message.");
|
|
@@ -1328,18 +1461,12 @@ __name(DiscordBot, "DiscordBot");
|
|
|
1328
1461
|
DiscordBot.schema = AdapterConfig;
|
|
1329
1462
|
|
|
1330
1463
|
// plugins/adapter/discord/src/ws.ts
|
|
1331
|
-
var
|
|
1464
|
+
var import_koishi5 = __toModule(require("koishi"));
|
|
1332
1465
|
var import_ws = __toModule(require("ws"));
|
|
1333
|
-
var logger = new
|
|
1334
|
-
var WebSocketClient = class extends
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
this.http = ctx.http.extend(__spreadValues({
|
|
1338
|
-
endpoint: "https://discord.com/api/v8"
|
|
1339
|
-
}, config.request));
|
|
1340
|
-
}
|
|
1341
|
-
prepare() {
|
|
1342
|
-
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);
|
|
1343
1470
|
}
|
|
1344
1471
|
heartbeat(bot) {
|
|
1345
1472
|
logger.debug(`heartbeat d ${bot._d}`);
|
|
@@ -1361,10 +1488,9 @@ var WebSocketClient = class extends import_koishi4.Adapter.WebSocketClient {
|
|
|
1361
1488
|
}));
|
|
1362
1489
|
}
|
|
1363
1490
|
bot.socket.on("message", async (data) => {
|
|
1364
|
-
data = data.toString();
|
|
1365
1491
|
let parsed;
|
|
1366
1492
|
try {
|
|
1367
|
-
parsed = JSON.parse(data);
|
|
1493
|
+
parsed = JSON.parse(data.toString());
|
|
1368
1494
|
} catch (error) {
|
|
1369
1495
|
return logger.warn("cannot parse message", data);
|
|
1370
1496
|
}
|
|
@@ -1382,7 +1508,7 @@ var WebSocketClient = class extends import_koishi4.Adapter.WebSocketClient {
|
|
|
1382
1508
|
token: bot.config.token,
|
|
1383
1509
|
properties: {},
|
|
1384
1510
|
compress: false,
|
|
1385
|
-
intents:
|
|
1511
|
+
intents: bot.getIntents()
|
|
1386
1512
|
}
|
|
1387
1513
|
}));
|
|
1388
1514
|
}
|
|
@@ -1390,7 +1516,7 @@ var WebSocketClient = class extends import_koishi4.Adapter.WebSocketClient {
|
|
|
1390
1516
|
if (parsed.t === "READY") {
|
|
1391
1517
|
bot._sessionId = parsed.d.session_id;
|
|
1392
1518
|
const self = adaptUser(parsed.d.user);
|
|
1393
|
-
(0,
|
|
1519
|
+
(0, import_koishi5.renameProperty)(self, "selfId", "userId");
|
|
1394
1520
|
Object.assign(bot, self);
|
|
1395
1521
|
logger.debug("session_id " + bot._sessionId);
|
|
1396
1522
|
return bot.resolve();
|
|
@@ -1409,7 +1535,7 @@ __name(WebSocketClient, "WebSocketClient");
|
|
|
1409
1535
|
WebSocketClient.schema = BotConfig;
|
|
1410
1536
|
|
|
1411
1537
|
// plugins/adapter/discord/src/index.ts
|
|
1412
|
-
var src_default =
|
|
1538
|
+
var src_default = import_koishi6.Adapter.define("discord", DiscordBot, WebSocketClient);
|
|
1413
1539
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1414
1540
|
0 && (module.exports = {
|
|
1415
1541
|
AdapterConfig,
|