feat(plugin): BetterQuickReact

This commit is contained in:
Sqaaakoi 2024-03-14 19:09:05 +13:00
parent 9bf0ca365b
commit 3d9dc75b3e
No known key found for this signature in database
2 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1,6 @@
/* Fixes to make the quick reactions look better */
[class*="wrapper_"][role="group"]:has(>[id*="message-quickreact-"]:nth-child(5)) {
padding: 4px 1px 6px;
gap: 2px;
}

View file

@ -0,0 +1,55 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import "./index.css";
import { definePluginSettings } from "@api/Settings";
import { makeRange } from "@components/PluginSettings/components";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
export const settings = definePluginSettings({
frequentEmojis: {
description: "Use top frecency emojis instead of favourite emojis",
type: OptionType.BOOLEAN,
default: true
},
rows: {
description: "Rows of quick reactions to display",
type: OptionType.SLIDER,
default: 2,
markers: makeRange(1, 16, 1),
stickToMarkers: true
},
});
export default definePlugin({
name: "BetterQuickReact",
description: "Improves the quick react buttons in the message context menu.",
authors: [Devs.Ven, Devs.Sqaaakoi],
settings,
patches: [
{
find: "this.favoriteEmojisWithoutFetchingLatest.concat",
predicate: () => settings.store.frequentEmojis,
replacement: {
match: "this.favoriteEmojisWithoutFetchingLatest.concat",
replace: "[].concat"
}
},
{
find: "default.Messages.ADD_REACTION_NAMED.format",
replacement: {
match: /(\i)\.length>4&&\((\i)\.length=4\);/,
replace: "$1.length>$self.getMaxQuickReactions()&&($2.length=$self.getMaxQuickReactions());"
}
}
],
getMaxQuickReactions() {
return settings.store.rows * 4;
}
});