comparison mod_slack_webhooks/mod_slack_webhooks.lua @ 3148:8c7b8b2c3237

mod_slack_webhooks: Add a special webhook target for debugging
author Kim Alvefur <zash@zash.se>
date Sun, 03 Jun 2018 02:18:02 +0200
parents 82689acd1294
children 284d8c18060e
comparison
equal deleted inserted replaced
3147:82689acd1294 3148:8c7b8b2c3237
88 end 88 end
89 89
90 json_out = json.encode(json_out) 90 json_out = json.encode(json_out)
91 local url = routing[from_room]; 91 local url = routing[from_room];
92 module:log("debug", "message from %s in %s to %s", from_nick, from_room, url); 92 module:log("debug", "message from %s in %s to %s", from_nick, from_room, url);
93 if url == "DEBUG" then
94 module:log("debug", "json_out = %s", json_out);
95 return;
96 end
93 local headers = { 97 local headers = {
94 ["Content-Type"] = "application/json", 98 ["Content-Type"] = "application/json",
95 }; 99 };
96 http.request(url, { method = "POST", body = json_out, headers = headers }, postcallback) 100 http.request(url, { method = "POST", body = json_out, headers = headers }, postcallback)
97 end 101 end