Jump to content
stanhope

[Discontinued] Arma server monitor discord bot

Recommended Posts

Just had a thought is it worth using local IP in server IP rather than Public IP being that there on same machine 

Share this post


Link to post
Share on other sites

Just as an FYI:

"namePrefix": "Epic Fail Warlords Takistan",

"nameSuffix": "Epic Fail Warlords Takistan",

Prefix is what it'll put in the server's name before the mission name and suffix is what it'll put behind it.  So if you're running a mission called "capture the island" your servers name will be: "Epic Fail Warlords Takistan capture the island Epic Fail Warlords Takistan".

Don't know if I properly documented this.

1 minute ago, AshleyMosey said:

Just had a thought is it worth using local IP in server IP rather than Public IP being that there on same machine 

No, because it's gonna querry the steam servers to get the status of your server as well as some other things.  I'm gonna try adding your server to my bot and see if I can get it working

Share this post


Link to post
Share on other sites

I don't know what to tell you:

Spoiler

UcW1U04.png

Share this post


Link to post
Share on other sites

haha O.....K then i mean you have seen my config so somethings going full Re**rd somewhere I'm off to work ill have a look at it al again when I get back see what I can do might start from scratch 

  • Haha 1

Share this post


Link to post
Share on other sites

Just another quick question too can you upload PBOs to your server using links most of my missions I make are too large to upload to a discord channel 

Share this post


Link to post
Share on other sites

Not currently no, but I'll put it on the list

Share this post


Link to post
Share on other sites

Perfect 

Just now, stanhope said:

Not currently no, but I'll put it on the list

If you get arround to doing that I dont know if its possible but might be worth having it do a check to see if it's in a Zip and if it is unzip it and extract to the missions folder in config file 

Share this post


Link to post
Share on other sites

Should be possible, at first glance there are several node packages that allows one to extract files so I'll probably be able to find one that works

Share this post


Link to post
Share on other sites
6 minutes ago, stanhope said:

Should be possible, at first glance there are several node packages that allows one to extract files so I'll probably be able to find one that works

Nice I know google drive and dropbox sometime Zip files before downloading them so probably worth having that check there 

Share this post


Link to post
Share on other sites

I cant for the life of me get this bot to recognise that my server is up and running fine and I don't get why 

 

Share this post


Link to post
Share on other sites

I don't know what it could be either, maybe see with wireshark what's going on?

Share this post


Link to post
Share on other sites
13 hours ago, stanhope said:

I don't know what it could be either, maybe see with wireshark what's going on?

good idea ill give that a try 

 

Share this post


Link to post
Share on other sites

Were is it suppose to be pinging to see if the server is online as I'm not getting any pings from my network to the server IP or Port with any program even after running the *serversatus command or *serverdetails (my prefix Is *)

 

Also I don't get a server launched successfully ping on discord until I actually close the Arma 3 server down by clicking the X in the top right corner of the Arma 3 Console Either 

Share this post


Link to post
Share on other sites

I use gamedig to do those calls, maybe their git can tell you what they're pinging?

Share this post


Link to post
Share on other sites

okay so i installed gamedig as a global module so i could run the gamedig commands in my terminal if I search for my server using the public IP it doesn't find it but if I search for it using my local IP it dose so for example 

if I do 
gamedig --type arma3 82.21.139.202:2302

I get this as a response 
{"error":"Failed all 2 attempts"}

