aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/quickMention/index.tsx
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/quickMention/index.tsx
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/quickMention/index.tsx')
-rw-r--r--src/plugins/quickMention/index.tsx7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/quickMention/index.tsx b/src/plugins/quickMention/index.tsx
index d0699b9..9720c7d 100644
--- a/src/plugins/quickMention/index.tsx
+++ b/src/plugins/quickMention/index.tsx
@@ -20,7 +20,7 @@ import { addButton, removeButton } from "@api/MessagePopover";
import { Devs } from "@utils/constants";
import { insertTextIntoChatInputBox } from "@utils/discord";
import definePlugin from "@utils/types";
-import { ChannelStore } from "@webpack/common";
+import { ChannelStore, PermissionsBits, PermissionStore } from "@webpack/common";
export default definePlugin({
name: "QuickMention",
@@ -30,11 +30,14 @@ export default definePlugin({
start() {
addButton("QuickMention", msg => {
+ const channel = ChannelStore.getChannel(msg.channel_id);
+ if (!PermissionStore.can(PermissionsBits.SEND_MESSAGES, channel)) return null;
+
return {
label: "Quick Mention",
icon: this.Icon,
message: msg,
- channel: ChannelStore.getChannel(msg.channel_id),
+ channel,
onClick: () => insertTextIntoChatInputBox(`<@${msg.author.id}> `)
};
});