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

Method muteUser

aban/aban.ts:821–848  ·  view source on GitHub ↗
(
    client: TelegramClient,
    chatId: any,
    userId: number,
    duration: number,
    participant?: any
  )

Source from the content-addressed store, hash-verified

819 }
820 const isChannel = !(dialog.isGroup && !dialog.isChannel);
821 const rawHash = isChannel ? dialog.entity?.accessHash : undefined;
822 const accessHash = rawHash != null ? String(rawHash) : undefined;
823 // ⚠️ dialog.id 是 marked id;API 需要 entity 上的 raw 正数 id
824 const rawId = Number(dialog.entity?.id ?? dialog.id);
825 if (!Number.isFinite(rawId) || rawId === 0) continue;
826 groups.push({
827 id: rawId,
828 title: dialog.title || "Unknown",
829 kind: isChannel ? 'channel' as const : 'chat' as const,
830 accessHash,
831 });
832 }
833 console.log(
834 `[GroupManager] 有管理权群组 ${groups.length}/${(dialogs || []).length}(本地 adminRights 过滤,跳过无权限 ${skippedNoRights})`
835 );
836
837 try {
838 await this.cache.set("managed_groups_v5", groups);
839 // 作废可能被假阴性写空的 v4
840 try {
841 await this.cache.set("managed_groups_v4", []);
842 } catch {}
843 try {
844 await this.cache.set("managed_groups_v3", []);
845 } catch {}
846 } catch (cacheError) {
847 console.error(`[GroupManager] 缓存群组失败: ${cacheError}`);
848 }
849 } catch (error) {
850 console.error(`[GroupManager] 获取群组失败: ${error}`);
851 }

Callers 1

handleBasicCommandMethod · 0.80

Calls 3

resolveParticipantMethod · 0.95
applyBanLikeActionMethod · 0.95
errorMethod · 0.80

Tested by

no test coverage detected