18 lines
659 B
Nim
18 lines
659 B
Nim
|
import telebot, asyncdispatch, logging, options, strutils
|
||
|
var L = newConsoleLogger(fmtStr="$levelname, [$time] ")
|
||
|
addHandler(L)
|
||
|
|
||
|
# remember to strip your secret key to avoid HTTP error
|
||
|
const API_KEY = ""
|
||
|
|
||
|
proc updateHandler(b: Telebot, u: Update): Future[bool] {.async.} =
|
||
|
var response = u.message.get
|
||
|
if response.photo.isSome:
|
||
|
discard await b.sendPhoto(response.chat.id, response.photo.get[0].fileId)
|
||
|
echo "Found file"
|
||
|
#discard await b.sendMessage(response.chat.id, text, parseMode = "markdown", disableNotification = true, replyToMessageId = response.messageId)
|
||
|
|
||
|
let bot = newTeleBot(API_KEY)
|
||
|
bot.onUpdate(updateHandler)
|
||
|
bot.poll(timeout=300)
|