ctucx.git: ctucxbot

[nimlang] A telegram bot

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 import asyncdispatch, telebot, strutils, options

proc whoamiCommand* (bot: Telebot, command: Command): Future[bool] {.async.} =
  var text = "who are you?"

  let user = command.message.fromUser.get

  if user.username.isSome():
    text = "you are @" & user.username.get & ", nice to meet you!"

  discard await bot.sendMessage(command.message.chat.id, text, replyToMessageId = command.message.messageId, parseMode = "markdown")