Skip to content

Commit

Permalink
fix mentionedUsers error on reply with no mentions (#296)
Browse files Browse the repository at this point in the history
mentionedUsers uses `parseMentions` to obtain a table of mentioned users in the message and then adds the reply target to that table if the message is a reply. This fails when the message contains no mentions (fails `%b<>`) and the message is a reply. This fixes the issue by having `parseMentions` return an empty table in such the case.
  • Loading branch information
truemedian authored May 31, 2021
1 parent 271374f commit 10f94b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/containers/Message.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function Message:_load(data)
end

local function parseMentions(content, pattern)
if not content:find('%b<>') then return end
if not content:find('%b<>') then return {} end
local mentions, seen = {}, {}
for id in content:gmatch(pattern) do
if not seen[id] then
Expand Down

0 comments on commit 10f94b8

Please sign in to comment.