@koishijs/plugin-adapter-discord 2.0.3 → 2.0.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="koishi/lib" />
2
2
  /// <reference types="node" />
3
- import { Adapter, Bot, Schema, Quester } from 'koishi';
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 = {}, filename) {
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);
@@ -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.createSession({ channelId, content, guildId, subtype: guildId ? "group" : "private" });
1376
- if (await this.app.serial(session, "before-send", session))
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 ? {
@@ -1486,6 +1486,7 @@ var WebSocketClient = class extends import_koishi5.Adapter.WebSocketClient {
1486
1486
  seq: bot._d
1487
1487
  }
1488
1488
  }));
1489
+ bot.resolve();
1489
1490
  }
1490
1491
  bot.socket.on("message", async (data) => {
1491
1492
  let parsed;