@koishijs/plugin-adapter-discord 2.0.1 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bot.d.ts +1 -1
- package/lib/index.js +5 -5
- package/lib/index.js.map +2 -2
- package/lib/types/emoji.d.ts +1 -1
- package/lib/ws.d.ts +1 -1
- package/package.json +6 -5
package/lib/bot.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="koishi/lib" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import { Adapter, Bot,
|
|
3
|
+
import { Adapter, Bot, Quester, Schema } from 'koishi';
|
|
4
4
|
import { AdapterConfig } from './utils';
|
|
5
5
|
import { Internal } from './types';
|
|
6
6
|
interface PrivilegedIntents {
|
package/lib/index.js
CHANGED
|
@@ -89,7 +89,7 @@ var _Sender = class {
|
|
|
89
89
|
this.errors.push(e);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
async sendEmbed(fileBuffer, payload_json
|
|
92
|
+
async sendEmbed(fileBuffer, payload_json, filename) {
|
|
93
93
|
const fd = new import_form_data.default();
|
|
94
94
|
const type = await (0, import_file_type.fromBuffer)(fileBuffer);
|
|
95
95
|
filename || (filename = "file." + type.ext);
|
|
@@ -251,7 +251,7 @@ function adaptMessage(bot, meta, session = {}) {
|
|
|
251
251
|
if (meta.mention_roles.includes(id)) {
|
|
252
252
|
return (0, import_koishi2.segment)("at", { role: id });
|
|
253
253
|
} else {
|
|
254
|
-
const user = (_a2 = meta.mentions) == null ? void 0 : _a2.find((u) => u.id === id);
|
|
254
|
+
const user = (_a2 = meta.mentions) == null ? void 0 : _a2.find((u) => u.id === id || `${u.username}#${u.discriminator}` === id);
|
|
255
255
|
return import_koishi2.segment.at(id, { name: user == null ? void 0 : user.username });
|
|
256
256
|
}
|
|
257
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) => {
|
|
@@ -1372,9 +1372,9 @@ var DiscordBot = class extends import_koishi4.Bot {
|
|
|
1372
1372
|
return chain.shift().data.id;
|
|
1373
1373
|
}
|
|
1374
1374
|
async sendMessage(channelId, content, guildId) {
|
|
1375
|
-
const session = this.
|
|
1376
|
-
if (
|
|
1377
|
-
return;
|
|
1375
|
+
const session = await this.session({ channelId, content, guildId, subtype: guildId ? "group" : "private" });
|
|
1376
|
+
if (!(session == null ? void 0 : session.content))
|
|
1377
|
+
return [];
|
|
1378
1378
|
const chain = import_koishi4.segment.parse(session.content);
|
|
1379
1379
|
const quote = this.parseQuote(chain);
|
|
1380
1380
|
const message_reference = quote ? {
|