import telebot, asyncdispatch, logging, options, strutils
const TOKEN_API = "" # secret key
proc updateHandler(b: Telebot, u: Update): Future[bool] {.gcsafe, async.} =
var response = u.message.get
if response.text.isSome:
let
text = response.text.get
var
google = initInlineKeyboardButton("Google", url = "https://www.google.com/search?q=" & text)
bing = initInlineKeyboardButton("Bing", url = "https://www.bing.com/search?q=" & text)
ddg = initInlineKeyboardButton("DuckDuckGo", url = "https://duckduckgo.com/?q=" & text)
searx = initInlineKeyboardButton("searx.me", url = "https://searx.me/?q=" & text)
let replyMarkup = newInlineKeyboardMarkup(@[google, bing], @[ddg, searx])
discard await b.sendMessage(response.chat.id, text, replyMarkup = replyMarkup)
when isMainModule:
let bot = newTeleBot(TOKEN_API)
bot.onUpdate(updateHandler)
bot.poll(timeout=300)
Good afternoon, can you please tell me what I am doing wrong?
I run the script with nim r -d:ssl main.nim
But still, when I write something to the bot, it sends me echo text , without creating inline buttons.
Good afternoon, can you please tell me what I am doing wrong? I run the script with nim r -d:ssl main.nim But still, when I write something to the bot, it sends me echo text , without creating inline buttons.