Plugin
PluginCheckerSuite
🔧 Premium Plugin-Suite! Kombiniert Health-Check, Kompatibilitäts-Helper und Load-Logger. Überwacht Plugins, erkennt Fehler, cached Module und schreibt Logs.
Installation: Datei herunterladen und in deinen BetterDiscord-Ordner legen —
%appdata%\\BetterDiscord\\plugins
(Windows) bzw. über Discord: Einstellungen → Plugins → Plugin-Ordner öffnen.
PluginCheckerSuite.plugin.js · 212 Zeilen · 9.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/*
FILE META START
name: PluginCheckerSuite.plugin.js
version: 0.0.10
description: Multi-surface admin, cloud, bot host, login, and secure chat server.
lastModified: 2026-05-04T20:22:59.647Z
checksum: 66810342cedddb1624057269a86049fe689b7dba7eb847e3ea3342be67ff37e3
FILE META END
*/
/**
* @name PluginCheckerSuite
* @author HeadX
* @authorId 808385710700494919
* @description 🔧 Premium Plugin-Suite! Kombiniert Health-Check, Kompatibilitäts-Helper und Load-Logger. Überwacht Plugins, erkennt Fehler, cached Module und schreibt Logs.
* @version 2.0.2
* @invite J6wTJJ5fp
* @website https://headcraft.cloud/better-discord
* @source https://headcraft.cloud/better-discord/PluginCheckerSuite.plugin.js
* @updateUrl https://headcraft.cloud/better-discord/PluginCheckerSuite.plugin.js
*/
module.exports = class PluginCheckerSuite {
constructor() {
this.name = "PluginCheckerSuite";
this.pluginStatus = new Map();
this.errorLog = [];
this.moduleCache = new Map();
this.checkInterval = null;
this._startTime = null;
this.settings = {
autoCheck: true,
checkIntervalMinutes: 5,
showNotifications: true,
logToConsole: true,
enableModuleCache: true
};
}
loadSettings() {
const saved = BdApi.Data.load(this.name, "settings");
this.settings = saved ? { ...this.settings, ...saved } : this.settings;
}
saveSettings() {
BdApi.Data.save(this.name, "settings", this.settings);
}
start() {
this._startTime = Date.now();
this.loadSettings();
this.addStyles();
if (this.settings.enableModuleCache) this.setupModuleCache();
setTimeout(() => this.runHealthCheck(true), 2000);
if (this.settings.autoCheck) {
this.checkInterval = setInterval(() => this.runHealthCheck(true), this.settings.checkIntervalMinutes * 60 * 1000);
}
this._autoUpdate();
this.log("✅ PluginCheckerSuite gestartet");
BdApi.showToast("🔧 PluginCheckerSuite aktiviert!", { type: "success" });
}
addStyles() {
BdApi.DOM.addStyle(this.name, `
.pcs-health-status { padding: 10px; margin: 5px 0; border-radius: 8px; background: var(--background-secondary); }
.pcs-health-status.healthy { border-left: 4px solid var(--status-positive); }
.pcs-health-status.warning { border-left: 4px solid var(--status-warning); }
.pcs-health-status.error { border-left: 4px solid var(--status-danger); }
.pcs-health-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.pcs-health-name { font-weight: 600; color: var(--text-normal); }
.pcs-health-version { font-size: 12px; color: var(--text-muted); }
.pcs-health-message { font-size: 13px; color: var(--text-muted); }
.pcs-settings { padding: 16px; color: var(--text-normal); }
.pcs-btn { padding: 8px 16px; background: var(--brand-experiment); color: white; border: none; border-radius: 4px; cursor: pointer; margin: 5px; }
.pcs-btn:hover { background: var(--brand-experiment-560); }
`);
}
setupModuleCache() {
const W = BdApi.Webpack;
const modules = [
{ n: "UserStore", s: "UserStore" },
{ n: "GuildStore", s: "GuildStore" },
{ n: "ChannelStore", s: "ChannelStore" }
];
modules.forEach(m => {
try {
const mod = W.getStore(m.s);
if (mod) this.moduleCache.set(m.n, mod);
} catch (e) {}
});
this.log(`${this.moduleCache.size} Module gecached`);
}
runHealthCheck(silent = false) {
this.pluginStatus.clear();
const plugins = BdApi.Plugins.getAll();
let issues = 0;
plugins.forEach(p => {
const s = this.checkPlugin(p);
this.pluginStatus.set(p.name, s);
if (s.status !== "healthy") issues++;
});
if (!silent && this.settings.showNotifications) {
BdApi.showToast(issues === 0 ? `✅ Alle ${plugins.length} Plugins OK` : `⚠️ ${issues} Plugin(s) mit Problemen`, { type: issues === 0 ? "success" : "warning" });
}
this.log(`Health-Check: ${plugins.length} Plugins, ${issues} Probleme`);
return { total: plugins.length, issues };
}
checkPlugin(plugin) {
const r = { name: plugin.name, version: plugin.version || "?", author: plugin.author || "?", status: "healthy", messages: [] };
try {
if (!BdApi.Plugins.isEnabled(plugin.name)) {
r.status = "warning";
r.messages.push("Deaktiviert");
}
if (!r.messages.length) r.messages.push("OK");
} catch (e) {
r.status = "error";
r.messages.push(e.message);
}
return r;
}
log(...a) {
if (this.settings.logToConsole) console.log(`[${this.name}]`, ...a);
}
stop() {
if (this.checkInterval) clearInterval(this.checkInterval);
BdApi.DOM.removeStyle(this.name);
this.moduleCache.clear();
this.log("Plugin gestoppt");
}
getSettingsPanel() {
const p = document.createElement("div");
p.className = "pcs-settings";
p.innerHTML = `<h3 style="margin-bottom:15px">🔧 PluginCheckerSuite</h3>`;
const btn = document.createElement("button");
btn.textContent = "🔍 Jetzt prüfen";
btn.className = "pcs-btn";
btn.onclick = () => this.runHealthCheck();
p.appendChild(btn);
const settings = [
{ k: "autoCheck", l: "Auto-Check" },
{ k: "showNotifications", l: "Benachrichtigungen" },
{ k: "logToConsole", l: "Konsolen-Log" }
];
settings.forEach(s => {
const row = document.createElement("div");
row.style.cssText = "display:flex;justify-content:space-between;align-items:center;margin:10px 0;padding:8px;background:var(--background-secondary);border-radius:6px";
row.innerHTML = `<span>${s.l}</span>`;
const toggle = document.createElement("input");
toggle.type = "checkbox";
toggle.checked = this.settings[s.k];
toggle.onchange = () => {
this.settings[s.k] = toggle.checked;
this.saveSettings();
};
row.appendChild(toggle);
p.appendChild(row);
});
return p;
}
// ===== HeadX Auto-Update System =====
async _autoUpdate() {
const pluginName = this.name || "PluginCheckerSuite";
const currentVersion = this.version || this.meta?.version || "0.0.0";
const updateUrl = this.updateUrl || this.meta?.updateUrl || `https://headcraft.cloud/better-discord/${pluginName}.plugin.js`;
try {
const fs = require("fs"), path = require("path");
let res; try { res = await fetch(updateUrl); } catch(e) {}
if (!res?.ok) { try { res = await BdApi.Net.fetch(updateUrl); } catch(e) {} }
if (!res?.ok) return;
const remoteCode = await res.text();
const remoteVersion = remoteCode.match(/@version\s+([^\n\r]+)/)?.[1]?.trim();
if (!remoteVersion) return;
const compare = (a, b) => { const pa = a.split('.').map(Number), pb = b.split('.').map(Number); for (let i = 0; i < Math.max(pa.length, pb.length); i++) { if ((pa[i]||0) > (pb[i]||0)) return 1; if ((pa[i]||0) < (pb[i]||0)) return -1; } return 0; };
if (compare(remoteVersion, currentVersion) <= 0) return;
console.log(`[${pluginName}] Update verfügbar: ${currentVersion} → ${remoteVersion}`);
const pluginsFolder = BdApi.Plugins.folder;
const allFiles = fs.readdirSync(pluginsFolder);
const pluginFile = allFiles.find(f => f.endsWith('.plugin.js') && fs.readFileSync(path.join(pluginsFolder, f), 'utf8').match(new RegExp(`@name\\s+${pluginName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\s`))) || `${pluginName}.plugin.js`;
const filePath = path.join(pluginsFolder, pluginFile);
if (typeof BdApi.UI?.showNotification === 'function') {
BdApi.UI.showNotification({ title: `${pluginName} Update`, content: `Version ${remoteVersion} ist verfügbar! (Aktuell: ${currentVersion})`, actions: [{ label: "Jetzt updaten", onClick: () => { fs.writeFileSync(filePath, remoteCode, 'utf8'); BdApi.showToast(`${pluginName} auf v${remoteVersion} aktualisiert!`, { type: "success" }); } }] });
} else { BdApi.showToast(`${pluginName}: Update v${remoteVersion} verfügbar!`, { type: "warning" }); }
} catch (err) { console.error(`[${pluginName}] Auto-Update Fehler:`, err); }
}
// ===== Ende HeadX Auto-Update System =====
};