@satorijs/adapter-discord 3.9.2 → 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
@@ -2079,6 +2079,8 @@ var _DiscordBot = class _DiscordBot extends import_satori5.Bot {
2079
2079
  return this.sendMessage(channel.id, content, null, options);
2080
2080
  }
2081
2081
  async updateCommands(commands) {
2082
+ if (!this.config.slash)
2083
+ return;
2082
2084
  this.commands = commands;
2083
2085
  const local = Object.fromEntries(commands.map((cmd) => [cmd.name, cmd]));
2084
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]));
@@ -2135,6 +2137,9 @@ __name(shapeEqual, "shapeEqual");
2135
2137
  import_satori5.Schema.object({
2136
2138
  token: import_satori5.Schema.string().description("机器人的用户令牌。").role("secret").required()
2137
2139
  }),
2140
+ import_satori5.Schema.object({
2141
+ slash: import_satori5.Schema.boolean().description("是否启用斜线指令。").default(true)
2142
+ }).description("功能设置"),
2138
2143
  WsClient.Config,
2139
2144
  DiscordMessageEncoder.Config,
2140
2145
  import_satori5.Quester.createConfig("https://discord.com/api/v10")