From f2d913c6723d9ede949a576f473f1fc4902b614e Mon Sep 17 00:00:00 2001 From: obscurity Date: Mon, 3 Oct 2022 20:43:25 +0200 Subject: [PATCH] feat(plugin): add betterUploadButton (#32) plugin to upload with a single click and open the context menu with right click --- src/plugins/betterUploadButton.ts | 18 ++++++++++++++++++ src/plugins/randomiseFileNames.ts | 8 ++------ src/utils/constants.ts | 4 ++++ 3 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 src/plugins/betterUploadButton.ts diff --git a/src/plugins/betterUploadButton.ts b/src/plugins/betterUploadButton.ts new file mode 100644 index 000000000..f2d2512c4 --- /dev/null +++ b/src/plugins/betterUploadButton.ts @@ -0,0 +1,18 @@ +import definePlugin from "../utils/types"; +import { Devs } from "../utils/constants"; + +export default definePlugin({ + name: "BetterUploadButton", + authors: [Devs.obscurity], + description: "Upload with a single click, open menu with right click", + patches: [ + { + find: "Messages.CHAT_ATTACH_UPLOAD_OR_INVITE", + replacement: { + match: /CHAT_ATTACH_UPLOAD_OR_INVITE,onDoubleClick:([^,]+),onClick:([^,]+)}}/, + replace: + "CHAT_ATTACH_UPLOAD_OR_INVITE,onClick:$1,onContextMenu:$2}}", + }, + }, + ], +}); diff --git a/src/plugins/randomiseFileNames.ts b/src/plugins/randomiseFileNames.ts index 687b288c7..eeaef3a36 100644 --- a/src/plugins/randomiseFileNames.ts +++ b/src/plugins/randomiseFileNames.ts @@ -1,13 +1,9 @@ import definePlugin from "../utils/types"; +import { Devs } from "../utils/constants"; export default definePlugin({ name: "RandomiseFileNames", - authors: [ - { - name: "obscurity", - id: 336678828233588736n, - }, - ], + authors: [Devs.obscurity], description: "Randomise uploaded file names", patches: [ { diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 29ba6faff..9f7374d02 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -22,5 +22,9 @@ export const Devs = Object.freeze({ botato: { name: "botato", id: 440990343899643943n + }, + obscurity: { + name: "obscurity", + id: 336678828233588736n, } });