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

Add Chat Messages to DBLog Plugin #272

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

ect0s
Copy link
Contributor

@ect0s ect0s commented Jan 21, 2023

Add chat message table to DBLog

Schema includes:

Server
match
Time
Chat(teamchat/squadchat)
message
steamid

I did not create a foreign key dependence on steamuser, as I had issues when we received a chat message but had not received and created the steamuser via PLAYER_CONNECTED.

Add chat message table to DBLog

Schema includes:

Server
match
Time
Chat(teamchat/squadchat)
message
steamid

I did not create a foreign key dependence on steamuser, as I had issues when we received a chat message but had not received and created the steamuser via PLAYER_CONNECTED.
@ect0s ect0s added the plugin feature request Feature request related to the SquadJS plugins label Jan 21, 2023
@ect0s ect0s self-assigned this Jan 21, 2023
@ect0s ect0s linked an issue Jan 21, 2023 that may be closed by this pull request
@ect0s ect0s enabled auto-merge January 21, 2023 04:51
@ect0s ect0s changed the title chatmessage_DBlog Add Chat Messages to DBLog Plugin Jan 21, 2023
@werewolfboy13
Copy link
Collaborator

@ect0s has then been checked to make sure the tables are created properly in the DB?

@ect0s
Copy link
Contributor Author

ect0s commented Jan 21, 2023

@werewolfboy13

@ect0s has then been checked to make sure the tables are created properly in the DB?

Yes, though I did just update the Schema.

+---------+--------------+------+-----+---------+----------------+
| Field   | Type         | Null | Key | Default | Extra          |
+---------+--------------+------+-----+---------+----------------+
| id      | int          | NO   | PRI | NULL    | auto_increment |
| time    | datetime     | YES  |     | NULL    |                |
| chat    | varchar(255) | YES  |     | NULL    |                |
| message | text         | YES  |     | NULL    |                |
| steamid | varchar(255) | YES  |     | NULL    |                |
| server  | int          | NO   | MUL | NULL    |                |
| match   | int          | YES  | MUL | NULL    |                |
+---------+--------------+------+-----+---------+----------------+

Copy link
Collaborator

@werewolfboy13 werewolfboy13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be good, unable to test internally on my end.

@ect0s
Copy link
Contributor Author

ect0s commented Jan 24, 2023

@werewolfboy13

I've had this running for 4 days so far, no issues.

I've also deleted and recreated the DB multiple times, so as long as the SquadJS user people have configured in their DB can create the table, this should be good to merge.

@reck1610
Copy link
Contributor

@ect0s could you add the team id and squad id of the player too?
That would allow a complete recreation of the chat history.

@ect0s
Copy link
Contributor Author

ect0s commented Jan 25, 2023

@ect0s could you add the team id and squad id of the player too? That would allow a complete recreation of the chat history.

Sure.

Would team faction maybe matter here as well? Or the Squads Name at the time?

Just if I'm going to open and edit this PR, I'd like to nail down everything at once

@reck1610
Copy link
Contributor

The name of the squad could be useful, because it can change if a squad gets opened and closed.
The faction should be resolvable using the match. I don't think we need to duplicate the information.

@ect0s
Copy link
Contributor Author

ect0s commented Jan 25, 2023

@reck1610 Implemented.

Will require an alter to the table if you've already taken these changes.

+-----------+--------------+------+-----+---------+----------------+
| Field     | Type         | Null | Key | Default | Extra          |
+-----------+--------------+------+-----+---------+----------------+
| id        | int          | NO   | PRI | NULL    | auto_increment |
| time      | datetime     | YES  |     | NULL    |                |
| chat      | varchar(255) | YES  |     | NULL    |                |
| message   | text         | YES  |     | NULL    |                |
| steamid   | varchar(255) | YES  |     | NULL    |                |
| squadName | varchar(255) | YES  |     | NULL    |                |
| squadID   | int          | YES  |     | NULL    |                |
| team      | int          | YES  |     | NULL    |                |
| server    | int          | NO   | MUL | NULL    |                |
| match     | int          | YES  | MUL | NULL    |                |
+-----------+--------------+------+-----+---------+----------------+

@werewolfboy13
Copy link
Collaborator

Someone have the ALTER command so we can do some documentation for it?

@fantinodavide
Copy link
Contributor

fantinodavide commented Nov 3, 2023

Someone have the ALTER command so we can do some documentation for it?

The ALTER command is not needed because the changes add a new table, but won't modify the previously existing tables and the foreign keys are automatically updated by sequelize calling the .sync() method.

In case we really want to make sure, we can replace .sync() with .sync({ alter: true })

Also, I have another modification of this DBLog plugin to include tickets and some more details about the teams. Everything get stored at the end of each match.
It would be a nice addition, but it would also require altering the Match table to include some extra fields
Specifically, here are the new fields:

  • tickets
  • winnerTeam
  • winnerTeamID
  • team1
  • team2
  • isDraw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin feature request Feature request related to the SquadJS plugins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

please add a table to record players chat
4 participants