diff --git a/src/nim_censor_bot.nim b/src/nim_censor_bot.nim index d1de045..88eec0e 100644 --- a/src/nim_censor_bot.nim +++ b/src/nim_censor_bot.nim @@ -27,8 +27,8 @@ let AdminID = getEnv("ADMIN_ID").split(",") let dbConn* = getDb() -func NewCensoredData*(ftype = ""; fhash = ""; fileid = ""; caption = ""): - CensoredData = CensoredData(ftype: ftype, fhash: fhash, fileid: fileid, caption: caption) +func NewCensoredData*(ftype = ""; fhash = ""; fileid = ""; time = 0.0; caption = ""): + CensoredData = CensoredData(ftype: ftype, fhash: fhash, fileid: fileid, time: time, caption: caption) func NewBannedUsers*(userid = int64(0), bantime = 0.0, bantype = ""): BannedUsers = BannedUsers(userid: userid, bantime: bantime, bantype: bantype) @@ -143,19 +143,19 @@ proc updateHandler(b: Telebot, u: Update): Future[bool] {.async, gcsafe.} = if parseInt(response.mediaGroupId.get) notin GroupMedia.keys().toSeq(): let filehash = generate_hash() GroupMedia[parseInt(response.mediaGroupId.get)] = filehash - var CensoredRow = NewCensoredData(ftype, filehash, fileid, fcaption) + var CensoredRow = NewCensoredData(ftype, filehash, fileid, epochTime(), fcaption) with dbConn: insert CensoredRow discard await b.sendMessage(response.chat.id, "Censored --> " & "tg://resolve?domain=botbotbotnotabot&start=" & filehash) else: let filehash = GroupMedia[parseInt(response.mediaGroupId.get)] - var CensoredRow = NewCensoredData(ftype, filehash, fileid, fcaption) + var CensoredRow = NewCensoredData(ftype, filehash, fileid, epochTime(), fcaption) with dbConn: insert CensoredRow else: let filehash = generate_hash() - var CensoredRow = NewCensoredData(ftype, filehash, fileid, fcaption) + var CensoredRow = NewCensoredData(ftype, filehash, fileid, epochTime(), fcaption) with dbConn: insert CensoredRow discard await b.sendMessage(response.chat.id, "Censored --> " & "tg://resolve?domain=botbotbotnotabot&start=" & filehash)