plugins/topic.lua

Fri, 07 Aug 2020 12:26:15 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Fri, 07 Aug 2020 12:26:15 +0100
changeset 156
619b1b9c16bc
parent 79
43ae29f2c69b
permissions
-rw-r--r--

config.docker.lua: Add to repo, used by default for Docker images

function riddim.plugins.topic(bot)
	bot:hook("commands/topic", function(cmd)
		local room = cmd.room;
		if not room then return "This isn't a room!"; end
		if not cmd.param then return room.subject or "No topic here"; end
		room:set_subject(cmd.param);
	end);

	bot:hook("commands/addtopic", function(cmd)
		local room = cmd.room;
		if not room then return "This isn't a room!"; end
		if not cmd.param then return "What do you want me do add?"; end
		room:set_subject((#room.subject>0 and room.subject .. cmd.param) or cmd.param)
	end);
end

mercurial