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

Method handleBlackList

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

Source from the content-addressed store, hash-verified

263 /* ===================== 黑名单处理 ===================== */
264
265 private async handleBlackList(msg: Api.Message, args: string[], chatId: string): Promise<void> {
266 const list = this.db.data.blacklist;
267
268 switch (args[2]) {
269 case "add":
270 if (!list.includes(chatId)) list.push(chatId);
271 await this.db.write();
272 await msg.edit({
273 text: `✔ 已将本会话加入黑名单`,
274 parseMode: "html",
275 });
276 return;
277
278 case "remove":
279 _.remove(list, (x) => x === chatId);
280 await this.db.write();
281 await msg.edit({
282 text: `✔ 已将本会话移出黑名单`,
283 parseMode: "html",
284 });
285 return;
286
287 case "list":
288 await msg.edit({
289 text: `⚫ 黑名单列表:\n<code>${htmlEscape(list.join("\n")) || "空"}</code>`,
290 parseMode: "html",
291 });
292 return;
293
294 default:
295 await msg.edit({ text: help_text, parseMode: "html" });
296 return;
297 }
298 }
299
300 /* ===================== 全局模式处理 ===================== */
301

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