Lock admin actions behind a env variable

ADMIN_ID is comma-separated values of the user-ids of admins who will have access to /ban

Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
baalajimaestro 2022-04-10 23:30:15 +05:30
parent 5bf33a49ea
commit b27f910362
Signed by: baalajimaestro
GPG key ID: F93C394FE9BBAFD5

View file

@ -69,11 +69,12 @@ proc updateHandler(b: Telebot, u: Update): Future[bool] {.async, gcsafe.} =
if message == "/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") 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("/ban"): elif message.contains("/ban"):
let user = message.split(" ") if $response.chat.id in AdminID:
var BannedUser = NewBannedUsers(int64(parseInt(user[1])), epochTime(), "permanent") let user = message.split(" ")
with dbConn: var BannedUser = NewBannedUsers(int64(parseInt(user[1])), epochTime(), "permanent")
insert BannedUser with dbConn:
discard await b.sendMessage(response.chat.id, "Banned!") insert BannedUser
discard await b.sendMessage(response.chat.id, "Banned!")
elif message.contains("/start"): elif message.contains("/start"):
let deeplink = message.split(" ") let deeplink = message.split(" ")
if not dbConn.exists(CensoredData, "fhash = ?", deeplink[1]): if not dbConn.exists(CensoredData, "fhash = ?", deeplink[1]):