aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/emoteCloner
diff options
context:
space:
mode:
authorHugo C <lumap@duck.com>2023-09-24 16:42:53 +0200
committerGitHub <noreply@github.com>2023-09-24 16:42:53 +0200
commit044f64e446b67613282fa96192abe6d1ed504923 (patch)
treef4e076f06fbf20b56b41907d008ae97b49322808 /src/plugins/emoteCloner
parent0b7fca864af6b99800e5a005e45ec8a527c54fb9 (diff)
downloadVencord-044f64e446b67613282fa96192abe6d1ed504923.tar.gz
Vencord-044f64e446b67613282fa96192abe6d1ed504923.tar.bz2
Vencord-044f64e446b67613282fa96192abe6d1ed504923.zip
Improve permission checks on several plugins (#1746)
Co-authored-by: V <vendicated@riseup.net>
Diffstat (limited to 'src/plugins/emoteCloner')
-rw-r--r--src/plugins/emoteCloner/index.tsx6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/plugins/emoteCloner/index.tsx b/src/plugins/emoteCloner/index.tsx
index 0900422..7acb6ec 100644
--- a/src/plugins/emoteCloner/index.tsx
+++ b/src/plugins/emoteCloner/index.tsx
@@ -24,11 +24,9 @@ import { Margins } from "@utils/margins";
import { ModalContent, ModalHeader, ModalRoot, openModalLazy } from "@utils/modal";
import definePlugin from "@utils/types";
import { findByCodeLazy, findStoreLazy } from "@webpack";
-import { EmojiStore, FluxDispatcher, Forms, GuildStore, Menu, PermissionStore, React, RestAPI, Toasts, Tooltip, UserStore } from "@webpack/common";
+import { EmojiStore, FluxDispatcher, Forms, GuildStore, Menu, PermissionsBits, PermissionStore, React, RestAPI, Toasts, Tooltip, UserStore } from "@webpack/common";
import { Promisable } from "type-fest";
-const MANAGE_EMOJIS_AND_STICKERS = 1n << 30n;
-
const StickersStore = findStoreLazy("StickersStore");
const uploadEmoji = findByCodeLazy('"EMOJI_UPLOAD_START"', "GUILD_EMOJIS(");
@@ -120,7 +118,7 @@ function getGuildCandidates(data: Data) {
return Object.values(GuildStore.getGuilds()).filter(g => {
const canCreate = g.ownerId === meId ||
- BigInt(PermissionStore.getGuildPermissions({ id: g.id }) & MANAGE_EMOJIS_AND_STICKERS) === MANAGE_EMOJIS_AND_STICKERS;
+ (PermissionStore.getGuildPermissions({ id: g.id }) & PermissionsBits.CREATE_GUILD_EXPRESSIONS) === PermissionsBits.CREATE_GUILD_EXPRESSIONS;
if (!canCreate) return false;
if (data.t === "Sticker") return true;