commit 869062dd20477fd436b2b6e51c81613a9135e9ba
parent 22842ec841f2dd52a854717951f4f2e6565a5f66
Author: Milan Pässler <me@pbb.lc>
Date: Thu, 30 Jan 2020 15:14:26 +0100
parent 22842ec841f2dd52a854717951f4f2e6565a5f66
Author: Milan Pässler <me@pbb.lc>
Date: Thu, 30 Jan 2020 15:14:26 +0100
meow back with 20% chance
2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/src/cmd/yesorno.nim b/src/cmd/yesorno.nim @@ -1,8 +1,5 @@ import asyncdispatch, telebot, strutils, random -#init rng -randomize() - proc yesornoCommand(bot: Telebot, command: Command) {.async.} = let random = rand(-8..8) let maybe = ["maybe", "dunno", "perhabs", "…", "idk", "I have no idea", "mrew", "mew", "meow", "use TOR, use Signal"]
diff --git a/src/ctucxbot.nim b/src/ctucxbot.nim @@ -1,6 +1,9 @@ import asyncdispatch, telebot, options, strutils, random, os, re, unicode include cmd/[animalpics, daysuntilcongress, debuginfo, help, stats, unixtime, utc, uptime, yesorno, whoami, invitelinks, sarcasm, httpstatuscode] +#init rng +randomize() + proc ctrlcHandler() {.noconv.} = quit() @@ -22,22 +25,22 @@ proc updateHandler(bot: Telebot, update: Update) {.async.} = ] let meowAnswers = [ - "meow!", - "Meow!", - "Mew!", - "mew!", - "meow", - "Meow", - "Mew", - "mew", - "mreow!", - "Mreow!", - "Mrew!", - "mrew!", - "mreow", - "Mreow", - "Mrew", - "mrew", + "meow USER!", + "Meow USER!", + "Mew USER!", + "mew USER!", + "meow USER", + "Meow USER", + "Mew USER", + "mew USER", + "mreow USER!", + "Mreow USER!", + "Mrew USER!", + "mrew USER!", + "mreow USER", + "Mreow USER", + "Mrew USER", + "mrew USER", ] let penisCount = text.normalize.count("penis") @@ -70,9 +73,9 @@ 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)) + #meow back at people with a 20% chance + if (rand(100) < 20 or message.chat.kind == "private") and text.contains(re(r"^mr*(a+u+|e*[eo]o*w+)!*$", {reIgnoreCase})): + var response = newMessage(message.chat.id, sample(meowAnswers).replace("USER", message.fromUser.get.firstName)) response.replyToMessageId = message.messageId discard await bot.send(response)