@satorijs/adapter-discord 3.2.1 → 3.2.3

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 CHANGED
@@ -284,11 +284,10 @@ var Sender = class {
284
284
  this.buffer = "";
285
285
  this.addition = {};
286
286
  }
287
- async sendMessage(elements) {
288
- for (const code of elements) {
289
- const { type, attrs, children } = code;
287
+ async render(elements) {
288
+ for (const { type, attrs, children } of elements) {
290
289
  if (type === "text") {
291
- this.buffer += attrs.content.trim();
290
+ this.buffer += attrs.content;
292
291
  } else if (type === "at") {
293
292
  if (attrs.id) {
294
293
  this.buffer += `<@${attrs.id}>`;
@@ -333,8 +332,13 @@ var Sender = class {
333
332
  } else {
334
333
  await this.sendMessage(children);
335
334
  }
335
+ } else {
336
+ await this.render(children);
336
337
  }
337
338
  }
339
+ }
340
+ async sendMessage(elements) {
341
+ await this.render(elements);
338
342
  await this.sendBuffer();
339
343
  }
340
344
  async send(content) {
@@ -1502,7 +1506,7 @@ var DiscordBot = class extends import_satori4.Bot {
1502
1506
  });
1503
1507
  if (await this.context.serial(session, "before-send", session))
1504
1508
  return;
1505
- if (!(session == null ? void 0 : session.content))
1509
+ if (!session.content)
1506
1510
  return [];
1507
1511
  const sender = new Sender(this, `/channels/${channelId}/messages`);
1508
1512
  const results = await sender.send(session.content);