Thu, 20 May 2010 14:33:41 +0100
Formatting, indentation and cleanup
0 | 1 | |
2 | function riddim.plugins.ping(bot) | |
3 | bot.stream:add_plugin("ping"); | |
4 | bot:hook("commands/ping", function (command) | |
16 | 5 | local jid = command.param; |
6 | if jid then | |
7 | bot.stream:ping(jid, function (time, jid, error) | |
8 | if time then | |
9 | command:reply(string.format("Pong from %s in %0.3f seconds", jid, time)); | |
10 | else | |
11 | command:reply("Ping failed ("..(error.condition or "unknown reason")..")"..(error.text and (": "..error.text) or "")); | |
12 | end | |
13 | end); | |
14 | return true; | |
15 | end | |
16 | return "pong"; | |
17 | end); | |
0 | 18 | end |