mirror of
https://github.com/Equicord/Equicord.git
synced 2025-01-18 05:13:29 -05:00
Added BetterPlusReacts plugin (#110)
* Added BetterPlusReacts plugin * added betterplusreacts to the readme * Revert Count * Fix Authors --------- Co-authored-by: thororen <78185467+thororen1234@users.noreply.github.com>
This commit is contained in:
parent
a1ff675363
commit
5da4bd72a8
2 changed files with 62 additions and 0 deletions
|
@ -25,6 +25,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch
|
|||
- BetterInvites by iamme
|
||||
- BetterQuickReact by Ven & Sqaaakoi
|
||||
- BetterUserArea by Samwich
|
||||
- BetterPlusReacts by Joona
|
||||
- BlockKeywords by catcraft
|
||||
- BlockKrsip by D3SOX
|
||||
- BypassStatus by Inbestigator & thororen
|
||||
|
|
61
src/equicordplugins/betterplusreacts/index.ts
Normal file
61
src/equicordplugins/betterplusreacts/index.ts
Normal file
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2024 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
// https://github.com/Masterjoona/vc-betterplusreacts/blob/main/index.ts
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
import { findByPropsLazy } from "@webpack";
|
||||
|
||||
const { getMessages } = findByPropsLazy("getMessages");
|
||||
|
||||
export default definePlugin({
|
||||
name: "BetterPlusReacts",
|
||||
authors: [Devs.Joona],
|
||||
description: "The amount of plus before :emoji: is the message to add it to",
|
||||
patches: [
|
||||
{
|
||||
find: ".SLASH_COMMAND_USED,",
|
||||
replacement: [
|
||||
{
|
||||
match: /\\\+/,
|
||||
replace: "$&*"
|
||||
},
|
||||
{
|
||||
match: /\i.trim\(\)/,
|
||||
replace: "$&.replace(/^\\++/, '+')"
|
||||
},
|
||||
{
|
||||
match: /=(\i\.\i\.getMessages\(\i\.id\))\.last\(\)(?=.{78,85}.getByName\((\i)\.)/,
|
||||
replace: "=$self.getMsgReference()"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
find: "this.props.activeCommandOption,",
|
||||
replacement: [
|
||||
// Enable auto complete for multiple plusses
|
||||
// and set the message reference
|
||||
{
|
||||
match: /:this.props.currentWord/,
|
||||
replace: "$&.replace(/^\\++/, '+')"
|
||||
},
|
||||
{
|
||||
match: /this.props.editorRef.current\)return;/,
|
||||
replace: "$&$self.setMsgReference(this.props.currentWord.split(':')[0],this.props.channel.id);"
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
message: null,
|
||||
getMsgReference() {
|
||||
const { message } = this;
|
||||
this.message = null;
|
||||
return message;
|
||||
},
|
||||
setMsgReference(plusses: string, channelId: string) {
|
||||
this.message = getMessages(channelId).getByIndex(getMessages(channelId).length - plusses.split("+").length + 1);
|
||||
}
|
||||
});
|
Loading…
Reference in a new issue