This commit is contained in:
Daniel Odendahl Jr
2017-10-16 13:59:18 +00:00
parent 052884bbd2
commit 036812f0fb
+9 -2
View File
@@ -1,5 +1,9 @@
const { Command } = require('discord.js-commando');
const snekfetch = require('snekfetch');
const { Readable } = require('stream');
// const path = require('path');
// const { promisifyAll } = require('tsubaki');
// const fs = promisifyAll(require('fs'));
module.exports = class DECTalkCommand extends Command {
constructor(client) {
@@ -38,10 +42,13 @@ 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 body = snekfetch
const { body } = await snekfetch
.get('http://tts.cyzon.us/tts')
.query({ text });
const dispatcher = connection.playStream(body);
const stream = new Readable();
stream.read = function () {};
stream.push(body);
const dispatcher = connection.playStream(stream);
dispatcher.once('end', () => channel.leave());
dispatcher.once('error', () => channel.leave());
return null;