diff options
| author | Hugo C <lumap@duck.com> | 2023-09-24 16:42:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-24 16:42:53 +0200 |
| commit | 044f64e446b67613282fa96192abe6d1ed504923 (patch) | |
| tree | f4e076f06fbf20b56b41907d008ae97b49322808 /src/plugins/quickMention | |
| parent | 0b7fca864af6b99800e5a005e45ec8a527c54fb9 (diff) | |
| download | Vencord-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')
| -rw-r--r-- | src/plugins/quickMention/README.md | 5 | ||||
| -rw-r--r-- | src/plugins/quickMention/index.tsx | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/plugins/quickMention/README.md b/src/plugins/quickMention/README.md new file mode 100644 index 0000000..fd86261 --- /dev/null +++ b/src/plugins/quickMention/README.md @@ -0,0 +1,5 @@ +# QuickMention + +Adds a mention icon to the messages action bar + + 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}> `) }; }); |
