-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbatter_savant.js
30 lines (29 loc) · 1.35 KB
/
batter_savant.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const interactionHandlers = require('../modules/interaction-handlers.js');
const { SlashCommandBuilder } = require('@discordjs/builders');
module.exports = {
data: new SlashCommandBuilder()
.setName('batter_savant')
.setDescription('View the savant metrics for a specified player, or whoever is up to bat right now.')
.addStringOption(option =>
option.setName('player')
.setDescription('An active player\'s name.')
.setRequired(false))
.addIntegerOption(option =>
option.setName('year')
.setDescription('Which season?')
.setRequired(false)
.setMinValue(new Date().getFullYear() - 10)
.setMaxValue(new Date().getFullYear())),
async execute (interaction) {
try {
await interactionHandlers.batterSavantHandler(interaction);
} catch (e) {
console.error(e);
if (interaction.deferred && !interaction.replied) {
await interaction.followUp('There was an error processing this command. If it persists, please reach out to the developer.');
} else if (!interaction.replied) {
await interaction.reply('There was an error processing this command. If it persists, please reach out to the developer.');
}
}
}
};