(msg: Api.Message, args: string)
| 321 | } |
| 322 | |
| 323 | private async handleDefault(msg: Api.Message, args: string) { |
| 324 | if (!args) throw new Error(`用法: ${mainPrefix}so default <频道链接> 或 ${mainPrefix}so default d。`); |
| 325 | if (args === "d") { |
| 326 | this.config.defaultChannel = null; |
| 327 | await this.saveConfig(); |
| 328 | await msg.edit({ text: `✅ 默认频道已移除。` }); |
| 329 | return; |
| 330 | } |
| 331 | const normalizedHandle = args.trim(); |
| 332 | if (!this.config.channelList.some((c) => c.handle === normalizedHandle)) { |
| 333 | throw new Error(`请先使用 \`${mainPrefix}so add\` 添加此频道。`); |
| 334 | } |
| 335 | this.config.defaultChannel = normalizedHandle; |
| 336 | await this.saveConfig(); |
| 337 | await msg.edit({ text: `✅ 已将 "${normalizedHandle}" 设为默认频道。` }); |
| 338 | } |
| 339 | |
| 340 | private async handleList(msg: Api.Message) { |
| 341 | if (this.config.channelList.length === 0) { |
no test coverage detected