Fri, 02 Oct 2020 17:02:37 +0200
plugins/groupchat.lua: Add support for muc passwords
0 | 1 | |
2 | function riddim.plugins.ping(bot) | |
3 | bot.stream:add_plugin("ping"); | |
105
4234c8789cc6
plugins.{ping,version,resolvejid}: Break nickname/jid resolving into a common plugin
Kim Alvefur <zash@zash.se>
parents:
16
diff
changeset
|
4 | bot:add_plugin("resolvejid"); |
0 | 5 | bot:hook("commands/ping", function (command) |
16 | 6 | local jid = command.param; |
7 | if jid then | |
105
4234c8789cc6
plugins.{ping,version,resolvejid}: Break nickname/jid resolving into a common plugin
Kim Alvefur <zash@zash.se>
parents:
16
diff
changeset
|
8 | jid = bot:resolvejid(jid, command.room); |
144
68dc84e72bef
riddim.plugins.ping: Handle JID being unknown after "resolving"
Kim Alvefur <zash@zash.se>
parents:
105
diff
changeset
|
9 | end |
68dc84e72bef
riddim.plugins.ping: Handle JID being unknown after "resolving"
Kim Alvefur <zash@zash.se>
parents:
105
diff
changeset
|
10 | if jid then |
16 | 11 | bot.stream:ping(jid, function (time, jid, error) |
12 | if time then | |
13 | command:reply(string.format("Pong from %s in %0.3f seconds", jid, time)); | |
14 | else | |
15 | command:reply("Ping failed ("..(error.condition or "unknown reason")..")"..(error.text and (": "..error.text) or "")); | |
16 | end | |
17 | end); | |
18 | return true; | |
19 | end | |
20 | return "pong"; | |
21 | end); | |
0 | 22 | end |