Coding Global Background
Coding Global

rolimon help

Archived 3 years ago
0 messages
0 members
Created 3 years ago
Updated 3 years ago
Open in Discord
G
group
const { SlashCommandBuilder } = require('discord.js');
const { EmbedBuilder } = require("@discordjs/builders");
const axios = require('axios');

module.exports = {
data: new SlashCommandBuilder()
.setName('item')
.setDescription('Find item details')
.addStringOption(option => option.setName('item_name').setDescription('Enter a search for the item you want to find').setRequired(true)),
async execute(interaction) {
const itemQuery = interaction.options.getString('item_name'); // Updated line

axios.get(https://www.rolimons.com/itemapi/search?query=${encodeURIComponent(itemQuery)})
.then(response => {
const itemData = response.data.items;
if (itemData.length > 0) {

const item = itemData[0];
const embed = new EmbedBuilder()
.setTitle(item[0])
.setDescription(item[1])
.addField('Value', item[2])
.addField('Limited Value', item[3])
.addField('Average Value', item[4])
.addField('Sales', item[5])
.addField('Limited Sales', item[6])
.addField('Total Owners', item[7])
.addField('Item Type', item[8])
.addField('Rap Increase', item[9])
.setColor('#ff0000');
// Reply with the embed
interaction.reply({ embeds: [embed] });
} else {
interaction.reply(No items found ${item_name});
}
})
.catch(error => {
console.error(error);
interaction.reply(An error occurred while fetching item details: ${error.message});
});
},
};



Idk what’s the error it said 404 but the api doesn’t need any keys and it’s always up

the code is supposed to fetch the rolimons item API