Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cross-platform communication #8

Open
3 tasks
Bluesheep33 opened this issue Aug 13, 2024 · 2 comments
Open
3 tasks

cross-platform communication #8

Bluesheep33 opened this issue Aug 13, 2024 · 2 comments

Comments

@Bluesheep33
Copy link

Bluesheep33 commented Aug 13, 2024

feature:
enable users on the palword server to communicate by one another.

admin sets discord channel id used for communication in env

if users talk in the specified channel,
then the server sends these messages to the palworld server with the /announce API endpoint or using RCON

if chat/join/leave event occurs on palworld server,
then the event gets sent to the specified discord channel

admin can disable this feature by leaving the env variable blank

requirements:
another approach may be possible, but this is the one that i know is possible for sure

  • extra env variable
  • a way for events to get noticed by bot (e.g. start server with custom shell command to write stdout to a log file, which the bot watches for changes [1])
  • send messages to the discord channel ("player joined"/"player left"/"player: message" for event types join/leave/chat)

references:
[1] palworld bot using this feature: Palcord
[2] minecraft bot using this feature: DiscordUtils

note:
this makes the codebase more complex and install process a bit longer, so implement at your own risk ;)

@Bluesheep33
Copy link
Author

also note that when running the palworld server and discord bot on different users, it will be harder to manage the server logging needed for this feature in the approach i specified.

possible fixes are:

  • giving the user on which the palword server is permission to write to the log file stored in the folder of the palworld bot (e.g. using chmod on linux)
  • require running the bot on the same user. i do not recommend this for this project, because this limits freedom for users

these fixes assume that the processes are both run on the same device. fixing this issue for when the processes are run on different devices may be more difficult

@dkoz
Copy link
Owner

dkoz commented Aug 14, 2024

Well here's my breakdown...

  1. Broadcast to the server:
    This feature is already available through the /palcon broadcast command. If you’re referring to a channel that users can type in, which would then relay messages to Discord, I could implement this, but it doesn't make sense without a real-time chat feed.
  2. Regarding the chat relay:
    This is complex. There are several ways to make this work, but each approach varies depending on individual needs. Whether someone hosts it locally and requires direct file access, wants the bot to directly manage the server and process the JSON/TEXT output, or reads logs via FTP/SFTP, it's not feasible for me to implement all these different methods.
  3. Broadcasting events to discord:
    This functionality already exists within the connect cog (https://github.com/dkoz/palworld-palbot/blob/main/cogs/connect.py) of the bot. You can use the eventlogs command to set a channel for this purpose.

Additionally, I've created cogs for different FTP/SFTP methods and direct file access through a local directory. I’ll need to test them as they haven't been used in months for chat relay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants