From 5be6fb18ba72142224e0130f911cb3b0cebc599e Mon Sep 17 00:00:00 2001 From: baalajimaestro Date: Sat, 9 Apr 2022 22:26:19 +0530 Subject: [PATCH] Use elif blocks instead of falling through each if It cannot be a video and photo at the same time Signed-off-by: baalajimaestro --- src/nim_censor_bot.nim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/nim_censor_bot.nim b/src/nim_censor_bot.nim index 828463d..027912a 100644 --- a/src/nim_censor_bot.nim +++ b/src/nim_censor_bot.nim @@ -41,19 +41,19 @@ proc updateHandler(b: Telebot, u: Update): Future[bool] {.async, gcsafe.} = if response.document.isSome: fileid = response.document.get.fileId ftype = "document" - if response.video.isSome: + elif response.video.isSome: fileid = response.video.get.fileId ftype = "video" - if response.videoNote.isSome: + elif response.videoNote.isSome: fileid = response.videoNote.get.fileId ftype = "videonote" - if response.animation.isSome: + elif response.animation.isSome: fileid = response.animation.get.fileId ftype = "animation" - if response.photo.isSome: + elif response.photo.isSome: fileid = response.photo.get[0].fileId ftype = "photo" - if response.mediaGroupId.isSome: + elif response.mediaGroupId.isSome: fileid = response.mediaGroupId.get let filehash = generate_hash()