plugins/resolvejid.lua

Mon, 06 Dec 2021 11:26:37 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 06 Dec 2021 11:26:37 +0000
changeset 166
95b668d73ff9
parent 105
4234c8789cc6
permissions
-rw-r--r--

rtbl_admin: Fix reason string (abuse is defined to be the most generic)

Would be nice to support reasons in the future (and text annotations)

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