Move the response to switchinline

Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
baalajimaestro 2022-04-17 15:00:51 +05:30
parent ed158f0a47
commit 5eac4c95d5
Signed by: baalajimaestro
GPG key ID: F93C394FE9BBAFD5
2 changed files with 7 additions and 3 deletions

View file

@ -11,5 +11,5 @@ bin = @["nim_censor_bot"]
# Dependencies
requires "nim >= 1.6.0"
requires "telebot >= 2022.02.02"
requires "telebot >= 2022.04.17"
requires "norm >= 2.4.0"

View file

@ -191,7 +191,9 @@ proc updateHandler(b: Telebot, u: Update): Future[bool] {.async, gcsafe.} =
var CensoredRow = NewCensoredData(ftype, filehash, fileid, epochTime(), fcaption)
with dbConn:
insert CensoredRow
discard await b.sendMessage(response.chat.id, "*Censored " & capitalizeAscii(ftype) & "*\n\n[Tap to View](tg://resolve?domain=" & b.username & "&start=" & filehash & ")", parseMode = "Markdown")
var replybutton = InlineKeyboardButton(text: "Share", switchInlineQuery: some(filehash))
let replymark = newInlineKeyboardMarkup(@[replybutton])
discard await b.sendMessage(response.chat.id, "*Censored " & capitalizeAscii(ftype) & "*", replyMarkup = replymark, parseMode="Markdown")
else:
let filehash = GroupMedia[parseInt(response.mediaGroupId.get)]
var CensoredRow = NewCensoredData(ftype, filehash, fileid, epochTime(), fcaption)
@ -203,7 +205,9 @@ proc updateHandler(b: Telebot, u: Update): Future[bool] {.async, gcsafe.} =
var CensoredRow = NewCensoredData(ftype, filehash, fileid, epochTime(), fcaption)
with dbConn:
insert CensoredRow
discard await b.sendMessage(response.chat.id, "*Censored " & capitalizeAscii(ftype) & "*\n\n[Tap to View](tg://resolve?domain=" & b.username & "&start=" & filehash & ")", parseMode = "Markdown")
var replybutton = InlineKeyboardButton(text: "Share", switchInlineQuery: some(filehash))
let replymark = newInlineKeyboardMarkup(@[replybutton])
discard await b.sendMessage(response.chat.id, "*Censored " & capitalizeAscii(ftype) & "*", replyMarkup = replymark, parseMode="Markdown")
OldDataCleanup()
# Start the bot