Use PascalCase instead of SNAKE_CASE

Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
baalajimaestro 2022-04-09 20:48:41 +05:30
parent 373d3da86f
commit b92cce96b5
Signed by: baalajimaestro
GPG key ID: F93C394FE9BBAFD5

View file

@ -1,18 +1,18 @@
import telebot, std/[asyncdispatch, logging, options, strutils, random, with, os], norm/[model, sqlite] import telebot, std/[asyncdispatch, logging, options, strutils, random, with, os], norm/[model, sqlite]
type type
CENSORED_DATA* = ref object of Model CensoredData* = ref object of Model
ftype*: string ftype*: string
fhash*: string fhash*: string
fileid*: string fileid*: string
caption*: string caption*: string
func newCENSORED_DATA*(ftype = ""; fhash = ""; fileid = ""; caption = ""): func NewCensoredData*(ftype = ""; fhash = ""; fileid = ""; caption = ""):
CENSORED_DATA = CENSORED_DATA(ftype: ftype, fhash: fhash, fileid: fileid, caption: caption) CensoredData = CensoredData(ftype: ftype, fhash: fhash, fileid: fileid, caption: caption)
let dbConn* = sqlite.open("censordata.db", "", "", "") let dbConn* = sqlite.open("censordata.db", "", "", "")
dbConn.createTables(newCENSORED_DATA()) dbConn.createTables(NewCensoredData())
var L = newConsoleLogger(fmtStr="$levelname, [$time] ") var L = newConsoleLogger(fmtStr="$levelname, [$time] ")
addHandler(L) addHandler(L)
@ -30,27 +30,27 @@ proc updateHandler(b: Telebot, u: Update): Future[bool] {.async, gcsafe.} =
var response = u.message.get var response = u.message.get
if response.document.isSome: if response.document.isSome:
let filehash = generate_hash() let filehash = generate_hash()
var censordoc = newCENSORED_DATA("document", filehash, response.document.get.fileId, "") var censordoc = NewCensoredData("document", filehash, response.document.get.fileId, "")
with dbConn: with dbConn:
insert censordoc insert censordoc
if response.video.isSome: if response.video.isSome:
let filehash = generate_hash() let filehash = generate_hash()
var censorvid = newCENSORED_DATA("video", filehash, response.video.get.fileId, "") var censorvid = NewCensoredData("video", filehash, response.video.get.fileId, "")
with dbConn: with dbConn:
insert censorvid insert censorvid
if response.videoNote.isSome: if response.videoNote.isSome:
let filehash = generate_hash() let filehash = generate_hash()
var censorvidnote = newCENSORED_DATA("videonote", filehash, response.videoNote.get.fileId, "") var censorvidnote = NewCensoredData("videonote", filehash, response.videoNote.get.fileId, "")
with dbConn: with dbConn:
insert censorvidnote insert censorvidnote
if response.animation.isSome: if response.animation.isSome:
let filehash = generate_hash() let filehash = generate_hash()
var censoranimation = newCENSORED_DATA("animation", filehash, response.animation.get.fileId, "") var censoranimation = NewCensoredData("animation", filehash, response.animation.get.fileId, "")
with dbConn: with dbConn:
insert censoranimation insert censoranimation
if response.photo.isSome: if response.photo.isSome:
let filehash = generate_hash() let filehash = generate_hash()
var censorphoto = newCENSORED_DATA("photo", filehash, response.photo.get[0].fileId, "") var censorphoto = NewCensoredData("photo", filehash, response.photo.get[0].fileId, "")
with dbConn: with dbConn:
insert censorphoto insert censorphoto