Dont make db calls if the inline query is null
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
parent
4b0974bfa1
commit
33894b0501
1 changed files with 23 additions and 18 deletions
|
@ -187,6 +187,7 @@ proc inlineHandler(b: Telebot, u: InlineQuery): Future[bool]{.async.} =
|
||||||
var results: seq[InlineQueryResultArticle]
|
var results: seq[InlineQueryResultArticle]
|
||||||
res.kind = "article"
|
res.kind = "article"
|
||||||
res.id = "1"
|
res.id = "1"
|
||||||
|
if u.query != "":
|
||||||
if not dbConn.exists(CensoredData, "fhash = ?",u.query):
|
if not dbConn.exists(CensoredData, "fhash = ?",u.query):
|
||||||
res.title = "Media Not Found"
|
res.title = "Media Not Found"
|
||||||
res.inputMessageContent = InputTextMessageContent(
|
res.inputMessageContent = InputTextMessageContent(
|
||||||
|
@ -206,6 +207,10 @@ proc inlineHandler(b: Telebot, u: InlineQuery): Future[bool]{.async.} =
|
||||||
u.query &
|
u.query &
|
||||||
")",
|
")",
|
||||||
parseMode: some("Markdown")).some
|
parseMode: some("Markdown")).some
|
||||||
|
else:
|
||||||
|
res.title = "Waiting for File Hash"
|
||||||
|
res.inputMessageContent = InputTextMessageContent(
|
||||||
|
"Provide the filehash on inline query").some
|
||||||
results.add(res)
|
results.add(res)
|
||||||
discard await b.answerInlineQuery(u.id, results)
|
discard await b.answerInlineQuery(u.id, results)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue