Pulling API Data in DiscordJS

So, I'm not a pro and I don't understand what the docs are talking about for pulling data from APIs, so can someone help me with this? I am making a bot for a Minecraft Discord server, and want to use https://api.mcsrvstat.us/3/ as an API for pulling the data, but I really don't know how. - This is what I have so far and I know it needs a lot of fixing. - Does someone mind helping me fix this or understand it a little bit better?
const {
EmbedBuilder,
ButtonBuilder,
ActionRowBuilder,
SlashCommandBuilder,
ButtonStyle,
} = require("discord.js");

module.exports = {
name: "status",
description: "Basic info about Kasai's World, such as player count.",

callback: async (client, interaction) => {
interaction.reply(`${online}`);

client.on(Events.InteractionCreate, async (interaction) => {
const term = interaction.options.getString("term");
const query = new URLSearchParams({ term });

const statusResult = await request(
`https://api.mcsrvstat.us/3/world.kasaisora.com`
);
const { list } = await statusResult.body.json();
});
},
};
const {
EmbedBuilder,
ButtonBuilder,
ActionRowBuilder,
SlashCommandBuilder,
ButtonStyle,
} = require("discord.js");

module.exports = {
name: "status",
description: "Basic info about Kasai's World, such as player count.",

callback: async (client, interaction) => {
interaction.reply(`${online}`);

client.on(Events.InteractionCreate, async (interaction) => {
const term = interaction.options.getString("term");
const query = new URLSearchParams({ term });

const statusResult = await request(
`https://api.mcsrvstat.us/3/world.kasaisora.com`
);
const { list } = await statusResult.body.json();
});
},
};
3 Replies
d.js toolkit
d.js toolkit15mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by staff
treble/luna
treble/luna15mo ago
not djs related, #other-js-ts
maybeizen
maybeizenOP15mo ago
Okay, sorry
Want results from more Discord servers?
Add your server