Prepare for code cleanup and deeplink

Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
baalajimaestro 2022-04-09 21:11:01 +05:30
parent b92cce96b5
commit 63e08ca1c6
Signed by: baalajimaestro
GPG key ID: F93C394FE9BBAFD5

View file

@ -27,9 +27,14 @@ proc generate_hash(): string=
const API_KEY = getEnv("TELEGRAM_TOKEN") const API_KEY = getEnv("TELEGRAM_TOKEN")
proc updateHandler(b: Telebot, u: Update): Future[bool] {.async, gcsafe.} = proc updateHandler(b: Telebot, u: Update): Future[bool] {.async, gcsafe.} =
var response = u.message.get let response = u.message.get
if response.text.isSome:
let message = response.text.get
if message.contains("/start"):
let deeplink = message.split(" ")
var fileid = ""
let filehash = generate_hash()
if response.document.isSome: if response.document.isSome:
let filehash = generate_hash()
var censordoc = NewCensoredData("document", filehash, response.document.get.fileId, "") var censordoc = NewCensoredData("document", filehash, response.document.get.fileId, "")
with dbConn: with dbConn:
insert censordoc insert censordoc