dkoz / palworld-palbot

Palbot - Palworld Discord Bot for RCON, Economy, and Server Management.
https://discord.kozejin.dev
GNU General Public License v3.0
40 stars 8 forks source link

cross-platform communication #8

Closed Bluesheep33 closed 1 month ago

Bluesheep33 commented 2 months ago

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

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 commented 2 months ago

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:

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 commented 2 months ago

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.