diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2022-03-28 16:05:12 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2022-03-28 16:05:12 -0400 |
| commit | 95870931e77a26a8d50ff3630bf387c923e61a2d (patch) | |
| tree | cd3bfc550d8bc4af53451eebb480e51897a58771 /AudioBackend.js | |
| parent | 1a99bec57db0fe7dddddaf833ec9c8300470ad1d (diff) | |
| download | DLAP-95870931e77a26a8d50ff3630bf387c923e61a2d.tar.gz DLAP-95870931e77a26a8d50ff3630bf387c923e61a2d.tar.bz2 DLAP-95870931e77a26a8d50ff3630bf387c923e61a2d.zip | |
Fixed the leave button
Diffstat (limited to 'AudioBackend.js')
| -rw-r--r-- | AudioBackend.js | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/AudioBackend.js b/AudioBackend.js index dbc239a..070e717 100644 --- a/AudioBackend.js +++ b/AudioBackend.js @@ -19,7 +19,13 @@ * ***************************************************************************/ -import { createAudioPlayer, createAudioResource, joinVoiceChannel, VoiceConnectionStatus } from '@discordjs/voice' +import { + createAudioPlayer, + createAudioResource, + getVoiceConnection, + joinVoiceChannel, + VoiceConnectionStatus +} from '@discordjs/voice' import { MessageEmbed } from 'discord.js' import config from './config.json' assert {type: 'json'} import fs from 'fs' @@ -87,4 +93,16 @@ export function playAudio(bot) { if (!statusChannel) return console.error('The status channel does not exist! Skipping.'); statusChannel.send({embeds: [statusEmbed]}); +} + +export function destroyAudio(interaction) { + fileData = "Now Playing: Nothing"; + fs.writeFile("now-playing.txt", fileData, (err) => { + if (err) + console.log(err); + }); + audio = "Not Playing"; + player.stop(); + const connection = getVoiceConnection(interaction.guild.id); + connection.destroy(); }
\ No newline at end of file |
