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

Method handleWhiteList

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

Source from the content-addressed store, hash-verified

226 /* ===================== 白名单处理 ===================== */
227
228 private async handleWhiteList(msg: Api.Message, args: string[], chatId: string): Promise<void> {
229 const list = this.db.data.whitelist;
230
231 switch (args[2]) {
232 case "add":
233 if (!list.includes(chatId)) list.push(chatId);
234 await this.db.write();
235 await msg.edit({
236 text: `✔ 已将本会话加入白名单`,
237 parseMode: "html",
238 });
239 return;
240
241 case "remove":
242 _.remove(list, (x) => x === chatId);
243 await this.db.write();
244 await msg.edit({
245 text: `✔ 已将本会话移出白名单`,
246 parseMode: "html",
247 });
248 return;
249
250 case "list":
251 await msg.edit({
252 text: `⚪ 白名单列表:\n<code>${htmlEscape(list.join("\n")) || "空"}</code>`,
253 parseMode: "html",
254 });
255 return;
256
257 default:
258 await msg.edit({ text: help_text, parseMode: "html" });
259 return;
260 }
261 }
262
263 /* ===================== 黑名单处理 ===================== */
264

Callers 1

MessageModePluginClass · 0.95

Calls 4

writeMethod · 0.80
htmlEscapeFunction · 0.70
editMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected