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

Remove time played from messages? #27

Closed spackletoe closed 5 months ago

spackletoe commented 5 months ago

Hi again!

First off, I moved the whole bot from onbe unraid server to another (upgraded) and I didn't have to ask you one question! Proud of myself. :)

I do have two other questions, though...

  1. Is there a way to remove the "after playing for XXX" portion of the messages?

  2. The log files that the satisfactory dedicated server makes aren't readable by the bot code until I manuall;y open up permissions on them, but after manually doing that, if a new log file is made, it has that permission problem again. image

Thank you!

DJWoodZ commented 5 months ago

Hi again @spackletoe. That's great. Well done.

I can add an option to stop that message.

On your second question, I believe you are using the ich777/steamcmd image to run the Satisfactory Dedicated Server. It looks like it has options that allow you to set the UID and GID, so you could try using those options to run the dedicated server with the same UID and GID as the discord bot container. If you persist other files to the host for that container, you may need to manually change the owner/permission of those files on the host, but to find the UID and GID you can open an interactive shell, for example:

docker exec -it satisfactory-discord-bot-server-1 /bin/sh

To find the UID:

id -u $USER

To find the GID:

id -g $USER

Alternatively, you could try the reverse, and edit this project to run the discord bot container with the same UID/GID as the dedicated server container.

spackletoe commented 5 months ago

Thank you, on both counts!

spackletoe commented 5 months ago

Hmm... I tried changing them on the satiusfactory dedicated server config (GID to 1000 and UID to 1000) and after I did that, it changed the ownership and prevented the satisfactory server from saving any games. We lost a day of building.. bummer... but I think adjusting the UID and GID of the discord bot would be the right move so that it can access the logs. Can you help me by telling me how to do that? I need to chnage the UID to 99 and the GID to 100 to match the server.

DJWoodZ commented 5 months ago

Your save games should hopefully not be lost unless you've deleted or overwritten them. It would be a good idea to ensure they are regularly backed up however, to avoid that from happening.

As mentioned above, if you change the UID and GID used by a container, you may also need to manually change the owner/permission of files persisted to the host, otherwise access could be lost, as you've described. It's difficult for me to tell you specific commands to run, as it will depend on your system, but you would do that with chown, chgrp and/or chmod commands.

To alter this project to run with another UID and GID, you will need to use user:

https://docs.docker.com/compose/compose-file/compose-file-v3/#domainname-hostname-ipc-mac_address-privileged-read_only-shm_size-stdin_open-tty-user-working_dir

https://docs.docker.com/engine/reference/builder/#user

There are other ways you could run the containers and share files between them, but they would be more advanced options. Again, the details would be somewhat dependant on your existing system setup, but that could be through mount points or a custom compose configuration, for example.

Whichever way you achieve it, however, you may need to manually adjust file permissions first, so I recommend starting by looking for a tutorial that explains Linux file permissions and the commands I've mentioned above. Once you are comfortable with that, your options should become clearer.