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

Method normalize

im/im.ts:159–179  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

157
158 private static normalize() {
159 const data = this.db?.data as any;
160 if (!data) return;
161 // 兼容旧版 monitoredChats: (string|number)[] -> MonitoredChat[]
162 if (Array.isArray(data.monitoredChats)) {
163 const first = data.monitoredChats[0];
164 if (first && (typeof first === 'string' || typeof first === 'number')) {
165 data.monitoredChats = (data.monitoredChats as (string|number)[]).map((id) => ({ id: String(id), name: String(id) }));
166 }
167 } else {
168 data.monitoredChats = [];
169 }
170 // 确保 bannedStickerIds 存在
171 if (!data.bannedStickerIds || typeof data.bannedStickerIds !== 'object') {
172 data.bannedStickerIds = {};
173 }
174 // 确保 defaultAction 存在
175 if (data.defaultAction !== 'delete' && data.defaultAction !== 'ban') {
176 data.defaultAction = 'delete';
177 }
178 }
179}
180
181// ==================== 主插件类 ====================
182class ImageMonitorPlugin extends Plugin {

Callers 5

initMethod · 0.95
getConfigMethod · 0.95
cleanResponseTextMethod · 0.80
cleanResponseTextMethod · 0.80
cleanResponseTextMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected