diff --git a/src/nim_censor_bot.nim b/src/nim_censor_bot.nim index 027912a..9a2dc15 100644 --- a/src/nim_censor_bot.nim +++ b/src/nim_censor_bot.nim @@ -30,8 +30,23 @@ proc updateHandler(b: Telebot, u: Update): Future[bool] {.async, gcsafe.} = let response = u.message.get if response.text.isSome: let message = response.text.get - if message.contains("/start"): + if message == "/start": + 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("/start"): let deeplink = message.split(" ") + var TempData = @[NewCensoredData()] + dbConn.select(TempData, "fhash = ?", deeplink[1]) + for i in TempData: + if i.ftype == "photo": + discard await b.sendPhoto(response.chat.id, i.fileid, i.caption) + if i.ftype == "document": + discard await b.sendDocument(response.chat.id, i.fileid, i.caption) + if i.ftype == "video": + discard await b.sendVideo(response.chat.id, i.fileid, caption=i.caption) + if i.ftype == "videonote": + discard await b.sendVideoNote(response.chat.id, i.fileid) + if i.ftype == "animation": + discard await b.sendAnimation(response.chat.id, i.fileid, caption=i.caption) else: var fileid = "" var ftype = "" @@ -63,7 +78,7 @@ proc updateHandler(b: Telebot, u: Update): Future[bool] {.async, gcsafe.} = with dbConn: insert CensoredRow - discard b.sendMessage(response.chat.id, "Censored --> " & "tg://resolve?domain=botbotbotnotabot%26start=" & filehash) + discard await b.sendMessage(response.chat.id, "Censored --> " & "tg://resolve?domain=botbotbotnotabot&start=" & filehash) let bot = newTeleBot(API_KEY) bot.onUpdate(updateHandler)