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

Function getAllShiftRules

shift/shift.ts:407–437  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

405 const rows = stmt.all() as any[];
406
407 return rows.map((row) => ({
408 sourceId: row.source_id,
409 rule: {
410 target_id: row.target_id,
411 options: JSON.parse(row.options || "[]"),
412 target_type: row.target_type,
413 paused: row.paused === 1,
414 created_at: row.created_at,
415 filters: JSON.parse(row.filters || "[]"),
416 },
417 }));
418 }
419 return [];
420 } catch (error) {
421 console.error("[SHIFT] Error getting all rules:", error);
422 return [];
423 }
424}
425
426// Utility functions
427function getDisplayName(entity: any): string {
428 if (!entity) return "未知实体";
429 if (entity.username) return `@${htmlEscape(entity.username)}`;
430 if (entity.firstName) return entity.firstName;
431 if (entity.title) return entity.title;
432 return `ID: ${entity.id}`;
433}
434
435function extractIdString(id: any): string {
436 if (id === undefined || id === null) return "";
437 if (typeof id === "object") {
438 if ("value" in id && id.value !== undefined && id.value !== null) {
439 return String(id.value);
440 }

Callers 2

exportRulesFunction · 0.85
ShiftPluginClass · 0.85

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected