plugins.issues: Avoid triggering on #number at the end of a word (eg URLs)

Thu, 31 May 2018 01:03:21 +0200

author
Kim Alvefur <zash@zash.se>
date
Thu, 31 May 2018 01:03:21 +0200
changeset 147
7ab078186587
parent 146
e545ba65c9ef
child 148
9245b1d8a818

plugins.issues: Avoid triggering on #number at the end of a word (eg URLs)

plugins/issues.lua file | annotate | diff | comparison | revisions
--- a/plugins/issues.lua	Thu May 31 00:59:20 2018 +0200
+++ b/plugins/issues.lua	Thu May 31 01:03:21 2018 +0200
@@ -53,7 +53,7 @@
 	end);
 
 	local function check_for_issue_id(message)
-		local issue_id = message.body and message.body:match"#(%d+)";
+		local issue_id = message.body and message.body:match"^#(%d+)" or message.body:match"%s#(%d+)";
 		if issue_id then
 			return bot:event("commands/issue", { param = issue_id, reply = message.reply, room = message.room });
 		end

mercurial