misc.mcserver: reorder so data is actually gotten

This commit is contained in:
Cynthia Foxwell 2024-08-02 12:11:21 -06:00
parent 7c2f0dcdbc
commit d4f504bb3a

View file

@ -218,20 +218,20 @@ mcserver.callback = async function (msg, line) {
} }
} }
if (data?.error && !tried) {
try {
tried = true;
data = await queryServerNoIdent(ip, port);
} catch (err) {
await msg.removeReaction("\uD83C\uDFD3");
return `Failed to query:\n\`\`\`\n${data.error.message}\n\`\`\``;
}
}
if (data == "timeout") { if (data == "timeout") {
await msg.removeReaction("\uD83C\uDFD3"); await msg.removeReaction("\uD83C\uDFD3");
return "Timed out trying to query."; return "Timed out trying to query.";
} else if (data?.error) { } else if (data?.error) {
if (!tried) {
try {
tried = true;
data = await queryServerNoIdent(ip, port);
} catch (err) {
await msg.removeReaction("\uD83C\uDFD3");
return `Failed to query:\n\`\`\`\n${data.error.message}\n\`\`\``;
}
}
await msg.removeReaction("\uD83C\uDFD3"); await msg.removeReaction("\uD83C\uDFD3");
return `Failed to query:\n\`\`\`\n${data.error.message}\n\`\`\``; return `Failed to query:\n\`\`\`\n${data.error.message}\n\`\`\``;
} else { } else {