plugins/resolvejid.lua

Tue, 22 Sep 2020 14:59:25 +0200

author
Seve Ferrer <seve@delape.net>
date
Tue, 22 Sep 2020 14:59:25 +0200
changeset 159
7ca948b157df
parent 105
4234c8789cc6
permissions
-rw-r--r--

plugins/commands.lua: The default command_prefix value is set on config.docker.lua.

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