if I do the same search but use my local IP instead I get 
gamedig  --type arma3 192.168.0.17:2302 (THIS IS MY LOCAL IP & GAME PORT)

 I get this and more
{"name":"Epic Fail Warlords Takistan","map":"takistan","password":false,"raw":{"protocol":17,"folder":"Arma3","game":"Warlords%20Takistan"

 

but if I change the config for your bot to the local IP I still get told the server is down 


 

Share this post


Link to post
Share on other sites
 
 
 
 
 
 
2
 Advanced issues found
 
😐
5
9 minutes ago, AshleyMosey said:

okay so i installed gamedig as a global module so i could run the gamedig commands in my terminal if I search for my server using the public IP it doesn't find it but if I search for it using my local IP it dose so for example 

if I do 
gamedig --type arma3 82.21.139.202:2302

I get this as a response 
{"error":"Failed all 2 attempts"}

if I do the same search but use my local IP instead I get 
gamedig  --type arma3 192.168.0.17:2302 (THIS IS MY LOCAL IP & GAME PORT)

 I get this and more
{"name":"Epic Fail Warlords Takistan","map":"takistan","password":false,"raw":{"protocol":17,"folder":"Arma3","game":"Warlords%20Takistan"

 

but if I change the config for your bot to the local IP I still get told the server is down 


 

SORRY the bot does pickup the server if I use the Local IP I messed up the " before the IP when I pasted it in 


Screenshot https://imgur.com/WHrpgW7

So now my question is is there a way to get the Server Details message in the above image to show the public IP because my discord users obviously won't find my server with the local IP and this might cause confustion for the less technical minded of my users 

Share this post


Link to post
Share on other sites

The server details and server status command both only try to ping the server once and have a timeout of a second, try going into the functions file (/src/js/functions.js) and edit the queryserver function to do like 5 attempts and have a timeout of 10 seconds.  Maybe that's the problem.  Additionally you can alter the error handling in the getserverdetails function in the botfunctions file (/src/js/botfunctions.js) to in the catch just do a console.log(error); to see why it's failing.  That might contain some useful information.  Because I can't reproduce the bug I can't really fix it.

Share this post


Link to post
Share on other sites
10 minutes ago, stanhope said:

The server details and server status command both only try to ping the server once and have a timeout of a second, try going into the functions file (/src/js/functions.js) and edit the queryserver function to do like 5 attempts and have a timeout of 10 seconds.  Maybe that's the problem.  Additionally you can alter the error handling in the getserverdetails function in the botfunctions file (/src/js/botfunctions.js) to in the catch just do a console.log(error); to see why it's failing.  That might contain some useful information.  Because I can't reproduce the bug I can't really fix it.

okay ill get on that now and get back to you 

Share this post


Link to post
Share on other sites
 
 
 
1
 Advanced issue found
 
2
17 minutes ago, stanhope said:

Additionally you can alter the error handling in the getserverdetails function in the botfunctions file (/src/js/botfunctions.js) to in the catch just do a console.log(error); to see why it's failing.  That might contain some useful information.  Because I can't reproduce the bug I can't really fix it.

Spoiler

 

 module.exports.getServerDetails = async function (server, reply) {

        await fn

            .queryServer(server, Gamedig)

            .then(state => {

                let header = "";

                let body = "";

                let fail = false;

                switch (server.serverType) {

                    case "arma3":

                        header = `${state.name}\n`;

                        body = `mission: \`${state.raw.game}\``;

                        if (typeof state.map == undefined || state.map == "") {

                            body =

                                body +

                                `\nIP: \`${state.connect}\`, server is up, ping \`${state.ping}\`.\n \`${state.raw.numplayers}/${state.maxplayers}\` players connected`;

                        } else {

                            body =

                                body +

                                `, map: \`${state.map}\`\nIP: \`${state.connect}\`, server is up, ping \`${state.ping}\`.\n \`${state.raw.numplayers}/${state.maxplayers}\` players connected`;

                        }

                        break;

                    case "teamspeak3":

                        header = `${state.name} TeamSpeak3`;

                        body = `IP: \`${state.connect}\`, server is up, ping \`${state.ping}\`, \`${state.raw.virtualserver_clientsonline}/${state.raw.virtualserver_maxclients}\` players connected.`;

                        break;

                    default:

                        fail = true;

                        break;

                }

                if (fail) {

                    reply

                        .setColor("#ff0000")

                        .addField(

                            "Something went wrong",

                            "Please contact my maintainer [here](https://gitlab.com/stanhope/arma3servermonitordiscordbot/issues) and tell him I've been a bad bot."

                        );

                } else {

                    reply.addField(header, body);

                }

            })

            .catch(error => {

                if (error.toString().includes("Error: Failed all ")) {

                    reply.addField(server.serverName, "offline");

                } else {

                    reply.addField(

                        server.serverName,

                        "Something unexpected went wrong.  Please contact my maintainer.",

                        true

                    );

                    reply.setColor("#ffa200");

                    fn.writeError(error, client);

                }

 

i was slightly confuse were about do it put the  "console.log(error);"  is it in the "IF" statement before the "ELSE" statement 

Share this post


Link to post
Share on other sites

First line after ".catch(error => {" outside of the if - else

Share this post


Link to post
Share on other sites
 
 
0
 Advanced issue found
 
 
 
 
0
 Advanced issue found
 
 
Spoiler

.catch(error => {

                if (error.toString().includes("Error: Failed all ")) {

                    reply.addField(server.serverName, "offline");

                } else {

                    reply.addField(

                        server.serverName,

                        "Something unexpected went wrong.  Please contact my maintainer.",

                        true

                    );

                    reply.setColor("#ffa200");

                    fn.writeError(error, client);

                    console.log(error);

                }

Like this 

Share this post


Link to post
Share on other sites
Spoiler

 .catch(error => { 
	console.log(error);

                if (error.toString().includes("Error: Failed all ")) {

                    reply.addField(server.serverName, "offline");

                } else {

                    reply.addField(

                        server.serverName,

                        "Something unexpected went wrong.  Please contact my maintainer.",

                        true

                    );

                    reply.setColor("#ffa200");

                    fn.writeError(error, client);

                    

                } 

 

Like that

Share this post


Link to post
Share on other sites

Okay thank were do i need to be looking for the errors in the Terminal or will it log it to a file 

 

Share this post


Link to post
Share on other sites

Terminal, whenever you execute that command

Share this post


Link to post
Share on other sites
Spoiler

> node ./src/index.js

reading config...
Config read
Starting bot ...
Starting server status checker ...
Bot started and logged in as Arma 3 Server Status#2827!
Bot functions set up
server status checker started
RSS feed started
Command received: startserver epicfailwarlords undefined
Server epicfailwarlords (82.21.139.202:2302) is down!
Not notifying people
Not notifying people
Command received: serverdetails undefined undefined
Not notifying people
Error: Failed all 10 attempts
    at QueryRunner.run (C:\Users\ashle\OneDrive\Documents\arma3servermonitordiscordbot-master\node_modules\gamedig\lib\QueryRunner.js:88:21)
    at runNextTicks (internal/process/task_queues.js:62:5)
    at listOnTimeout (internal/timers.js:518:9)
    at processTimers (internal/timers.js:492:7)
Attempt #1 - Port=2303 Retry=0:
Error: Attempt - Timed out after 10000ms
    at Timeout.<anonymous> (C:\Users\ashle\OneDrive\Documents\arma3servermonitordiscordbot-master\node_modules\gamedig\lib\Promises.js:7:25)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
Attempt #2 - Port=2303 Retry=1:
Error: UDP - Timed out after 10000ms
    at Timeout.<anonymous> (C:\Users\ashle\OneDrive\Documents\arma3servermonitordiscordbot-master\node_modules\gamedig\lib\Promises.js:7:25)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
Attempt #3 - Port=2303 Retry=2:
Error: UDP - Timed out after 10000ms
    at Timeout.<anonymous> (C:\Users\ashle\OneDrive\Documents\arma3servermonitordiscordbot-master\node_modules\gamedig\lib\Promises.js:7:25)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
Attempt #4 - Port=2303 Retry=3:
Error: UDP - Timed out after 10000ms
    at Timeout.<anonymous> (C:\Users\ashle\OneDrive\Documents\arma3servermonitordiscordbot-master\node_modules\gamedig\lib\Promises.js:7:25)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
Attempt #5 - Port=2303 Retry=4:
Error: UDP - Timed out after 10000ms
    at Timeout.<anonymous> (C:\Users\ashle\OneDrive\Documents\arma3servermonitordiscordbot-master\node_modules\gamedig\lib\Promises.js:7:25)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
Attempt #6 - Port=2302 Retry=0:
Error: Attempt - Timed out after 10000ms
    at Timeout.<anonymous> (C:\Users\ashle\OneDrive\Documents\arma3servermonitordiscordbot-master\node_modules\gamedig\lib\Promises.js:7:25)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
Attempt #7 - Port=2302 Retry=1:
Error: UDP - Timed out after 10000ms
    at Timeout.<anonymous> (C:\Users\ashle\OneDrive\Documents\arma3servermonitordiscordbot-master\node_modules\gamedig\lib\Promises.js:7:25)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
Attempt #8 - Port=2302 Retry=2:
Error: UDP - Timed out after 10000ms
    at Timeout.<anonymous> (C:\Users\ashle\OneDrive\Documents\arma3servermonitordiscordbot-master\node_modules\gamedig\lib\Promises.js:7:25)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
Attempt #9 - Port=2302 Retry=3:
Error: UDP - Timed out after 10000ms
    at Timeout.<anonymous> (C:\Users\ashle\OneDrive\Documents\arma3servermonitordiscordbot-master\node_modules\gamedig\lib\Promises.js:7:25)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
Attempt #10 - Port=2302 Retry=4:
Error: UDP - Timed out after 10000ms
    at Timeout.<anonymous> (C:\Users\ashle\OneDrive\Documents\arma3servermonitordiscordbot-master\node_modules\gamedig\lib\Promises.js:7:25)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)

Heres what got with the Public IP of the Server Set 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×