fixed the issue that the bot would crash when running the command while server is offline
This commit is contained in:
@@ -9,7 +9,7 @@ module.exports = {
|
|||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
const SERVER_IP = `${server_ip}`;
|
const SERVER_IP = `${server_ip}`;
|
||||||
|
try {
|
||||||
axios.get(`https://api.mcsrvstat.us/3/${SERVER_IP}`).then((resp) => {
|
axios.get(`https://api.mcsrvstat.us/3/${SERVER_IP}`).then((resp) => {
|
||||||
const data = resp.data;
|
const data = resp.data;
|
||||||
|
|
||||||
@@ -32,5 +32,8 @@ module.exports = {
|
|||||||
const embed = new EmbedBuilder(embedData);
|
const embed = new EmbedBuilder(embedData);
|
||||||
interaction.reply({ content: 'Server status:', embeds: [embed] });
|
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")
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user