diff --git a/nim_censor_bot.nimble b/nim_censor_bot.nimble index 86ea456..e28d3e4 100644 --- a/nim_censor_bot.nimble +++ b/nim_censor_bot.nimble @@ -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" diff --git a/src/nim_censor_bot.nim b/src/nim_censor_bot.nim index a16df9f..42f010a 100644 --- a/src/nim_censor_bot.nim +++ b/src/nim_censor_bot.nim @@ -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