misc.mcserver: increase timeout, add reaction
This commit is contained in:
parent
edb2bdb552
commit
3d600c8c9a
1 changed files with 7 additions and 2 deletions
|
@ -758,18 +758,20 @@ mcserver.callback = async function (msg, line) {
|
|||
const ip = split[0];
|
||||
const port = split[1] ?? 25565;
|
||||
|
||||
await msg.addReaction("\uD83C\uDFD3");
|
||||
|
||||
const data = await new Promise((resolve, reject) => {
|
||||
logger.verbose("mcserver", "querying", ip, port);
|
||||
const timeout = setTimeout(() => {
|
||||
logger.verbose("mcserver", "timeout");
|
||||
resolve("timeout");
|
||||
}, 10000);
|
||||
}, 60000);
|
||||
|
||||
const client = net.createConnection(
|
||||
{
|
||||
host: ip,
|
||||
port: port,
|
||||
timeout: 10000,
|
||||
timeout: 60000,
|
||||
},
|
||||
function () {
|
||||
logger.verbose("mcserver", "connect");
|
||||
|
@ -803,8 +805,11 @@ mcserver.callback = async function (msg, line) {
|
|||
});
|
||||
|
||||
if (data == "timeout") {
|
||||
await msg.removeReaction("\uD83C\uDFD3");
|
||||
return "Timed out trying to query.";
|
||||
} else {
|
||||
await msg.removeReaction("\uD83C\uDFD3");
|
||||
|
||||
const motd = data.description.text.replace(
|
||||
/\u00a7([a-f0-9k-or])/gi,
|
||||
(formatting) => {
|
||||
|
|
Loading…
Reference in a new issue