diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2024-02-17 00:07:31 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-17 00:07:31 -0500 |
| commit | 214a83c0f696ac731c54b00bf7503f87e497afa6 (patch) | |
| tree | 15d57b08e69d19fb4c2f3effb9937aec8d042bdc /AudioBackend/VoiceInitialization.js | |
| parent | b29ab06623fd24cfc2a611bdd658b4d2ef934335 (diff) | |
| parent | c848f1d90fef40ffa81915d7dd875a2ee6d6c8d5 (diff) | |
| download | DLAP-214a83c0f696ac731c54b00bf7503f87e497afa6.tar.gz DLAP-214a83c0f696ac731c54b00bf7503f87e497afa6.tar.bz2 DLAP-214a83c0f696ac731c54b00bf7503f87e497afa6.zip | |
Merge pull request #17 from Alee14/testing
Merging testing branch
Diffstat (limited to 'AudioBackend/VoiceInitialization.js')
| -rw-r--r-- | AudioBackend/VoiceInitialization.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/AudioBackend/VoiceInitialization.js b/AudioBackend/VoiceInitialization.js index ae1241b..0088fbd 100644 --- a/AudioBackend/VoiceInitialization.js +++ b/AudioBackend/VoiceInitialization.js @@ -19,13 +19,15 @@ * ***************************************************************************/ import { readFileSync } from 'node:fs'; -import { createAudioPlayer, joinVoiceChannel, VoiceConnectionStatus } from '@discordjs/voice'; +import { createAudioPlayer, joinVoiceChannel, VoiceConnectionStatus, AudioPlayerStatus } from '@discordjs/voice'; import { nextAudio } from './AudioControl.js'; import { shufflePlaylist, orderPlaylist } from './QueueSystem.js'; import { votes } from '../Utilities/Voting.js'; +import i18next from '../Utilities/i18n.js'; const { voiceChannel, shuffle } = JSON.parse(readFileSync('./config.json', 'utf-8')); export const player = createAudioPlayer(); +const t = i18next.t; export async function voiceInit(bot) { bot.channels.fetch(voiceChannel).then(async channel => { const connection = joinVoiceChannel({ @@ -35,16 +37,16 @@ export async function voiceInit(bot) { }); connection.on(VoiceConnectionStatus.Connecting, () => { - console.log(`Connecting to ${channel.name}...`); + console.log(t('voiceConnecting', { channel: channel.name })); }); connection.on(VoiceConnectionStatus.Ready, async() => { - console.log('Ready to blast some beats!'); + console.log(t('voiceReady')); return (shuffle) ? await shufflePlaylist(bot) : await orderPlaylist(bot); }); connection.on(VoiceConnectionStatus.Destroyed, () => { - console.log('Destroyed the beats...'); + console.log(t('voiceDestroyed')); }); player.on('error', error => { @@ -52,8 +54,8 @@ export async function voiceInit(bot) { nextAudio(bot); }); - player.on('idle', () => { - console.log('Beat has finished playing, now playing next beat...'); + player.on(AudioPlayerStatus.Idle, () => { + console.log(t('musicsFinished')); votes.clear(); nextAudio(bot); }); |
