Skip to content

Commit

Permalink
Add example for ForceReply markup
Browse files Browse the repository at this point in the history
  • Loading branch information
ba0f3 committed Aug 7, 2023
1 parent a50f043 commit 3fd1fc4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions examples/force_reply.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import telebot, asyncdispatch, logging, options
from strutils import strip

var L = newConsoleLogger()
addHandler(L)

const API_KEY = slurp("secret.key").strip()

proc updateHandler(b: Telebot, u: Update): Future[bool] {.gcsafe, async.} =
var response = u.message.get
if response.text.isSome:
let
text = response.text.get
replyMarkup = newForceReply(true, "Input:")

discard await b.sendMessage(response.chat.id, text, replyMarkup = replyMarkup)

when isMainModule:
let bot = newTeleBot(API_KEY)

bot.onUpdate(updateHandler)
bot.poll(timeout=300)

0 comments on commit 3fd1fc4

Please sign in to comment.