25 room.bot = bot; |
25 room.bot = bot; |
26 bot:event(reflect_events[i], room, ...) |
26 bot:event(reflect_events[i], room, ...) |
27 end); |
27 end); |
28 end |
28 end |
29 |
29 |
30 function bot:join_room(room_jid, nick) |
30 function bot:join_room(room_jid, nick, password) |
31 nick = nick or bot.config.nick or ("bot"..math.random(10000,99999)); |
31 nick = nick or bot.config.nick or ("bot"..math.random(10000,99999)); |
32 local room = bot.stream:join_room(room_jid, nick) |
32 local room = bot.stream:join_room(room_jid, nick, password) |
33 room.bot = bot; |
33 room.bot = bot; |
34 room:hook("message", function(event) |
34 room:hook("message", function(event) |
35 if event.nick == room.nick then |
35 if event.nick == room.nick then |
36 return true; |
36 return true; |
37 end |
37 end |