plugins/resolvejid.lua

Mon, 17 Sep 2018 14:46:47 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 17 Sep 2018 14:46:47 +0100
changeset 151
936364f8efcf
parent 105
4234c8789cc6
permissions
-rw-r--r--

Dockerfile: Switch to alpine for final image

function riddim.plugins.resolvejid(bot)
	function bot:resolvejid(jid, room)
		local nows = jid:match"%S+"
		local trimd = jid:match"^%s*(.-)%s*$"
		if room then
			local occupant = room.occupants[jid]
			or room.occupants[trimd]
			or room.occupants[nows]
			if occupant then return occupant.jid end
		end
		return nows
	end
end

mercurial