plugins/topic.lua

changeset 79
43ae29f2c69b
equal deleted inserted replaced
74:65be10a5db6d 79:43ae29f2c69b
1 function riddim.plugins.topic(bot)
2 bot:hook("commands/topic", function(cmd)
3 local room = cmd.room;
4 if not room then return "This isn't a room!"; end
5 if not cmd.param then return room.subject or "No topic here"; end
6 room:set_subject(cmd.param);
7 end);
8
9 bot:hook("commands/addtopic", function(cmd)
10 local room = cmd.room;
11 if not room then return "This isn't a room!"; end
12 if not cmd.param then return "What do you want me do add?"; end
13 room:set_subject((#room.subject>0 and room.subject .. cmd.param) or cmd.param)
14 end);
15 end

mercurial