mundoex / discord-tts Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Well, when I input a message and is more than 200, this gets error
(node:48320) UnhandledPromiseRejectionWarning: RangeError: text length (361) should be less than 200 characters
I know that this error is for the google-tts api, but, could be a way that can I fix it?
If you get the V13 example and runs it works well, but if you change the string with a single word (E.G. hi, test, hello), the tts does work
I'm trying to trigger a finish event with dispatcher for 2 hours. There is no another way. Please fix it.
I have seen problem like this in issue before, but now 'end' event is not supported by current version of discord.js. Yet 'finish' event, do not triggers at the end of the stream. What can i do to fix it or how can I run smth after the broadcast ends.
const broadcast = client.voice.createBroadcast();
const channelId = message.member.voice.channelID;
const channel = client.channels.cache.get(channelId);
channel?.join().then(async (connection) => {
const stream = discordTTS.getVoiceStream(string, 'ru-RU')
broadcast.play(stream);
const dispatcher = await connection.play(broadcast)
dispatcher.on('finish', () => console.log('That is the end'))
})
I saw that the library is currently limited to 200 chars
How do I play messages which are greater tha 200 chars(reaching all the way up to 5000 chars)
The error currently shows to use getAllAudioBase64(text,[option])
But that function is apparently not implemented?
I am using [email protected] and this issue shows up is there a fix to this issue ? if yes please help
when I try using it as in your example I get this error
When too many requests are made, the client crashes with this error
Hello Guys, I'm trying to do something simple, I just wanna play a "long" audio, so I'm spliting the text in an array. But I'm facing this issue, I dunno why.
I can hear the first "test 1", but not the others.
It's just a simple test, as you can see:
const { SlashCommandBuilder } = require('discord.js');
const discordTTS = require('discord-tts');
const { AudioPlayer, AudioPlayerStatus, createAudioResource, StreamType, entersState, VoiceConnectionStatus, joinVoiceChannel, getVoiceConnection } = require('@discordjs/voice');
let voiceConnection;
const audioPlayer = new AudioPlayer();
const texts = ['test 1', 'test 2', 'test 3', 'test 4'];
module.exports = {
data: new SlashCommandBuilder()
.setName('tts2')
.setDescription('Responde com o Chat GPT apartir da voz.'),
async execute(interaction) {
await interaction.deferReply();
const voiceChannel = interaction.member?.voice.channel;
const audioStreams = texts.map((text) => {
return discordTTS.getVoiceStream(text);
});
function playNextResource() {
if (audioStreams.length > 0) {
voiceConnection.subscribe(audioPlayer);
const audioResource = createAudioResource(audioStreams.shift(), { inputType: StreamType.Arbitrary, inlineVolume: true });
return audioPlayer.play(audioResource);
}
const connection = getVoiceConnection(voiceChannel.guild.id);
connection.destroy();
}
if (!voiceConnection || voiceConnection?.status === VoiceConnectionStatus.Disconnected) {
voiceConnection = joinVoiceChannel({
channelId: voiceChannel.id,
guildId: voiceChannel.guild.id,
adapterCreator: voiceChannel.guild.voiceAdapterCreator,
});
voiceConnection = await entersState(voiceConnection, VoiceConnectionStatus.Connecting, 5_000);
}
audioPlayer.on(AudioPlayerStatus.Idle, playNextResource());
},
};
TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received undefined
at checkListener (node:events:274:3)
at _addListener (node:events:547:3)
at AudioPlayer.addListener (node:events:606:10)
at Object.execute (C:\Users*\commands\utility\tts.js:73:21)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.execute (C:*\events\interactionCreate.js:16:13) {
code: 'ERR_INVALID_ARG_TYPE'
}
When using getVoiceStream no TTS is said and then the bot leaves on the finish event from the dispatcher.
async function speakHello(connection,wasConnected, voiceChannel, text){
const dispatcher = connection.play(discordTTS.getVoiceStream(text, "de-DE"))
dispatcher.setVolumeDecibels(10)
dispatcher.on("finish", () => {
if (!wasConnected) {
voiceChannel.leave()
}
})
.on("error", err => console.error(err));
}
Hey is there a way to make the client leave the voice channel after it's done?
Using this code to play via discord tts:
startPlaying(discordTTS.getVoiceStream(`Now playing: ${yt_info[0].title}`), player)
function startPlaying(url, player, type) {
const resource = createAudioResource(url, {
inputType: type ?? StreamType.Arbitrary,
});
player.play(resource);
}
And it works, but the audio gets cut off before it is done saying what I inputted. This does not happen with regular audio. Any ideas? Using nodejs v16.10, discordjs v13, latest version of discord-tts
It always gets cutoff at ~5s to the end, and its not the variable because the same thing happens when I put plaintext in.
I'm using it on a Discord bot since last month and it was working just fine but since yesterday the tts module doesn't play any sound.
is there Option to change voice gender and cooldown between words?
Says the problem is google-tts-api, but I couldn't figure out how to fix it. Tried updating the packages but nothing happened.
I have installed all the packages, and when executing the command it gives this error:
FFmpeg/avconv not found!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.