added slash command and basic functionality

This commit is contained in:
2022-05-12 14:56:35 -05:00
parent e536d6b61c
commit fda4a09112
7 changed files with 298 additions and 40 deletions

27
commands/take.js Normal file

@ -0,0 +1,27 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
const noblox = require("noblox.js");
const {cookie} = require("../config.json");
module.exports = {
data: new SlashCommandBuilder()
.setName('take')
.setDescription('Takes an asset ID')
.addIntegerOption(option =>
option.setName("asset_id")
.setDescription("The asset ID of the model")
.setRequired(true))
,
async execute(interaction) {
const id = interaction.options.getInteger("asset_id");
await noblox.setCookie(cookie)
.then(async () => {
noblox.buy(id, 0)
.catch(async (error) => {
await interaction.reply("Could not take model!");
console.log("Could not take model: ")
console.log(error)
});
});
await interaction.reply("Model was taken successfully!");
},
};