ctucx.git: ctucxbot

[nimlang] A telegram bot

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
import asyncdispatch, telebot, strutils, random

proc yesornoCommand* (bot: Telebot, command: Command): Future[bool] {.async.} =
  let random = rand(-8..8)
  let maybe  = ["maybe", "dunno", "perhabs", "…", "idk", "I have no idea", "mrew", "mew", "meow", "use TOR, use Signal"]

  var answer = ""

  if random < 0:
    answer = "no"
  elif random > 0:
    answer = "yes"
  else:
    let num = rand(maybe.len) - 1

    answer = maybe[num]
  
  discard await bot.sendMessage(command.message.chat.id, answer, replyToMessageId = command.message.messageId, parseMode = "markdown")