diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2022-12-20 17:54:56 -0500 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2022-12-20 18:05:51 -0500 |
| commit | e5c86859e4c6a9a6829bcc2e3cf626b05a873ff7 (patch) | |
| tree | 96c04baa3f064a160a595a0faf73696cc5cf8eaa /AudioBackend | |
| parent | 239b254760381946f57d6cbccb077f5341ca2f30 (diff) | |
| download | DLAP-e5c86859e4c6a9a6829bcc2e3cf626b05a873ff7.tar.gz DLAP-e5c86859e4c6a9a6829bcc2e3cf626b05a873ff7.tar.bz2 DLAP-e5c86859e4c6a9a6829bcc2e3cf626b05a873ff7.zip | |
Revamped next/previous cmds (Voting system); Basic i18n support;
Diffstat (limited to 'AudioBackend')
| -rw-r--r-- | AudioBackend/AudioControl.js | 2 | ||||
| -rw-r--r-- | AudioBackend/PlayAudio.js | 14 | ||||
| -rw-r--r-- | AudioBackend/VoiceInitialization.js | 2 |
3 files changed, 10 insertions, 8 deletions
diff --git a/AudioBackend/AudioControl.js b/AudioBackend/AudioControl.js index 447e040..3a9c7a5 100644 --- a/AudioBackend/AudioControl.js +++ b/AudioBackend/AudioControl.js @@ -55,7 +55,7 @@ export async function previousAudio(bot, interaction) { if (currentTrack <= 0) { return await interaction.reply({ content: 'You are at the beginning of the playlist, cannot go further than this', ephemeral: true }); } else { - await interaction.reply({ content: 'Playing previous music', ephemeral: true }); + await interaction.reply({ content: 'Playing previous music' }); player.stop(); updatePlaylist('back'); return await playAudio(bot); diff --git a/AudioBackend/PlayAudio.js b/AudioBackend/PlayAudio.js index 5d18534..e8a0f3a 100644 --- a/AudioBackend/PlayAudio.js +++ b/AudioBackend/PlayAudio.js @@ -45,7 +45,7 @@ export async function playAudio(bot) { const resource = createAudioResource('music/' + audio); player.play(resource); - console.log('Now playing: ' + audio); + console.log(`Now playing: ${audio}`); audioState(0); @@ -70,7 +70,7 @@ export async function playAudio(bot) { audio = audio.split('.').slice(0, -1).join('.'); if (txtFile) { - fileData = 'Now Playing: ' + audio; + fileData = `Now Playing: ${audio}`; writeFile('./now-playing.txt', fileData, (err) => { if (err) { console.log(err); } }); @@ -80,17 +80,17 @@ export async function playAudio(bot) { if (metadataEmpty) { statusEmbed.setTitle('Now Playing'); statusEmbed.addFields( - { name: 'Title', value: audio }, - { name: 'Duration', value: duration } + { name: 'Title', value: `${audio}` }, + { name: 'Duration', value: `${duration}` } ); statusEmbed.setColor('#0066ff'); } else { statusEmbed.setTitle('Now Playing'); statusEmbed.addFields( - { name: 'Title', value: audioTitle, inline: true }, - { name: 'Artist', value: audioArtist, inline: true }, + { name: 'Title', value: `${audioTitle}`, inline: true }, + { name: 'Artist', value: `${audioArtist}`, inline: true }, { name: 'Year', value: `${audioYear}` }, - { name: 'Duration', value: duration } + { name: 'Duration', value: `${duration}` } ); statusEmbed.setFooter({ text: `Album: ${audioAlbum}\nFilename: ${audioFile}` }); statusEmbed.setColor('#0066ff'); diff --git a/AudioBackend/VoiceInitialization.js b/AudioBackend/VoiceInitialization.js index a9e1149..ae1241b 100644 --- a/AudioBackend/VoiceInitialization.js +++ b/AudioBackend/VoiceInitialization.js @@ -22,6 +22,7 @@ import { readFileSync } from 'node:fs'; import { createAudioPlayer, joinVoiceChannel, VoiceConnectionStatus } from '@discordjs/voice'; import { nextAudio } from './AudioControl.js'; import { shufflePlaylist, orderPlaylist } from './QueueSystem.js'; +import { votes } from '../Utilities/Voting.js'; const { voiceChannel, shuffle } = JSON.parse(readFileSync('./config.json', 'utf-8')); export const player = createAudioPlayer(); @@ -53,6 +54,7 @@ export async function voiceInit(bot) { player.on('idle', () => { console.log('Beat has finished playing, now playing next beat...'); + votes.clear(); nextAudio(bot); }); |
