plugins/resolvejid.lua

changeset 105
4234c8789cc6
equal deleted inserted replaced
104:8202cdfb99b4 105:4234c8789cc6
1 function riddim.plugins.resolvejid(bot)
2 function bot:resolvejid(jid, room)
3 local nows = jid:match"%S+"
4 local trimd = jid:match"^%s*(.-)%s*$"
5 if room then
6 local occupant = room.occupants[jid]
7 or room.occupants[trimd]
8 or room.occupants[nows]
9 if occupant then return occupant.jid end
10 end
11 return nows
12 end
13 end

mercurial