ctucx.git: ctucxbot

[nimlang] A telegram bot

commit 2c36682884266bcc2514af87d21b89184b5accb8
parent 05183127c03a75200f99e6d8c6585e008539bc31
Author: ctucx <c@ctu.cx>
Date: Wed, 15 Jan 2020 23:18:30 +0100

better regex to detect sarcasm
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ctucxbot.nim b/src/ctucxbot.nim
@@ -23,7 +23,7 @@ proc updateHandler(bot: Telebot, update: Update) {.async.} =
       let penisCount = text.normalize.count("penis")
 
       #react to sarcasm to make it more obvious
-      if text.contains(re"\/s"):
+      if text.contains(re"(^|[\s(])/s\b"):
         var response = newSticker(message.chat.id, "file://" & getCurrentDir() & "/data/pics/sarcasm_sign.webp")
         response.replyToMessageId = message.messageId
         discard await bot.send(response)