From fbd898d2eeada8525e9fd65c0fad7ff293a5af1e Mon Sep 17 00:00:00 2001 From: Niels Simenon Date: Mon, 15 Nov 2021 20:54:00 +0100 Subject: [PATCH] Added message user object fallback. --- config/default.js | 2 +- src/app.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/default.js b/config/default.js index a881fae..3594a50 100644 --- a/config/default.js +++ b/config/default.js @@ -12,7 +12,7 @@ module.exports = { avatar: 'https://i.imgur.com/IZwrjjG.png', }, operators: ['admin'], - uniqueUsername: true, + uniqueUsername: false, socket: 'ws://127.0.0.1:3000/socket', api: 'http://127.0.0.1:3000/api', reconnectDelay: 10, // seconds diff --git a/src/app.js b/src/app.js index a353d8b..dba88a3 100644 --- a/src/app.js +++ b/src/app.js @@ -136,7 +136,7 @@ function onLeave(data, bot) { function onMessage(message, bot, games) { const [, command, subcommand] = message.body?.match(new RegExp(`^${config.prefix}(\\w+)(?:\\:(\\w+))?`)) || []; - const user = bot.users[message.userId]; + const user = bot.users[message.userId] || message.user; const room = bot.rooms[message.roomId]; if (['leaderboard', 'lead', 'leader', 'leaders', 'scoreboard', 'best'].includes(subcommand) && games[command]) {