Changeset

3095:3a6a48b83b4f

mod_slack_webhooks: Reduce scope of variable
author Kim Alvefur <zash@zash.se>
date Sat, 02 Jun 2018 15:00:27 +0200
parents 3094:39d714abbc2b
children 3096:420391fd56e5
files mod_slack_webhooks/mod_slack_webhooks.lua
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_slack_webhooks/mod_slack_webhooks.lua	Sat Jun 02 14:59:09 2018 +0200
+++ b/mod_slack_webhooks/mod_slack_webhooks.lua	Sat Jun 02 15:00:27 2018 +0200
@@ -93,7 +93,6 @@
 	local headers = request.headers;
 
 	local body_type = headers.content_type;
-	local message;
 	local post_body;
 	if body_type == "application/x-www-form-urlencoded" then
 		post_body = formdecode(request.body)["payload"];
@@ -113,7 +112,7 @@
 	local sender = jid.join(path, module.host, from_nick);
 	module:log("debug", "message to %s from %s", bare_room, sender);
 	module:log("debug", "body: %s", post_body["text"]);
-	message = msg({ to = bare_room, from = sender, type = "groupchat", id="webhookbot" .. now()},post_body["text"]);
+	local message = msg({ to = bare_room, from = sender, type = "groupchat", id="webhookbot" .. now()},post_body["text"]);
 	dest_room:broadcast_message(message, true);
 	return 201;
 end