mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 23:38:32 +00:00
add debounce
This commit is contained in:
parent
a24967ed2f
commit
5f5e9c9558
1 changed files with 6 additions and 0 deletions
|
@ -161,10 +161,14 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
debounce: new Set<string>(),
|
||||||
async processEmbeds(message: Message) {
|
async processEmbeds(message: Message) {
|
||||||
if (message.state !== "SENT") return;
|
if (message.state !== "SENT") return;
|
||||||
if (message.hasFlag(EMBED_SUPPRESSED)) return;
|
if (message.hasFlag(EMBED_SUPPRESSED)) return;
|
||||||
|
|
||||||
|
if (this.debounce.has(message.id)) return;
|
||||||
|
this.debounce.add(message.id);
|
||||||
|
|
||||||
let updateMessage = false;
|
let updateMessage = false;
|
||||||
|
|
||||||
const svgUrls = new Set(message.content.match(URL_REGEX));
|
const svgUrls = new Set(message.content.match(URL_REGEX));
|
||||||
|
@ -195,5 +199,7 @@ export default definePlugin({
|
||||||
if (updateMessage) {
|
if (updateMessage) {
|
||||||
FluxDispatcher.dispatch({ type: "MESSAGE_UPDATE", message });
|
FluxDispatcher.dispatch({ type: "MESSAGE_UPDATE", message });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.debounce.delete(message.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue