Add ForwardAnywhere
Some checks are pending
Test / Test (push) Waiting to run

This commit is contained in:
thororen1234 2025-04-29 05:05:03 -04:00
parent 5db0cea8c3
commit 493afb254c
No known key found for this signature in database
4 changed files with 72 additions and 165 deletions

View file

@ -0,0 +1,39 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2025 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { EquicordDevs } from "@utils/constants";
import { sendMessage } from "@utils/discord";
import definePlugin from "@utils/types";
import { Message } from "discord-types/general";
export default definePlugin({
name: "ForwardAnywhere",
description: "If a forward fails send it as a normal message also allows nsfw forwards",
authors: [EquicordDevs.thororen],
patches: [
{
find: "#{intl::MESSAGE_FORWARDING_NSFW_NOT_ALLOWED}",
replacement: {
match: /if\((\i)\.isNSFW\(\)&&.{0,25}\)\)\)/,
replace: "if(false)",
}
},
{
find: "#{intl::MESSAGE_ACTION_FORWARD_TO}",
replacement: {
match: /(?<=let (\i)=.{0,25}rejected.{0,25}\);)(?=.{0,25}message:(\i))/,
replace: "if ($1) return $self.sendForward($1,$2);",
}
},
],
sendForward(channels: any, message: Message) {
for (const c of channels) {
sendMessage(c.id, {
content: `${message.content}\n\n> Forwarded from <#${message.channel_id}>`
});
}
}
});