Use elif blocks instead of falling through each if

It cannot be a video and photo at the same time

Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
baalajimaestro 2022-04-09 22:26:19 +05:30
parent 6c0db09773
commit 5be6fb18ba
Signed by: baalajimaestro
GPG key ID: F93C394FE9BBAFD5

View file

@ -41,19 +41,19 @@ proc updateHandler(b: Telebot, u: Update): Future[bool] {.async, gcsafe.} =
if response.document.isSome: if response.document.isSome:
fileid = response.document.get.fileId fileid = response.document.get.fileId
ftype = "document" ftype = "document"
if response.video.isSome: elif response.video.isSome:
fileid = response.video.get.fileId fileid = response.video.get.fileId
ftype = "video" ftype = "video"
if response.videoNote.isSome: elif response.videoNote.isSome:
fileid = response.videoNote.get.fileId fileid = response.videoNote.get.fileId
ftype = "videonote" ftype = "videonote"
if response.animation.isSome: elif response.animation.isSome:
fileid = response.animation.get.fileId fileid = response.animation.get.fileId
ftype = "animation" ftype = "animation"
if response.photo.isSome: elif response.photo.isSome:
fileid = response.photo.get[0].fileId fileid = response.photo.get[0].fileId
ftype = "photo" ftype = "photo"
if response.mediaGroupId.isSome: elif response.mediaGroupId.isSome:
fileid = response.mediaGroupId.get fileid = response.mediaGroupId.get
let filehash = generate_hash() let filehash = generate_hash()