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

Method handleCommand

openlist/openlist.ts:78–160  ·  view source on GitHub ↗
(msg: Api.Message)

Source from the content-addressed store, hash-verified

76`;
77
78class OpenListPlugin extends Plugin {
79
80 description: string = `\nOpenList 管理\n\n${helpText}`;
81 cmdHandlers: Record<string, (msg: Api.Message) => Promise<void>> = {
82 openlist: async (msg: Api.Message) => {
83 await this.handleCommand(msg);
84 },
85 op: async (msg: Api.Message) => {
86 await this.handleCommand(msg);
87 },
88 };
89
90 private async handleCommand(msg: Api.Message) {
91 const args = (msg.message || "").trim().split(/\s+/);
92 const sub = args[1] || "";
93
94 switch (sub) {
95 case "install":
96 if (!(await this.isSavedMessages(msg))) {
97 await msg.edit({ text: "⚠️ 此命令仅限在「收藏夹」中使用" });
98 return;
99 }
100 await msg.edit({ text: "正在准备安装..." });
101 await this.handleInstall(msg, args[2]);
102 break;
103 case "update":
104 if (!(await this.isSavedMessages(msg))) {
105 await msg.edit({ text: "⚠️ 此命令仅限在「收藏夹」中使用" });
106 return;
107 }
108 await msg.edit({ text: "正在准备更新..." });
109 await this.handleUpdate(msg);
110 break;
111 case "uninstall":
112 if (!(await this.isSavedMessages(msg))) {
113 await msg.edit({ text: "⚠️ 此命令仅限在「收藏夹」中使用" });
114 return;
115 }
116 await msg.edit({ text: "正在准备卸载..." });
117 await this.handleUninstall(msg);
118 break;
119 case "status":
120 if (!(await this.isSavedMessages(msg))) {
121 await msg.edit({ text: "⚠️ 此命令仅限在「收藏夹」中使用" });
122 return;
123 }
124 await this.handleStatus(msg);
125 break;
126 case "backup":
127 if (!(await this.isSavedMessages(msg))) {
128 await msg.edit({ text: "⚠️ 此命令仅限在「收藏夹」中使用" });
129 return;
130 }
131 await msg.edit({ text: "正在准备备份..." });
132 await this.handleBackup(msg);
133 break;
134 case "restore":
135 if (!(await this.isSavedMessages(msg))) {

Callers 1

OpenListPluginClass · 0.95

Calls 13

isSavedMessagesMethod · 0.95
handleInstallMethod · 0.95
handleUpdateMethod · 0.95
handleUninstallMethod · 0.95
handleStatusMethod · 0.95
handleBackupMethod · 0.95
handleRestoreMethod · 0.95
handleAdminMethod · 0.95
handleSetPortMethod · 0.95
handleSaveMethod · 0.95
handleLoginMethod · 0.95
handleSetDefaultMethod · 0.95

Tested by

no test coverage detected