aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorJeroen Claassens <jeroen.claassens@live.nl>2023-01-13 23:59:31 +0100
committerGitHub <noreply@github.com>2023-01-13 23:59:31 +0100
commit7582feb60352f19b7f8f6750c5be624bbf6baafa (patch)
tree04dda0459dd5645d890a9172cc9ec9c298bd6ec1 /src/plugins
parent6329499b1d589e8c5650565c640ca2a8da41f410 (diff)
downloadVencord-7582feb60352f19b7f8f6750c5be624bbf6baafa.tar.gz
Vencord-7582feb60352f19b7f8f6750c5be624bbf6baafa.tar.bz2
Vencord-7582feb60352f19b7f8f6750c5be624bbf6baafa.zip
feat(messageActions): make features toggleable (#373)
Co-authored-by: Ven <vendicated@riseup.net>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/messageActions.ts21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/plugins/messageActions.ts b/src/plugins/messageActions.ts
index df4d016..b71a9f1 100644
--- a/src/plugins/messageActions.ts
+++ b/src/plugins/messageActions.ts
@@ -1,6 +1,6 @@
/*
* Vencord, a modification for Discord's desktop app
- * Copyright (c) 2022 Vendicated and contributors
+ * Copyright (c) 2023 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
import { addClickListener, removeClickListener } from "@api/MessageEvents";
import { migratePluginSettings } from "@api/settings";
import { Devs } from "@utils/constants";
-import definePlugin from "@utils/types";
+import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy, findLazy } from "@webpack";
import { UserStore } from "@webpack/common";
@@ -35,6 +35,19 @@ export default definePlugin({
authors: [Devs.Ven],
dependencies: ["MessageEventsAPI"],
+ options: {
+ enableDeleteOnClick: {
+ type: OptionType.BOOLEAN,
+ description: "Enable delete on click",
+ default: true
+ },
+ enableDoubleClickToEdit: {
+ type: OptionType.BOOLEAN,
+ description: "Enable double click to edit",
+ default: true
+ }
+ },
+
start() {
const MessageActions = findByPropsLazy("deleteMessage", "startEditMessage");
const PermissionStore = findByPropsLazy("can", "initialize");
@@ -47,11 +60,11 @@ export default definePlugin({
this.onClick = addClickListener((msg, chan, event) => {
const isMe = msg.author.id === UserStore.getCurrentUser().id;
if (!isDeletePressed) {
- if (isMe && event.detail >= 2 && !EditStore.isEditing(chan.id, msg.id)) {
+ if (Vencord.Settings.plugins.MessageClickActions.enableDoubleClickToEdit && (isMe && event.detail >= 2 && !EditStore.isEditing(chan.id, msg.id))) {
MessageActions.startEditMessage(chan.id, msg.id, msg.content);
event.preventDefault();
}
- } else if (isMe || PermissionStore.can(Permissions.MANAGE_MESSAGES, chan)) {
+ } else if (Vencord.Settings.plugins.MessageClickActions.enableDeleteOnClick && (isMe || PermissionStore.can(Permissions.MANAGE_MESSAGES, chan))) {
MessageActions.deleteMessage(chan.id, msg.id);
event.preventDefault();
}