gwei-alert-bot/src/commands/gas.ts

37 lines
1.1 KiB
TypeScript

import { SlashCommandBuilder, ChatInputCommandInteraction } from 'discord.js';
import { handleGasAlertCommand, handleGasCommand, handleGasPendingCommand } from '../handlers';
module.exports = {
data: new SlashCommandBuilder()
.setName('gas')
.setDescription('Set alerts for GWEI')
.addSubcommand(subcommand =>
subcommand
.setName('pending')
.setDescription('List your current alert threshhold'))
.addSubcommand(subcommand =>
subcommand
.setName('alert')
.setDescription('List your current alert threshhold')
.addStringOption(option =>
option.setName('gwei')
.setDescription('gwei threshold')
.setRequired(true))),
async execute(interaction: ChatInputCommandInteraction) {
const subcommand = interaction.options.getSubcommand();
if (subcommand == 'pending' ) {
console.log(`Replying to command "/gas pending"`)
return await handleGasPendingCommand(interaction);
} else if (subcommand == 'gwei') {
return await handleGasAlertCommand(interaction);
} else {
return await handleGasCommand(interaction);
}
}
};