fixed the issue that the bot would crash when running the command while server is offline

This commit is contained in:
valentijn
2024-01-04 22:43:10 +01:00
parent 5152eb3834
commit 8e636f75a1

View File

@@ -9,7 +9,7 @@ module.exports = {
async execute(interaction) {
const SERVER_IP = `${server_ip}`;
try {
axios.get(`https://api.mcsrvstat.us/3/${SERVER_IP}`).then((resp) => {
const data = resp.data;
@@ -32,5 +32,8 @@ module.exports = {
const embed = new EmbedBuilder(embedData);
interaction.reply({ content: 'Server status:', embeds: [embed] });
});
} catch (e){
await interaction.reply("An Error Occurred, and i am too lazy to add a proper embed for it. the server is probably offline or something")
}
},
};