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

Method handleGlobalMode

mode/mode.ts:302–327  ·  view source on GitHub ↗
(msg: Api.Message, args: string[])

Source from the content-addressed store, hash-verified

300 /* ===================== 全局模式处理 ===================== */
301
302 private async handleGlobalMode(msg: Api.Message, args: string[]): Promise<void> {
303 if (args.length === 2) {
304 const g = this.db.data.globalMode;
305 await msg.edit({
306 text: `🌐 <b>全局模式:</b> <code>${g}</code>`,
307 parseMode: "html",
308 });
309 return;
310 }
311
312 const modeStr = args[2].toLowerCase();
313
314 if (!Object.values(Mode).includes(modeStr as Mode)) {
315 await msg.edit({ text: help_text, parseMode: "html" });
316 return;
317 }
318
319 this.db.data.globalMode = modeStr as Mode;
320 await this.db.write();
321
322 await msg.edit({
323 text: `🌐 全局模式已更新为:<b>${modeStr}</b>`,
324 parseMode: "html",
325 });
326 return;
327 }
328
329 /* ===================== 监听所有消息 ===================== */
330

Callers 1

MessageModePluginClass · 0.95

Calls 2

writeMethod · 0.80
editMethod · 0.45

Tested by

no test coverage detected