|
|
@ -72,14 +72,15 @@ class samvcCommand extends Command {
|
|
|
|
'Content-Type': 'audio/mpeg',
|
|
|
|
'Content-Type': 'audio/mpeg',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}).then(async (result) => {
|
|
|
|
}).then(async (result) => {
|
|
|
|
const outputFilename = './samvc.mp3';
|
|
|
|
const outputFilename = './samvc.wav';
|
|
|
|
|
|
|
|
|
|
|
|
fs.writeFile(outputFilename, result.data, async function(err) {
|
|
|
|
fs.writeFile(outputFilename, result.data, async function(err) {
|
|
|
|
if (err) console.error(err);
|
|
|
|
if (err) console.error(err);
|
|
|
|
const voiceChannel = message.member.voice.channel;
|
|
|
|
const voiceChannel = message.member.voice.channel;
|
|
|
|
if (!voiceChannel) return message.say('Please enter a voice channel first.');
|
|
|
|
if (!voiceChannel) return message.say('Please enter a voice channel first.');
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const connection = await voiceChannel.join();
|
|
|
|
const connection = await voiceChannel.join();
|
|
|
|
const dispatcher = connection.play('./dectalkvc.wav');
|
|
|
|
const dispatcher = connection.play('./samvc.wav');
|
|
|
|
dispatcher.once('finish', () => voiceChannel.leave());
|
|
|
|
dispatcher.once('finish', () => voiceChannel.leave());
|
|
|
|
dispatcher.once('error', () => voiceChannel.leave());
|
|
|
|
dispatcher.once('error', () => voiceChannel.leave());
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|