Add a check for non-existent hash
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
parent
9c41348338
commit
ba91151766
1 changed files with 18 additions and 18 deletions
|
@ -46,28 +46,30 @@ proc updateHandler(b: Telebot, u: Update): Future[bool] {.async, gcsafe.} =
|
||||||
discard await b.sendMessage(response.chat.id, "Hey, To create a censored post, you can share any album, video, photo, gif, sticker, etc. The messages could then be forwarded to any chat for them to view")
|
discard await b.sendMessage(response.chat.id, "Hey, To create a censored post, you can share any album, video, photo, gif, sticker, etc. The messages could then be forwarded to any chat for them to view")
|
||||||
elif message.contains("/ban"):
|
elif message.contains("/ban"):
|
||||||
let user = message.split(" ")
|
let user = message.split(" ")
|
||||||
echo "BANNING"
|
|
||||||
var BannedUser = NewBannedUsers(user[1])
|
var BannedUser = NewBannedUsers(user[1])
|
||||||
with dbConn:
|
with dbConn:
|
||||||
insert BannedUser
|
insert BannedUser
|
||||||
discard await b.sendMessage(response.chat.id, "Banned!")
|
discard await b.sendMessage(response.chat.id, "Banned!")
|
||||||
elif message.contains("/start"):
|
elif message.contains("/start"):
|
||||||
let deeplink = message.split(" ")
|
let deeplink = message.split(" ")
|
||||||
var TempData = @[NewCensoredData()]
|
if not dbConn.exists(CensoredData, "fhash = ?", deeplink[1]):
|
||||||
dbConn.select(TempData, "fhash = ?", deeplink[1])
|
discard await b.sendMessage(response.chat.id, "Media does not exist on database, ask the sender to censor this again!")
|
||||||
for i in TempData:
|
else:
|
||||||
if i.ftype == "photo":
|
var TempData = @[NewCensoredData()]
|
||||||
discard await b.sendPhoto(response.chat.id, i.fileid, i.caption)
|
dbConn.select(TempData, "fhash = ?", deeplink[1])
|
||||||
elif i.ftype == "document":
|
for i in TempData:
|
||||||
discard await b.sendDocument(response.chat.id, i.fileid, i.caption)
|
if i.ftype == "photo":
|
||||||
elif i.ftype == "video":
|
discard await b.sendPhoto(response.chat.id, i.fileid, i.caption)
|
||||||
discard await b.sendVideo(response.chat.id, i.fileid, caption=i.caption)
|
elif i.ftype == "document":
|
||||||
elif i.ftype == "videonote":
|
discard await b.sendDocument(response.chat.id, i.fileid, i.caption)
|
||||||
discard await b.sendVideoNote(response.chat.id, i.fileid)
|
elif i.ftype == "video":
|
||||||
elif i.ftype == "animation":
|
discard await b.sendVideo(response.chat.id, i.fileid, caption=i.caption)
|
||||||
discard await b.sendAnimation(response.chat.id, i.fileid, caption=i.caption)
|
elif i.ftype == "videonote":
|
||||||
elif i.ftype == "sticker":
|
discard await b.sendVideoNote(response.chat.id, i.fileid)
|
||||||
discard await b.sendSticker(response.chat.id, i.fileid)
|
elif i.ftype == "animation":
|
||||||
|
discard await b.sendAnimation(response.chat.id, i.fileid, caption=i.caption)
|
||||||
|
elif i.ftype == "sticker":
|
||||||
|
discard await b.sendSticker(response.chat.id, i.fileid)
|
||||||
else:
|
else:
|
||||||
var fileid = ""
|
var fileid = ""
|
||||||
var ftype = ""
|
var ftype = ""
|
||||||
|
@ -92,8 +94,6 @@ proc updateHandler(b: Telebot, u: Update): Future[bool] {.async, gcsafe.} =
|
||||||
elif response.sticker.isSome:
|
elif response.sticker.isSome:
|
||||||
fileid = response.sticker.get.fileId
|
fileid = response.sticker.get.fileId
|
||||||
ftype = "sticker"
|
ftype = "sticker"
|
||||||
elif response.mediaGroupId.isSome:
|
|
||||||
fileid = response.mediaGroupId.get
|
|
||||||
|
|
||||||
let filehash = generate_hash()
|
let filehash = generate_hash()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue