updated file names

This commit is contained in:
2022-02-07 14:39:05 -06:00
parent 81ea71328a
commit 148d93aaab
4 changed files with 225 additions and 197 deletions

19
dist/index.js vendored
View File

@@ -29,31 +29,30 @@ const CLIENT = new discord_js_1.Client({ intents: [discord_js_1.Intents.FLAGS.GU
//init logs with a timestamp
console.log(new Date().toISOString() + '\n\n');
//get token
if (!fs.existsSync('./token')) {
fs.writeFileSync('./token', '');
if (!fs.existsSync('./token.txt')) {
fs.writeFileSync('./token.txt', '');
console.error('Missing Discord Token, please enter the bot token into the token file');
process.exit(1);
}
const TOKEN = fs.readFileSync('./token').toString();
const TOKEN = fs.readFileSync('./token.txt').toString();
//discord connections
CLIENT.on('ready', client => {
console.log(`Logged in as ${client.user.tag}`);
client.guilds.fetch().then(guilds => (0, discord_1.registerCommands)(TOKEN, client.user.id, guilds.map(g => g.id)));
(0, queue_1.discordInit)(client);
});
CLIENT.on('interactionCreate', async (interaction) => {
if (!interaction.isCommand())
return;
try {
if (interaction.commandName === 'queue')
await (0, queue_1.createQueue)(interaction);
await queue_1.QueueCommands.queue(interaction);
else if (interaction.commandName === 'join')
await (0, queue_1.joinQueue)(interaction);
await queue_1.QueueCommands.join(interaction);
else if (interaction.commandName === 'leave')
await (0, queue_1.leaveQueue)(interaction);
else if (interaction.commandName === 'ready')
await (0, queue_1.readyQueue)(interaction);
else if (interaction.commandName === 'cancel')
await (0, queue_1.cancelQueue)(interaction);
await queue_1.QueueCommands.leave(interaction);
else if (interaction.commandName === 'stop')
await queue_1.QueueCommands.stop(interaction);
else if (interaction.commandName === 'player')
await (0, api_1.getPlayerInteraction)(interaction);
}