Move the censoring logic to else clause
We dont ideally need this check when there is just plaintext Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
parent
2f859b5735
commit
6c0db09773
1 changed files with 29 additions and 24 deletions
|
@ -32,6 +32,7 @@ proc updateHandler(b: Telebot, u: Update): Future[bool] {.async, gcsafe.} =
|
||||||
let message = response.text.get
|
let message = response.text.get
|
||||||
if message.contains("/start"):
|
if message.contains("/start"):
|
||||||
let deeplink = message.split(" ")
|
let deeplink = message.split(" ")
|
||||||
|
else:
|
||||||
var fileid = ""
|
var fileid = ""
|
||||||
var ftype = ""
|
var ftype = ""
|
||||||
var fcaption = ""
|
var fcaption = ""
|
||||||
|
@ -52,6 +53,8 @@ proc updateHandler(b: Telebot, u: Update): Future[bool] {.async, gcsafe.} =
|
||||||
if response.photo.isSome:
|
if response.photo.isSome:
|
||||||
fileid = response.photo.get[0].fileId
|
fileid = response.photo.get[0].fileId
|
||||||
ftype = "photo"
|
ftype = "photo"
|
||||||
|
if response.mediaGroupId.isSome:
|
||||||
|
fileid = response.mediaGroupId.get
|
||||||
|
|
||||||
let filehash = generate_hash()
|
let filehash = generate_hash()
|
||||||
|
|
||||||
|
@ -60,6 +63,8 @@ proc updateHandler(b: Telebot, u: Update): Future[bool] {.async, gcsafe.} =
|
||||||
with dbConn:
|
with dbConn:
|
||||||
insert CensoredRow
|
insert CensoredRow
|
||||||
|
|
||||||
|
discard b.sendMessage(response.chat.id, "Censored --> " & "tg://resolve?domain=botbotbotnotabot%26start=" & filehash)
|
||||||
|
|
||||||
let bot = newTeleBot(API_KEY)
|
let bot = newTeleBot(API_KEY)
|
||||||
bot.onUpdate(updateHandler)
|
bot.onUpdate(updateHandler)
|
||||||
bot.poll(timeout=300)
|
bot.poll(timeout=300)
|
||||||
|
|
Loading…
Reference in a new issue