@satorijs/adapter-discord 3.9.1 → 3.9.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/bot.d.ts CHANGED
@@ -54,6 +54,7 @@ export declare class DiscordBot extends Bot<DiscordBot.Config> {
54
54
  export declare namespace DiscordBot {
55
55
  interface Config extends Bot.Config, Quester.Config, DiscordMessageEncoder.Config, WsClient.Config {
56
56
  token: string;
57
+ slash?: boolean;
57
58
  }
58
59
  const Config: Schema<Config>;
59
60
  }
package/lib/index.js CHANGED
@@ -1648,10 +1648,14 @@ var _DiscordMessageEncoder = class _DiscordMessageEncoder extends import_satori3
1648
1648
  } else {
1649
1649
  this.buffer += ` (<${attrs.href}>) `;
1650
1650
  }
1651
+ } else if (type === "br") {
1652
+ this.buffer += "\n";
1651
1653
  } else if (type === "p") {
1652
1654
  if (!this.buffer.endsWith("\n"))
1653
1655
  this.buffer += "\n";
1654
1656
  await this.render(children);
1657
+ if (!this.buffer.endsWith("\n"))
1658
+ this.buffer += "\n";
1655
1659
  this.buffer += "\n";
1656
1660
  } else if (type === "blockquote") {
1657
1661
  if (!this.buffer.endsWith("\n"))
@@ -2075,6 +2079,8 @@ var _DiscordBot = class _DiscordBot extends import_satori5.Bot {
2075
2079
  return this.sendMessage(channel.id, content, null, options);
2076
2080
  }
2077
2081
  async updateCommands(commands) {
2082
+ if (!this.config.slash)
2083
+ return;
2078
2084
  this.commands = commands;
2079
2085
  const local = Object.fromEntries(commands.map((cmd) => [cmd.name, cmd]));
2080
2086
  const remote = Object.fromEntries((await this.internal.getGlobalApplicationCommands(this.selfId, { with_localizations: true })).filter((cmd) => cmd.type === ApplicationCommand2.Type.CHAT_INPUT).map((cmd) => [cmd.name, cmd]));
@@ -2131,6 +2137,9 @@ __name(shapeEqual, "shapeEqual");
2131
2137
  import_satori5.Schema.object({
2132
2138
  token: import_satori5.Schema.string().description("机器人的用户令牌。").role("secret").required()
2133
2139
  }),
2140
+ import_satori5.Schema.object({
2141
+ slash: import_satori5.Schema.boolean().description("是否启用斜线指令。").default(true)
2142
+ }).description("功能设置"),
2134
2143
  WsClient.Config,
2135
2144
  DiscordMessageEncoder.Config,
2136
2145
  import_satori5.Quester.createConfig("https://discord.com/api/v10")