Merge MoreQuickReactions into BetterQuickReact (#656)
* plugins: merge MoreQuickReactions into BetterQuickReact * plugins: merge MoreQuickReactions into betterQuickReact * plugins: betterQuickReact - migrate settings from MoreQuickReactions * move betterQuickReact into MoreQuickReactions * no excuses, im a moron * mark MoreQuickReactions as modified
This commit is contained in:
parent
7d228aeafc
commit
694fd6014c
4 changed files with 23 additions and 50 deletions
|
|
@ -1,7 +0,0 @@
|
|||
# MoreQuickReactions
|
||||
|
||||
Increases the number of reactions available in the Quick React hover menu.
|
||||
|
||||
You can change the number of reactions shown in the plugin settings.
|
||||
|
||||

|
||||
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2025 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
|
||||
const settings = definePluginSettings({
|
||||
reactionCount: {
|
||||
description: "Number of reactions (0-42)",
|
||||
type: OptionType.NUMBER,
|
||||
default: 5
|
||||
},
|
||||
});
|
||||
|
||||
export default definePlugin({
|
||||
name: "MoreQuickReactions",
|
||||
description: "Increases the number of reactions available in the Quick React hover menu",
|
||||
authors: [Devs.iamme],
|
||||
settings,
|
||||
|
||||
get reactionCount() {
|
||||
return settings.store.reactionCount;
|
||||
},
|
||||
|
||||
patches: [
|
||||
{
|
||||
find: "#{intl::MESSAGE_UTILITIES_A11Y_LABEL}",
|
||||
replacement: {
|
||||
match: /(?<=length>=3\?.{0,40})\.slice\(0,3\)/,
|
||||
replace: ".slice(0,$self.reactionCount)"
|
||||
}
|
||||
}
|
||||
],
|
||||
});
|
||||
|
|
@ -6,11 +6,16 @@
|
|||
|
||||
import "./style.css";
|
||||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { definePluginSettings, migratePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin, { makeRange, OptionType } from "@utils/types";
|
||||
|
||||
export const settings = definePluginSettings({
|
||||
reactionCount: {
|
||||
description: "Number of reactions (0-42)",
|
||||
type: OptionType.NUMBER,
|
||||
default: 5
|
||||
},
|
||||
frequentEmojis: {
|
||||
description: "Use frequently used emojis instead of favourite emojis",
|
||||
type: OptionType.BOOLEAN,
|
||||
|
|
@ -43,13 +48,23 @@ export const settings = definePluginSettings({
|
|||
}
|
||||
});
|
||||
|
||||
migratePluginSettings("MoreQuickReactions", "BetterQuickReact");
|
||||
|
||||
export default definePlugin({
|
||||
name: "BetterQuickReact",
|
||||
name: "MoreQuickReactions",
|
||||
description: "Improves the quick react buttons in the message context menu.",
|
||||
authors: [Devs.Ven, Devs.Sqaaakoi],
|
||||
authors: [Devs.Ven, Devs.Sqaaakoi, Devs.iamme],
|
||||
isModified: true,
|
||||
settings,
|
||||
|
||||
patches: [
|
||||
{
|
||||
find: "#{intl::MESSAGE_UTILITIES_A11Y_LABEL}",
|
||||
replacement: {
|
||||
match: /(?<=length>=3\?.{0,40})\.slice\(0,3\)/,
|
||||
replace: ".slice(0,$self.reactionCount)"
|
||||
}
|
||||
},
|
||||
// Remove favourite emojis from being inserted at the start of the reaction list
|
||||
{
|
||||
find: "this.favoriteEmojisWithoutFetchingLatest.concat",
|
||||
|
|
@ -70,7 +85,7 @@ export default definePlugin({
|
|||
// Override limit of emojis to display with offset hook.
|
||||
{
|
||||
match: /(\i)\.length>4&&\((\i)\.length=4\);/,
|
||||
replace: "let [betterQuickReactScrollValue,setBetterQuickReactScrollValue]=Vencord.Webpack.Common.React.useState(0);betterQuickReactScrollValue;"
|
||||
replace: "let [moreQuickReactionsScrollValue,setMoreQuickReactionScrollValue]=Vencord.Webpack.Common.React.useState(0);MoreQuickReactionsScrollValue;"
|
||||
},
|
||||
// Add a custom class to identify the quick reactions have been modified and a CSS variable for the number of columns to display
|
||||
{
|
||||
|
|
@ -80,7 +95,7 @@ export default definePlugin({
|
|||
// Scroll handler + Apply the emoji count limit from earlier with custom logic
|
||||
{
|
||||
match: /children:(\i)\.map\(/,
|
||||
replace: "onWheel:$self.onWheelWrapper(betterQuickReactScrollValue,setBetterQuickReactScrollValue,$1.length),children:$self.applyScroll($1,betterQuickReactScrollValue).map("
|
||||
replace: "onWheel:$self.onWheelWrapper(moreQuickReactionsScrollValue,setMoreQuickReactionsScrollValue,$1.length),children:$self.applyScroll($1,moreQuickReactionsScrollValue).map("
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -96,6 +111,9 @@ export default definePlugin({
|
|||
getMaxQuickReactions() {
|
||||
return settings.store.rows * settings.store.columns;
|
||||
},
|
||||
get reactionCount() {
|
||||
return settings.store.reactionCount;
|
||||
},
|
||||
applyScroll(emojis: any[], index: number) {
|
||||
return emojis.slice(index, index + this.getMaxQuickReactions());
|
||||
},
|
||||
Loading…
Add table
Reference in a new issue