DJWoodZ / Satisfactory-Discord-Bot

A Discord bot that posts Satisfactory Dedicated Server status information such as online players.
MIT License
12 stars 2 forks source link

Remote Dedicated Server hosted on Pterodactyl Panel #31

Closed TheG33kDev closed 1 month ago

TheG33kDev commented 1 month ago

Hello,

Is there a way to set this up to monitor a remote dedicated server that's running pterodactyl panel?

Thanks,

DJWoodZ commented 1 month ago

Hi @TheG33kDev,

Yes, this is possible. The Discord bot uses both the network and file system to monitor the dedicated server. I assume you are asking about the latter. Remote access to the file system can be achieved via a network share on the Pterodactyl node.

The steps required will vary depending on your OS, your Pterodactyl set up and whether you also need to establish a tunnel/VPN but if, for example, you are running Wings from the example Docker Compose template, your server volumes will be available on the host under: /var/lib/pterodactyl/volumes/. So you could export the Logs directory (e.g. /var/lib/pterodactyl/volumes/{UUID}/FactoryGame/Saved/Logs/) as read only and mount that on the host that is running your discord bot.

If you do this, you may find that you need to set SATISFACTORY_BOT_LOG_USE_WATCH_FILE=true in your .env.local for it to work.

TheG33kDev commented 1 month ago

Is there a way to have the bot just do an SFTP pull of the log file since Pterodactyl has a native SFTP built in?

DJWoodZ commented 1 month ago

The bot relies on realtime access to the log file. It essentially tails the log, but SFTP is not well suited to realtime applications. However, you could try something like using a cron job to fetch the log file using SFTP.

TheG33kDev commented 1 month ago

So wound up setting it up on the same machine as the Pterodactyl node just to make life easier... I got through install fine and got the vars edited but when I try to npm start I get this:

SyntaxError: Unexpected token '.' at wrapSafe (internal/modules/cjs/loader.js:915:16) at Module._compile (internal/modules/cjs/loader.js:963:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) at internal/main/run_main_module.js:17:47

I put the discord bot token in the .env.local file and it does have a '.' in it so not sure if that's what it's talking about or something else...

DJWoodZ commented 1 month ago

What version of Node.js are you using? You might need to use a newer version.

TheG33kDev commented 1 month ago
luka@node1:~$` node --version
v20.13.1
luka@node1:~$ nodejs -v
v12.22.9
TheG33kDev commented 1 month ago

After adding v20.13.1 we're good!

TheG33kDev commented 1 month ago

Spoke too soon... getting this now:

Updating...
Error: Connection timed out
    at Timeout.<anonymous> (/home/luka/Satisfactory-Discord-Bot/node_modules/@dwoodz/satisfactory-dedicated-server-query-port-probe/index.js:20:12)
    at listOnTimeout (node:internal/timers:573:17)
    at process.processTimers (node:internal/timers:514:7)
TheG33kDev commented 1 month ago

Got it figured out had to put the public IP in place instead of 127.0.0.1

DJWoodZ commented 1 month ago

Thanks for the update. I'm glad you got it working.

BladeRavinger commented 1 month ago

@TheG33kDev Sorry to wake a solved thread, i was hoping i could reach out to you, im having some issues with this bot and PT figured you could point me in the right direction as you got it up.

didnt want to create a new thread when i know its my mistake :)