diff options
author | Nuckyz <61953774+Nuckyz@users.noreply.github.com> | 2023-03-19 04:53:00 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-19 04:53:00 -0300 |
commit | 0fb79b763d797d70d2eb6d847b0bf711c9927337 (patch) | |
tree | b95674e930baa1a9b3651185e990b46acd82f871 /src/plugins/messageActions.ts | |
parent | 5873bde6a62857f92f3fb3d756914cc1efd0ec25 (diff) | |
download | Vencord-0fb79b763d797d70d2eb6d847b0bf711c9927337.tar.gz Vencord-0fb79b763d797d70d2eb6d847b0bf711c9927337.tar.bz2 Vencord-0fb79b763d797d70d2eb6d847b0bf711c9927337.zip |
Improvements, changes and fixes (#611)
Diffstat (limited to 'src/plugins/messageActions.ts')
-rw-r--r-- | src/plugins/messageActions.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/messageActions.ts b/src/plugins/messageActions.ts index b71a9f1..f244554 100644 --- a/src/plugins/messageActions.ts +++ b/src/plugins/messageActions.ts @@ -20,13 +20,15 @@ import { addClickListener, removeClickListener } from "@api/MessageEvents"; import { migratePluginSettings } from "@api/settings"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; -import { findByPropsLazy, findLazy } from "@webpack"; -import { UserStore } from "@webpack/common"; +import { findByPropsLazy } from "@webpack"; +import { PermissionStore, UserStore } from "@webpack/common"; let isDeletePressed = false; const keydown = (e: KeyboardEvent) => e.key === "Backspace" && (isDeletePressed = true); const keyup = (e: KeyboardEvent) => e.key === "Backspace" && (isDeletePressed = false); +const MANAGE_CHANNELS = 1n << 4n; + migratePluginSettings("MessageClickActions", "MessageQuickActions"); export default definePlugin({ @@ -50,8 +52,6 @@ export default definePlugin({ start() { const MessageActions = findByPropsLazy("deleteMessage", "startEditMessage"); - const PermissionStore = findByPropsLazy("can", "initialize"); - const Permissions = findLazy(m => typeof m.MANAGE_MESSAGES === "bigint"); const EditStore = findByPropsLazy("isEditing", "isEditingAny"); document.addEventListener("keydown", keydown); @@ -64,7 +64,7 @@ export default definePlugin({ MessageActions.startEditMessage(chan.id, msg.id, msg.content); event.preventDefault(); } - } else if (Vencord.Settings.plugins.MessageClickActions.enableDeleteOnClick && (isMe || PermissionStore.can(Permissions.MANAGE_MESSAGES, chan))) { + } else if (Vencord.Settings.plugins.MessageClickActions.enableDeleteOnClick && (isMe || PermissionStore.can(MANAGE_CHANNELS, chan))) { MessageActions.deleteMessage(chan.id, msg.id); event.preventDefault(); } |