diff --git a/lib/bot.js b/lib/bot.js index c943d674..f8350698 100644 --- a/lib/bot.js +++ b/lib/bot.js @@ -213,10 +213,7 @@ class Bot { const user = this.discord.users.find('username', search); if (user) { - const nickname = guild.members.get(user.id).nickname; - if (!nickname || nickname === search) { - return user; - } + return user; } return match; diff --git a/test/bot.test.js b/test/bot.test.js index 4162b7c1..bf17baa4 100644 --- a/test/bot.test.js +++ b/test/bot.test.js @@ -400,15 +400,15 @@ describe('Bot', function () { this.sendMessageStub.should.have.been.calledWith(expected); }); - it('should not convert username mentions from IRC if nickname differs', function () { + it('should convert username mentions from IRC even if nickname differs', function () { const testUser = new discord.User(this.bot.discord, { username: 'testuser', id: '123', nickname: 'somenickname' }); this.findUserStub.withArgs('username', testUser.username).returns(testUser); this.findUserStub.withArgs('nickname', 'somenickname').returns(testUser); this.findUserStub.withArgs('id', testUser.id).returns(testUser); const username = 'ircuser'; - const text = 'Hello, @username!'; - const expected = `**<${username}>** Hello, @username!`; + const text = 'Hello, @testuser!'; + const expected = `**<${username}>** Hello, <@${testUser.id}>!`; this.bot.sendToDiscord(username, '#irc', text); this.sendMessageStub.should.have.been.calledWith(expected);