1 local parse_xeps, xeps_updated_at; |
1 local parse_xeps, xeps_updated_at; |
2 local xeps, xeps_short = {}, {}; |
2 local xeps, xeps_short = {}, {}; |
3 |
3 |
4 function riddim.plugins.xeps(bot) |
4 function riddim.plugins.xeps(bot) |
5 require "net.httpclient_listener"; |
|
6 local http = require("net.http"); |
5 local http = require("net.http"); |
7 bot:hook("commands/xep", function(command) |
6 bot:hook("commands/xep", function(command) |
8 -- Cache XEP list for an hour |
7 -- Cache XEP list for an hour |
9 if os.difftime(os.time(), xeps_updated_at) > (60 * 60) then -- Not refreshed within 1 hour |
8 if os.difftime(os.time(), xeps_updated_at) > (60 * 60) then -- Not refreshed within 1 hour |
10 http.request('http://xmpp.org/extensions/xeps.xml', nil, function (data, code) |
9 http.request('http://xmpp.org/extensions/xeps.xml', nil, function (data, code) |