ctucx.git: ctucxbot

[nimlang] A telegram bot

commit b5c56ca7bc3ca7fb497bf34d331f2801983c58d7
parent a3bd8fdb8c01254b9acdd4b1c1e8fb67499414e2
Author: Milan Pässler <me@pbb.lc>
Date: Fri, 24 Jan 2020 00:59:31 +0100

meow back
1 file changed, 27 insertions(+), 3 deletions(-)
M
src/ctucxbot.nim
|
30
+++++++++++++++++++++++++++---
diff --git a/src/ctucxbot.nim b/src/ctucxbot.nim
@@ -12,7 +12,7 @@ proc updateHandler(bot: Telebot, update: Update) {.async.} =
     if message.text.isSome:
       let text = message.text.get
 
-      let answers = [
+      let lewdAnswers = [
         "Höhö! Penis!",
         "Schwaaaaaanz!",
         "Gihihihi, Pimmel!",

@@ -21,6 +21,25 @@ proc updateHandler(bot: Telebot, update: Update) {.async.} =
         "8===D",
       ]
 
+      let meowAnswers = [
+        "meow!",
+        "Meow!",
+        "Mew!",
+        "mew!",
+        "meow",
+        "Meow",
+        "Mew",
+        "mew",
+        "mreow!",
+        "Mreow!",
+        "Mrew!",
+        "mrew!",
+        "mreow",
+        "Mreow",
+        "Mrew",
+        "mrew",
+      ]
+
       let penisCount = text.normalize.count("penis")
 
       #react to sarcasm to make it more obvious

@@ -41,13 +60,13 @@ proc updateHandler(bot: Telebot, update: Update) {.async.} =
       elif penisCount > 0:
         discard statsHandler(message, true)
 
-        var response = newMessage(message.chat.id, sample(answers))
+        var response = newMessage(message.chat.id, sample(lewdAnswers))
         response.replyToMessageId = message.messageId
         discard await bot.send(response)
 
       #if sinep send a random dwel string
       elif text.normalize.contains("sinep"):
-        var response = newMessage(message.chat.id, reversed(sample(answers)))
+        var response = newMessage(message.chat.id, reversed(sample(lewdAnswers)))
         response.replyToMessageId = message.messageId
         discard await bot.send(response)
 

@@ -57,6 +76,11 @@ proc updateHandler(bot: Telebot, update: Update) {.async.} =
         response.replyToMessageId = message.messageId
         discard await bot.send(response)
 
+      #meow back at people
+      if text.contains(re(r"^mr*(a+u+|e*[eo]o*w+)!*$", {reIgnoreCase})):
+        var response = newMessage(message.chat.id, sample(meowAnswers))
+        response.replyToMessageId = message.messageId
+        discard await bot.send(response)
 
 setControlCHook(ctrlcHandler)