MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / handleDefault

Method handleDefault

search/search.ts:323–338  ·  view source on GitHub ↗
(msg: Api.Message, args: string)

Source from the content-addressed store, hash-verified

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) {

Callers 1

handleMethod · 0.95

Calls 2

saveConfigMethod · 0.95
editMethod · 0.45

Tested by

no test coverage detected