Closed PapiSJYT closed 6 months ago
Please explain what you mean.
probably a way to open the soundboard and preview sounds without being in a voice channel you could you soundmoji experiment to do something similar
Good, I refer to the following, I attach screenshots:
That's what I mean, with the normal nitro payment if you let you use it on all servers all the audios of all servers even in normal calls in private with one person, but with vencord at the moment that is not possible, you could make that possible to use the sounds with anyone without the nitro, only having activated the option of nitro fake or otherwise another option that is only for that?
@EdVraz @Sqaaakoi
You cannot play soundboard sounds without nitro, it's impossible.
You cannot play soundboard sounds without nitro, it's impossible.
How about adding a feature to FakeNitro that sends the sound through regular voice chat?
You cannot play soundboard sounds without nitro, it's impossible.
How about adding a feature to FakeNitro that sends the sound through regular voice chat?
I am pretty sure this is what @PapiSJYT wants
yes of course, to be able to use them, either in one way or another, but to be able to use them anywhere, that option for example that you mention would be good if they can be used in any voice chat. @Sqaaakoi @EdVraz
I've come across some old code that does what the OP wants but haven't had the time to update it. If someone wants to take a stab at it -- the code is below:
file: src/userPlugins/soundboard.web.ts
/*
* Vencord, a Discord client mod
* Copyright (c) 2023 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
export default definePlugin({
name: "FakeSoundboard",
description: "Allows you to use soundboard without nitro! (Vesktop/Web only)",
authors: [Devs.ImLvna],
patches: [
{
find: "SOUNDBOARD_PLAY_SOUND.format",
replacement: [{
match: /(?<=premiumDisabled,)(\i)&&!(\i)(?=\))/,
replace: "false"
}, {
match: /(?<=onContextMenu:)\i&&!\i\?(\i):void 0/,
replace: "$1"
}]
},
{
find: "canUseCustomCallSounds:function",
replacement: {
match: /(?<=canUseCustomCallSounds:function\(\i\){return )\i\(\i,\i\)(?=\})/,
replace: "true"
}
},
{
find: "SOUNDBOARD_PLAY_SOUND.format",
replacement: {
match: /null==\i\?\i\|\|(\i\(\i\)):\i\(\)/,
replace: "$1"
}
},
{
find: ".showVoiceChannelCoachmark",
replacement: {
match: /(?<=\i\.\i\))\(\i,(\i),__OVERLAY__,\i\)/,
replace: ";$self.playSound(`https://cdn.discordapp.com/soundboard-sounds/${$1.soundId}`)"
}
},
{
// Pass microphone stream to RNNoise
find: "window.webkitAudioContext",
replacement: {
match: /(?<=\i\.acquire=function\((\i)\)\{return )navigator\.mediaDevices\.getUserMedia\(\1\)(?=\})/,
replace: "$&.then(stream => $self.connectSoundboard(stream, $1.audio))"
},
},
{
find: "window.webkitAudioContext",
replacement: {
match: /(?<=connectRnnoise\(stream, (\i)\.audio\)\))(?=\})/,
replace: "$&.then(stream => $self.connectSoundboard(stream, $1.audio))"
},
}
],
audioDestination: null as null | MediaStreamAudioDestinationNode,
audioCtx: null as null | AudioContext,
async playSound(url: string) {
if (!this.audioCtx || !this.audioDestination) return;
const res = await fetch(url);
const buffer = await res.arrayBuffer();
const audioBuffer = await this.audioCtx.decodeAudioData(buffer);
const source = this.audioCtx.createBufferSource();
source.buffer = audioBuffer;
source.connect(this.audioDestination!);
source.start(0, 0, 20); // 20 seconds max
},
async connectSoundboard(stream: MediaStream, isAudio: boolean): Promise<MediaStream> {
if (!isAudio) return stream;
console.log("connectSoundboard", stream);
this.audioCtx = new AudioContext();
const source = this.audioCtx.createMediaStreamSource(stream);
this.audioDestination = this.audioCtx.createMediaStreamDestination();
source.connect(this.audioDestination);
const _audioCtx = this.audioCtx;
// Cleanup
const onEnded = () => {
source.disconnect();
_audioCtx.close();
};
stream.addEventListener("inactive", onEnded, { once: true });
return this.audioDestination.stream;
},
});
And how can I add it to the discord? anyone help me? @athaller
I've come across some old code that does what the OP wants but haven't had the time to update it. If someone wants to take a stab at it -- the code is below:
file: src/userPlugins/soundboard.web.ts /* * Vencord, a Discord client mod * Copyright (c) 2023 Vendicated and contributors * SPDX-License-Identifier: GPL-3.0-or-later */ import { Devs } from "@utils/constants"; import definePlugin from "@utils/types"; export default definePlugin({ name: "FakeSoundboard", description: "Allows you to use soundboard without nitro! (Vesktop/Web only)", authors: [Devs.ImLvna], patches: [ { find: "SOUNDBOARD_PLAY_SOUND.format", replacement: [{ match: /(?<=premiumDisabled,)(\i)&&!(\i)(?=\))/, replace: "false" }, { match: /(?<=onContextMenu:)\i&&!\i\?(\i):void 0/, replace: "$1" }] }, { find: "canUseCustomCallSounds:function", replacement: { match: /(?<=canUseCustomCallSounds:function\(\i\){return )\i\(\i,\i\)(?=\})/, replace: "true" } }, { find: "SOUNDBOARD_PLAY_SOUND.format", replacement: { match: /null==\i\?\i\|\|(\i\(\i\)):\i\(\)/, replace: "$1" } }, { find: ".showVoiceChannelCoachmark", replacement: { match: /(?<=\i\.\i\))\(\i,(\i),__OVERLAY__,\i\)/, replace: ";$self.playSound(`https://cdn.discordapp.com/soundboard-sounds/${$1.soundId}`)" } }, { // Pass microphone stream to RNNoise find: "window.webkitAudioContext", replacement: { match: /(?<=\i\.acquire=function\((\i)\)\{return )navigator\.mediaDevices\.getUserMedia\(\1\)(?=\})/, replace: "$&.then(stream => $self.connectSoundboard(stream, $1.audio))" }, }, { find: "window.webkitAudioContext", replacement: { match: /(?<=connectRnnoise\(stream, (\i)\.audio\)\))(?=\})/, replace: "$&.then(stream => $self.connectSoundboard(stream, $1.audio))" }, } ], audioDestination: null as null | MediaStreamAudioDestinationNode, audioCtx: null as null | AudioContext, async playSound(url: string) { if (!this.audioCtx || !this.audioDestination) return; const res = await fetch(url); const buffer = await res.arrayBuffer(); const audioBuffer = await this.audioCtx.decodeAudioData(buffer); const source = this.audioCtx.createBufferSource(); source.buffer = audioBuffer; source.connect(this.audioDestination!); source.start(0, 0, 20); // 20 seconds max }, async connectSoundboard(stream: MediaStream, isAudio: boolean): Promise<MediaStream> { if (!isAudio) return stream; console.log("connectSoundboard", stream); this.audioCtx = new AudioContext(); const source = this.audioCtx.createMediaStreamSource(stream); this.audioDestination = this.audioCtx.createMediaStreamDestination(); source.connect(this.audioDestination); const _audioCtx = this.audioCtx; // Cleanup const onEnded = () => { source.disconnect(); _audioCtx.close(); }; stream.addEventListener("inactive", onEnded, { once: true }); return this.audioDestination.stream; }, });
fyi this will likely never be included in Vencord as many users are annoying children that wou!d abuse this to the point they would earn a server mute wherever they used it
I've come across some old code that does what the OP wants but haven't had the time to update it. If someone wants to take a stab at it -- the code is below:
file: src/userPlugins/soundboard.web.ts /* * Vencord, a Discord client mod * Copyright (c) 2023 Vendicated and contributors * SPDX-License-Identifier: GPL-3.0-or-later */ import { Devs } from "@utils/constants"; import definePlugin from "@utils/types"; export default definePlugin({ name: "FakeSoundboard", description: "Allows you to use soundboard without nitro! (Vesktop/Web only)", authors: [Devs.ImLvna], patches: [ { find: "SOUNDBOARD_PLAY_SOUND.format", replacement: [{ match: /(?<=premiumDisabled,)(\i)&&!(\i)(?=\))/, replace: "false" }, { match: /(?<=onContextMenu:)\i&&!\i\?(\i):void 0/, replace: "$1" }] }, { find: "canUseCustomCallSounds:function", replacement: { match: /(?<=canUseCustomCallSounds:function\(\i\){return )\i\(\i,\i\)(?=\})/, replace: "true" } }, { find: "SOUNDBOARD_PLAY_SOUND.format", replacement: { match: /null==\i\?\i\|\|(\i\(\i\)):\i\(\)/, replace: "$1" } }, { find: ".showVoiceChannelCoachmark", replacement: { match: /(?<=\i\.\i\))\(\i,(\i),__OVERLAY__,\i\)/, replace: ";$self.playSound(`https://cdn.discordapp.com/soundboard-sounds/${$1.soundId}`)" } }, { // Pass microphone stream to RNNoise find: "window.webkitAudioContext", replacement: { match: /(?<=\i\.acquire=function\((\i)\)\{return )navigator\.mediaDevices\.getUserMedia\(\1\)(?=\})/, replace: "$&.then(stream => $self.connectSoundboard(stream, $1.audio))" }, }, { find: "window.webkitAudioContext", replacement: { match: /(?<=connectRnnoise\(stream, (\i)\.audio\)\))(?=\})/, replace: "$&.then(stream => $self.connectSoundboard(stream, $1.audio))" }, } ], audioDestination: null as null | MediaStreamAudioDestinationNode, audioCtx: null as null | AudioContext, async playSound(url: string) { if (!this.audioCtx || !this.audioDestination) return; const res = await fetch(url); const buffer = await res.arrayBuffer(); const audioBuffer = await this.audioCtx.decodeAudioData(buffer); const source = this.audioCtx.createBufferSource(); source.buffer = audioBuffer; source.connect(this.audioDestination!); source.start(0, 0, 20); // 20 seconds max }, async connectSoundboard(stream: MediaStream, isAudio: boolean): Promise<MediaStream> { if (!isAudio) return stream; console.log("connectSoundboard", stream); this.audioCtx = new AudioContext(); const source = this.audioCtx.createMediaStreamSource(stream); this.audioDestination = this.audioCtx.createMediaStreamDestination(); source.connect(this.audioDestination); const _audioCtx = this.audioCtx; // Cleanup const onEnded = () => { source.disconnect(); _audioCtx.close(); }; stream.addEventListener("inactive", onEnded, { once: true }); return this.audioDestination.stream; }, });
fyi this will likely never be included in Vencord as many users are annoying children that wou!d abuse this to the point they would earn a server mute wherever they used it
Yeah, I've had to ban people for stupid abuse stuff like this (hence why there's server rules and mods to warn and enforce them). It's nothing new but features are features and while it is annoying, there's no stopping users from using voicemod or some other program to basically do the same thing. This is just allowing this within vencord directly so imho it'd seem really silly to reject it for that specific reason and I would word it differently if the project doesn't want to officially support it. But in that case the user would need to build vencord and add it manually which may make users want to look at another alternative client and hurt your userbase. I myself am from betterdiscord originally and looking for something simple and less clunkier (new to vencord for less than a week) and reading some of these comments honestly has me considering other options again...
TLDR; at the end of the day people may want this feature and it can be done. Will some people probably abuse it and annoy users, most likely but hey, we cant control what others do..
If there's a will, there's a way!
And how can I add it to the discord? anyone help me? @athaller
As of right now the code needs to be updated. I did a quick glance and I think this uses an older discord experiment to either add an overlay or classname to the DOM. Unfortunately I don't believe this experiment is still available, so I'll need to dig through the DOM/react components to relocate where this needs to be updated. This is low on my personal priority list but wanted to get traction on this thread as I myself was looking for this feature and came across your thread with some false information saying this cannot be done right after I located the above code
If you'd like to take a stab at it, you'd need to build and compile a custom plugin with vencord. Documentation on how to do this can be found in the repo here: https://github.com/Vendicated/Vencord/blob/main/docs/2_PLUGINS.md
Thanks, the truth is that I see a bad excuse for not adding it to vencord, because each server already has its bots for protection apart from their mods for the same but well, someone would help me to update it and know how to add it to my vencord please? because I do not have much idea about it, thanks in advance!
Thanks, the truth is that I see a bad excuse for not adding it to vencord, because each server already has its bots for protection apart from their mods for the same but well, someone would help me to update it and know how to add it to my vencord please? because I do not have much idea about it, thanks in advance!
Papi -- the above didn't really add any value to this ticket and was more of a whine (I've added a link to the plugin documentation page)... As previously mentioned, the code needs to be updated. This is going to take time in debugging and figuring out what needs to be changed in order to get this working. Can it be done? Yes. Is it something simple that I can just tell you what to change? No..
Please be patient if you're unaware of how to debug/write code yourself. Be aware though, you're at the mercy of my time or someone else's time to get this working as we do this in our free time (this isn't our full time jobs). If you're expectation is I'm working on this today, then I'm sorry to inform you that I will not be. I've mentioned this is very low on my personal priorities so if this is something you want within a week or two, you may want to start looking at how to write code yourself using the plugin documentation link in the prior message
Plugin Description
sound panel with the sounds of all the servers we belong to
Existing Plugin for other mod
No response
Request Agreement