46 lines
1.7 KiB
JavaScript
46 lines
1.7 KiB
JavaScript
|
const { SlashCommandBuilder } = require('discord.js');
|
||
|
|
||
|
module.exports = {
|
||
|
data: new SlashCommandBuilder()
|
||
|
.setName('bosswarner')
|
||
|
.setDescription('Checks how long until the next boss spawn.')
|
||
|
.addNumberOption(option =>
|
||
|
option
|
||
|
.setName('roundlength')
|
||
|
.setDescription('Current round length. Get this by using /roundlength in-game.')
|
||
|
.setRequired(true))
|
||
|
.addBooleanOption(option =>
|
||
|
option
|
||
|
.setName('alert')
|
||
|
.setDescription('Whether or not you want to be alerted three minutes before the boss spawns.')
|
||
|
.default(false)
|
||
|
.setRequired(false)),
|
||
|
async execute(interaction) {
|
||
|
const boss_dict = {
|
||
|
'Punisher': 28.3,
|
||
|
'X-0': 60,
|
||
|
'Decimator': 60,
|
||
|
'Galleon': 70,
|
||
|
'Kodiak': 120,
|
||
|
};
|
||
|
const roundlength = interaction.options.getNumber('roundlength');
|
||
|
if (interaction.options.getNumber('roundlength') < 0) {
|
||
|
interaction.reply('Round length cannot be negative.');
|
||
|
return;
|
||
|
}
|
||
|
if (interaction.options.getBoolean('alert') === true) {
|
||
|
interaction.reply('Alerts are not yet implemented.');
|
||
|
return;
|
||
|
}
|
||
|
if (interaction.options.getBoolean('alert') === false) {
|
||
|
const spawnTimes = {};
|
||
|
for (const boss in boss_dict) {
|
||
|
const timeUntilSpawn = boss_dict[boss] - (roundlength % boss_dict[boss]);
|
||
|
spawnTimes[boss] = timeUntilSpawn;
|
||
|
}
|
||
|
|
||
|
interaction.reply(`Time until next boss spawn: ${JSON.stringify(spawnTimes)}`);
|
||
|
}
|
||
|
},
|
||
|
};
|