added basic functionality to boss_warner_cmd
This commit is contained in:
parent
6adb1bebe7
commit
7b09354e95
3 changed files with 17 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
|||
const { SlashCommandBuilder } = require('discord.js');
|
||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
|
@ -13,8 +13,7 @@ module.exports = {
|
|||
option
|
||||
.setName('alert')
|
||||
.setDescription('Whether or not you want to be alerted three minutes before the boss spawns.')
|
||||
.default(false)
|
||||
.setRequired(false)),
|
||||
.setRequired(true)),
|
||||
async execute(interaction) {
|
||||
const boss_dict = {
|
||||
'Punisher': 28.3,
|
||||
|
@ -34,12 +33,19 @@ module.exports = {
|
|||
}
|
||||
if (interaction.options.getBoolean('alert') === false) {
|
||||
const spawnTimes = {};
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('Boss Warner')
|
||||
.setDescription('Time until next boss spawn:');
|
||||
for (const boss in boss_dict) {
|
||||
const timeUntilSpawn = boss_dict[boss] - (roundlength % boss_dict[boss]);
|
||||
spawnTimes[boss] = timeUntilSpawn;
|
||||
spawnTimes[boss] = Math.round(timeUntilSpawn);
|
||||
const futureDate = new Date();
|
||||
futureDate.setMinutes(futureDate.getMinutes() + timeUntilSpawn);
|
||||
const futureTimestamp = Math.floor(futureDate.getTime() / 1000);
|
||||
embed.addFields({ name: boss, value: `<t:${futureTimestamp}:t> | <t:${futureTimestamp}:R>` });
|
||||
}
|
||||
|
||||
interaction.reply(`Time until next boss spawn: ${JSON.stringify(spawnTimes)}`);
|
||||
interaction.reply({ embeds: [embed] });
|
||||
}
|
||||
},
|
||||
};
|
12
package-lock.json
generated
12
package-lock.json
generated
|
@ -466,6 +466,12 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/debug/node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/deep-is": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
|
||||
|
@ -995,12 +1001,6 @@
|
|||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/natural-compare": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
|
||||
|
|
Loading…
Reference in a new issue