1
0
Fork 1
mirror of https://github.com/Vendicated/Vencord.git synced 2025-01-09 09:26:22 +00:00

fix outdated badge api code

This commit is contained in:
Vendicated 2024-11-21 04:19:01 +01:00
parent 0ff070443e
commit 014c4b4195
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18
2 changed files with 7 additions and 7 deletions

View file

@ -101,7 +101,7 @@ export default definePlugin({
},
async start() {
Vencord.Api.Badges.addBadge(ContributorBadge);
Vencord.Api.Badges.addProfileBadge(ContributorBadge);
await loadBadges();
},

View file

@ -89,6 +89,11 @@ function isReporterTestable(p: Plugin, part: ReporterTestable) {
: (p.reporterTestable & part) === part;
}
const pluginKeysToBind: Array<keyof PluginDef & `${"on" | "render"}${string}`> = [
"onBeforeMessageEdit", "onBeforeMessageSend", "onMessageClick",
"renderChatBarButton", "renderMemberListDecorator", "renderMessageAccessory", "renderMessageDecoration", "renderMessagePopoverButton"
];
const neededApiPlugins = new Set<string>();
// First round-trip to mark and force enable dependencies
@ -122,12 +127,7 @@ for (const p of pluginsValues) if (isPluginEnabled(p.name)) {
if (p.renderMessageDecoration) neededApiPlugins.add("MessageDecorationsAPI");
if (p.renderMessagePopoverButton) neededApiPlugins.add("MessagePopoverAPI");
const keysToBind: Array<keyof PluginDef & `${"on" | "render"}${string}`> = [
"onBeforeMessageEdit", "onBeforeMessageSend", "onMessageClick",
"renderChatBarButton", "renderMemberListDecorator", "renderMessageAccessory", "renderMessageDecoration", "renderMessagePopoverButton"
];
for (const key of keysToBind) {
for (const key of pluginKeysToBind) {
p[key] &&= p[key].bind(p) as any;
}
}