mirror of
https://github.com/RobinRMC/VencordPlus.git
synced 2025-05-10 17:35:39 +02:00
Add ForwardAnywhere
This commit is contained in:
parent
bebbe404e0
commit
a759eff956
1 changed files with 39 additions and 0 deletions
39
src/plusplugins/forwardAnywhere/index.ts
Normal file
39
src/plusplugins/forwardAnywhere/index.ts
Normal 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: "Sends a forwarded message as a normal message if it's not possible to forward the message. Also allows messages from channels marked as NSFW to be forwarded to channels not marked as NSFW",
|
||||
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}>`
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue