aboutsummaryrefslogtreecommitdiff
path: root/AudioBackend.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2022-03-28 19:53:00 -0400
committerAndrew Lee <alee14498@protonmail.com>2022-03-28 19:53:00 -0400
commit08aae8cd9e5417bd7451b9af2e3190bf9c6a4e43 (patch)
tree965f234d6683b726bddc07ce19914e84b335cd44 /AudioBackend.js
parent0f5a1a252964861e149a0d784a90f0ad74aa09cb (diff)
downloadDLAP-08aae8cd9e5417bd7451b9af2e3190bf9c6a4e43.tar.gz
DLAP-08aae8cd9e5417bd7451b9af2e3190bf9c6a4e43.tar.bz2
DLAP-08aae8cd9e5417bd7451b9af2e3190bf9c6a4e43.zip
Removed old cmd handler; Brought back join; New cmd
Diffstat (limited to 'AudioBackend.js')
-rw-r--r--AudioBackend.js30
1 files changed, 18 insertions, 12 deletions
diff --git a/AudioBackend.js b/AudioBackend.js
index 070e717..c53c57e 100644
--- a/AudioBackend.js
+++ b/AudioBackend.js
@@ -34,7 +34,6 @@ export const player = createAudioPlayer();
export let audio;
let fileData;
-
export function voiceInit(bot) {
bot.channels.fetch(config.voiceChannel).then(channel => {
const connection = joinVoiceChannel({
@@ -64,7 +63,7 @@ export function voiceInit(bot) {
export function playAudio(bot) {
let files = fs.readdirSync('music');
- // Eventually this system will need a rework so it won't repeat the same files.
+ //TODO: Eventually this system will need a rework so it won't repeat the same files.
while (true) {
audio = files[Math.floor(Math.random() * files.length)];
@@ -79,11 +78,14 @@ export function playAudio(bot) {
player.play(resource);
console.log('Now playing: ' + audio);
- fileData = "Now Playing: " + audio;
- fs.writeFile("./now-playing.txt", fileData, (err) => {
- if (err)
- console.log(err);
- });
+
+ if (config.txtFile === true) {
+ fileData = "Now Playing: " + audio;
+ fs.writeFile("./now-playing.txt", fileData, (err) => {
+ if (err)
+ console.log(err);
+ });
+ }
const statusEmbed = new MessageEmbed()
.addField('Now Playing', `${audio}`)
@@ -96,11 +98,15 @@ export function playAudio(bot) {
}
export function destroyAudio(interaction) {
- fileData = "Now Playing: Nothing";
- fs.writeFile("now-playing.txt", fileData, (err) => {
- if (err)
- console.log(err);
- });
+
+ if (config.txtFile === true) {
+ 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);