Pryaxis / TShock

☕️⚡️TShock provides Terraria servers with server-side characters, anti-cheat, and community management tools.
GNU General Public License v3.0
2.41k stars 377 forks source link

Add chat history to REST API #2884

Open QuiCM opened 1 year ago

QuiCM commented 1 year ago

Captured from Discord (thanks to @Raspberry), with minor adjustments:

REST API Suggestion: /server/chat the client (the one who's gonna send a request), would send something like:

GET /server/chat?filter=player&limit=50
  • filter: filter by player name (accepting tsn:, tsi: prefixing). Don't send this parameter to receive chat history from all players
  • limit: number of messages to return. Don't send this parameter to receive all chat history

and the server will respond with

{
"response": [
"chat", 
"history",
"goes",
"here"
]
}

the first index on the list being the last message sent (chronological ordering)

Noting:

hakusaro commented 1 year ago

We could just store chat as a datastructure or something. Memory is okay but long-term it would probably work best in a db?

ghost commented 11 months ago

We could just store chat as a datastructure or something. Memory is okay but long-term it would probably work best in a db?

yes, that could work but it would need to be accessible by the "REST API" so that would mean that the server would have to send information to the "REST" client, aka the database so if an unauthorized person accesses it then the person could steal information causing there to be an added security measure for the "REST API" software (EX; Passwords, Pins, ECT)