Plugin
StickerSnatcher
Ermöglicht einfaches Speichern und Kopieren von Stickern. Ohne externe Abhängigkeiten.
Installation: Datei herunterladen und in deinen BetterDiscord-Ordner legen —
%appdata%\\BetterDiscord\\plugins
(Windows) bzw. über Discord: Einstellungen → Plugins → Plugin-Ordner öffnen.
StickerSnatcher.plugin.js · 215 Zeilen · 7.5 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
213
214
215
/*
FILE META START
name: StickerSnatcher.plugin.js
version: 0.0.10
description: Multi-surface admin, cloud, bot host, login, and secure chat server.
lastModified: 2026-05-04T20:22:59.659Z
checksum: 674296f32af670dbe20721d95b7da13adb266cebfb858ed0e9debb9ec31321f7
FILE META END
*/
/**
* @name StickerSnatcher
* @author HeadX
* @authorId 808385710700494919
* @description Ermöglicht einfaches Speichern und Kopieren von Stickern. Ohne externe Abhängigkeiten.
* @version 2.0.3
* @invite J6wTJJ5fp
* @website https://headcraft.cloud/better-discord
* @source https://headcraft.cloud/better-discord/StickerSnatcher.plugin.js
* @updateUrl https://headcraft.cloud/better-discord/StickerSnatcher.plugin.js
*/
const { Webpack, ContextMenu, Data, DOM } = BdApi;
module.exports = class StickerSnatcher {
constructor() {
this.name = "StickerSnatcher";
this.unpatch = null;
this.canvas = null;
this.settings = {
showCopyOption: true,
showSaveOption: true,
convertWebpToPng: true
};
}
loadSettings() {
const saved = Data.load(this.name, "settings");
this.settings = saved ? { ...this.settings, ...saved } : this.settings;
}
saveSettings() {
Data.save(this.name, "settings", this.settings);
}
start() {
this.loadSettings();
this.canvas = document.createElement("canvas");
DOM.addStyle(this.name, `
.sticker-snatcher-item {
color: var(--interactive-normal);
}
.sticker-snatcher-item:hover {
color: var(--interactive-hover);
background: var(--background-modifier-hover);
}
`);
try {
this.unpatch = ContextMenu.patch("message", (tree, props) => {
this.handleContextMenu(tree, props);
});
} catch (err) {
console.error("[StickerSnatcher] ContextMenu patch error:", err);
}
BdApi.showToast("StickerSnatcher aktiviert", { type: "success" });
}
handleContextMenu(tree, props) {
try {
if (!props?.message?.stickerItems?.length) return;
const sticker = props.message.stickerItems[0];
const format = sticker.format_type === 1 ? "png" :
sticker.format_type === 2 ? "png" :
sticker.format_type === 3 ? "json" :
sticker.format_type === 4 ? "gif" : "webp";
if (format === "json") return;
const url = `https://media.discordapp.net/stickers/${sticker.id}.${format}?size=320`;
const menuItems = [];
if (this.settings.showCopyOption) {
menuItems.push(
ContextMenu.buildItem({ type: "separator" }),
ContextMenu.buildItem({
label: "Sticker kopieren",
className: "sticker-snatcher-item",
action: () => this.copySticker(url, sticker.name)
})
);
}
if (this.settings.showSaveOption) {
menuItems.push(
ContextMenu.buildItem({
label: "Sticker speichern",
className: "sticker-snatcher-item",
action: () => this.saveSticker(url, sticker.name)
})
);
}
if (menuItems.length > 0) {
menuItems.push(ContextMenu.buildItem({ type: "separator" }));
}
const children = tree?.props?.children;
if (Array.isArray(children)) {
const targetGroup = children.find(c => c?.props?.children && Array.isArray(c.props.children));
if (targetGroup?.props?.children) {
targetGroup.props.children.push(...menuItems);
}
}
} catch (err) {
console.error("[StickerSnatcher] Context Menu error:", err);
}
}
async copySticker(url, name) {
try {
BdApi.showToast("Kopiere Sticker...", { type: "info" });
navigator.clipboard.writeText(url);
BdApi.showToast("URL in Zwischenablage kopiert", { type: "success" });
} catch (err) {
console.error("[StickerSnatcher] Copy error:", err);
BdApi.showToast("Fehler beim Kopieren", { type: "error" });
}
}
async saveSticker(url, name) {
try {
BdApi.showToast("Lade Sticker...", { type: "info" });
const response = await fetch(url);
const blob = await response.blob();
const buffer = await blob.arrayBuffer();
let filename = `${name || 'sticker'}.png`;
if (url.includes(".gif")) filename = `${name || 'sticker'}.gif`;
if (DiscordNative?.fileManager?.saveWithDialog) {
DiscordNative.fileManager.saveWithDialog(new Uint8Array(buffer), filename);
BdApi.showToast("Speicherdialog geöffnet", { type: "success" });
} else {
const downloadUrl = URL.createObjectURL(new Blob([buffer]));
const link = document.createElement("a");
link.href = downloadUrl;
link.download = filename;
link.click();
URL.revokeObjectURL(downloadUrl);
BdApi.showToast("Download gestartet", { type: "success" });
}
} catch (err) {
console.error("[StickerSnatcher] Save error:", err);
BdApi.showToast("Fehler beim Speichern", { type: "error" });
}
}
stop() {
if (this.unpatch) {
this.unpatch();
this.unpatch = null;
}
DOM.removeStyle(this.name);
this.canvas = null;
BdApi.showToast("StickerSnatcher deaktiviert", { type: "info" });
}
getSettingsPanel() {
const panel = document.createElement("div");
panel.style.padding = "10px";
panel.style.color = "var(--text-normal)";
const settings = [
{ key: "showCopyOption", label: "\"Sticker kopieren\" anzeigen" },
{ key: "showSaveOption", label: "\"Sticker speichern\" anzeigen" },
{ key: "convertWebpToPng", label: "WebP zu PNG konvertieren" }
];
settings.forEach(setting => {
const container = document.createElement("div");
container.style.marginBottom = "12px";
container.style.display = "flex";
container.style.justifyContent = "space-between";
container.style.alignItems = "center";
const label = document.createElement("span");
label.textContent = setting.label;
container.appendChild(label);
const toggle = document.createElement("input");
toggle.type = "checkbox";
toggle.checked = this.settings[setting.key];
toggle.style.cursor = "pointer";
toggle.addEventListener("change", () => {
this.settings[setting.key] = toggle.checked;
this.saveSettings();
});
container.appendChild(toggle);
panel.appendChild(container);
});
return panel;
}
};// touch to trigger watcher