DJWoodZ / FS22-Discord-Bot

A Discord bot that posts Farming Simulator 22 Dedicated Server status information such as online players.
MIT License
10 stars 2 forks source link

database stays empty and no messages #10

Closed dehjvg closed 2 months ago

dehjvg commented 4 months ago

i am trying to get this working but so far i have the bot running the docker container running

when the server is online i get this info

2024-03-08 11:56:15 server-1 | Found: /usr/src/app/db/db.json 2024-03-08 11:56:16 server-1 | Updating... 2024-03-08 11:57:16 server-1 | Updating... 2024-03-08 11:58:16 server-1 | Updating... 2024-03-08 11:59:16 server-1 | Updating...

this is in the container but i dont see info in the db.json and nothing happens on discord

if i put the server ofline i get the following in the container

2024-03-08 12:04:49 server-1 | Updating... 2024-03-08 12:05:49 server-1 | Updating... 2024-03-08 12:05:59 server-1 | TypeError: fetch failed 2024-03-08 12:05:59 server-1 | at node:internal/deps/undici/undici:12345:11 2024-03-08 12:05:59 server-1 | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { 2024-03-08 12:05:59 server-1 | cause: ConnectTimeoutError: Connect Timeout Error 2024-03-08 12:05:59 server-1 | at onConnectTimeout (/usr/src/app/node_modules/undici/lib/core/connect.js:186:24) 2024-03-08 12:05:59 server-1 | at /usr/src/app/node_modules/undici/lib/core/connect.js:133:46 2024-03-08 12:05:59 server-1 | at Immediate._onImmediate (/usr/src/app/node_modules/undici/lib/core/connect.js:174:9) 2024-03-08 12:05:59 server-1 | at process.processImmediate (node:internal/timers:478:21) { 2024-03-08 12:05:59 server-1 | code: 'UND_ERR_CONNECT_TIMEOUT' 2024-03-08 12:05:59 server-1 | } 2024-03-08 12:05:59 server-1 | }

so that assumes when the server is online it makes a connection but also now nothing happoens on discord

am i missing somthing that i dont get info?

DJWoodZ commented 3 months ago

I am sorry you have been unable to get it working.

The bot's logs will show 'Sending message to: ...' when it attempts to send a message to a Discord channel. Errors are expected in the log if the server is turned off (unreachable), as opposed to running in the 'OFFLINE' state. Is the bot's activity status shown correctly as the state changes, i.e. 'Playing unknown' if unreachable, 'Playing offline' if OFFLINE and 'Playing online: 0/4' if ONLINE? Be mindful of the polling interval when checking this.

The db.json is only required when the bot restarts. It should still send messages, even if it cannot write to that file. If the bot is not detecting any changes it will not update the file, so the first thing to check is that your URLs in the .env.local file (FS22_BOT_URL_CAREER_SAVEGAME and FS22_BOT_URL_SERVER_STATS) are correct, and the host/container is not prevented from accessing them (e.g. using curl, checking firewall rules, etc.).

If you have specified a server or channel name (FS22_BOT_DISCORD_SERVER_NAME and/or FS22_BOT_DISCORD_CHANNEL_NAME) in the .env.local file, make sure it is spelled correctly. Be careful to check that any special characters are correct. If you see 'Sending message to: ...' in the logs, but nothing appears in Discord, check the bot's permissions in the Discord server.

If the bot is detecting changes (attempting to send messages) but the db.json is not being written, it is likely the container does not have permission to write to the file on the host. You must ensure the container user has the appropriate permission to do that.