Skip to content

Commit

Permalink
fix chat message detection
Browse files Browse the repository at this point in the history
chatMessages dont include playerName anymore...
  • Loading branch information
niekcandaele committed Jul 12, 2024
1 parent 9143207 commit 07cdb6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions api/hooks/sdtdLogs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ module.exports = function sdtdLogs(sails) {
});

eventEmitter.on('chatMessage', function (chatMessage) {
if(!chatMessage.playerName) {chatMessage.playerName = chatMessage.player.name;};
chatMessage.server = _.omit(server, 'authName', 'authToken');
chatMessage.player = _.omit(chatMessage.player, 'inventory');

Expand Down
3 changes: 2 additions & 1 deletion worker/processors/logs/handleLogLine.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const entityKilledRegex = /(killed .*)/g;
const gmsgDeathRegex = /GMSG: Player '(\w+)' died/;
const gmsgPvPDeathRegex = /GMSG: Player (.+) killed by (.+)/;

const chatRegex = /Chat \(from '(?<steamId>[\w\d-]+)', entity id '(?<entityId>[-\d]+)', to '(?<channel>\w+)'\): '(?<playerName>.+)':(?<messageText>.+)/;
const chatRegex =
/Chat \(from '(?<steamId>[\w\d-]+)', entity id '(?<entityId>[-\d]+)', to '(?<channel>\w+)'\): ('(?<playerName>.+)':)?(?<messageText>.+)/;

module.exports = logLine => {

Expand Down

0 comments on commit 07cdb6c

Please sign in to comment.