mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-20 14:00:22 +02:00
Why does this even work
This commit is contained in:
@@ -35,11 +35,17 @@ module.exports = class DECTalkCommand extends Command {
|
||||
if (this.client.voiceConnections.has(channel.guild.id)) return msg.say('I am already playing a sound.');
|
||||
try {
|
||||
const connection = await channel.join();
|
||||
const { headers } = await request
|
||||
.get('http://tts.cyzon.us/tts')
|
||||
.query({ text })
|
||||
.redirects(0);
|
||||
const dispatcher = connection.play(`http://tts.cyzon.us${headers.location}`);
|
||||
let url = 'http://tts.cyzon.us';
|
||||
try {
|
||||
await request
|
||||
.get('http://tts.cyzon.us/tts')
|
||||
.query({ text })
|
||||
.redirects(0);
|
||||
} catch (err) {
|
||||
if (err.headers.location) url += err.headers.location;
|
||||
else throw err;
|
||||
}
|
||||
const dispatcher = connection.play(url);
|
||||
dispatcher.once('finish', () => channel.leave());
|
||||
dispatcher.once('error', () => channel.leave());
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user