@satorijs/adapter-discord 3.6.0 → 3.6.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/index.js +7 -5
- package/lib/index.js.map +2 -2
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -288,7 +288,7 @@ var DiscordMessenger = class extends import_satori2.Messenger {
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
async sendEmbed(attrs, payload) {
|
|
291
|
-
const { filename, data, mime } = await this.bot.ctx.http.file(attrs.url);
|
|
291
|
+
const { filename, data, mime } = await this.bot.ctx.http.file(attrs.url, attrs);
|
|
292
292
|
const form = new import_form_data.default();
|
|
293
293
|
const value = process.env.KOISHI_ENV === "browser" ? new Blob([data], { type: mime }) : Buffer.from(data);
|
|
294
294
|
form.append("file", value, attrs.file || filename);
|
|
@@ -318,7 +318,8 @@ var DiscordMessenger = class extends import_satori2.Messenger {
|
|
|
318
318
|
return sendDirect();
|
|
319
319
|
}
|
|
320
320
|
return await this.bot.ctx.http.head(attrs.url, {
|
|
321
|
-
headers: { accept: type + "/*" }
|
|
321
|
+
headers: { accept: type + "/*" },
|
|
322
|
+
timeout: +attrs.timeout || void 0
|
|
322
323
|
}).then((headers) => {
|
|
323
324
|
if (headers["content-type"].startsWith(type)) {
|
|
324
325
|
return sendDirect();
|
|
@@ -463,9 +464,10 @@ var DiscordMessenger = class extends import_satori2.Messenger {
|
|
|
463
464
|
}
|
|
464
465
|
const quoted = await this.bot.getMessage(channelId, replyId);
|
|
465
466
|
this.addition.embeds = [{
|
|
466
|
-
description:
|
|
467
|
-
|
|
468
|
-
|
|
467
|
+
description: [
|
|
468
|
+
sanitize(parse(quoted.elements.filter((v) => v.type === "text").join("")).slice(0, 30)),
|
|
469
|
+
`<t:${Math.ceil(quoted.timestamp / 1e3)}:R> [[ ↑ ]](https://discord.com/channels/${this.guildId}/${channelId}/${replyId})`
|
|
470
|
+
].join("\n\n"),
|
|
469
471
|
author: {
|
|
470
472
|
name: quoted.author.nickname || quoted.author.username,
|
|
471
473
|
icon_url: quoted.author.avatar
|