diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2022-03-30 16:34:24 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2022-03-30 16:34:24 -0400 |
| commit | 3f81f1086f46b8e1882ed0827483a22929330be3 (patch) | |
| tree | 4bda5790eb359f53d4e5671225f38e18a1ce56b9 /bot.js | |
| parent | fd89e36490da711ba611c1f7c8dda93a3de054f0 (diff) | |
| download | DLAP-3f81f1086f46b8e1882ed0827483a22929330be3.tar.gz DLAP-3f81f1086f46b8e1882ed0827483a22929330be3.tar.bz2 DLAP-3f81f1086f46b8e1882ed0827483a22929330be3.zip | |
Renamed project; Auto creates music folder when not detected; Removed audio limitation
Diffstat (limited to 'bot.js')
| -rw-r--r-- | bot.js | 25 |
1 files changed, 17 insertions, 8 deletions
@@ -1,6 +1,6 @@ /************************************************************************** * - * DLMP3 Bot: A Discord bot that plays local MP3 audio tracks. + * DLMP3 Bot: A Discord bot that plays local audio tracks. * (C) Copyright 2022 * Programmed by Andrew Lee * @@ -18,18 +18,27 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. * ***************************************************************************/ -import { Client, MessageEmbed, Collection, version } from "discord.js" -import { voiceInit } from "./AudioBackend.js" -import fs from "fs" -import config from './config.json' assert {type: 'json'} +import { Client, MessageEmbed, Collection, version } from 'discord.js' +import { voiceInit } from './AudioBackend.js' +import fs from 'fs' +import config from './config.json' assert { type: 'json' } +import path from 'path' export const bot = new Client({intents: ['GUILDS', 'GUILD_MESSAGES', 'GUILD_VOICE_STATES']}); - -bot.login(config.token); +const dir = './music'; + +if (fs.existsSync(dir)) { + console.log('Music folder detected'); + bot.login(config.token); +} else { + console.log('Directory not found. Creating music folder...'); + console.log('Insert your beats to that folder.'); + fs.mkdirSync(dir); + process.exit(0); +} /** * Project Ideas: - * Play directly the MP3 file * New queue system * List MP3 files * Shuffle or "Play by order" mode |
