Add an unban handler, helps unban mistakely auto-banned users
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
parent
11cbdcaced
commit
b90725d35b
1 changed files with 14 additions and 1 deletions
|
@ -125,7 +125,19 @@ proc startHandler(b: Telebot, c: Command): Future[bool] {.gcsafe, async.} =
|
|||
elif TempData[0].ftype == "sticker":
|
||||
discard await b.sendSticker(c.message.chat.id, TempData[0].fileid)
|
||||
|
||||
# Ban Handler
|
||||
# UnBan Handler
|
||||
proc unbanHandler(b: Telebot, c: Command): Future[bool] {.gcsafe, async.} =
|
||||
if $c.message.chat.id in AdminID:
|
||||
let user = c.params
|
||||
if dbConn.exists(BannedUsers, "userid = ?", int64(parseInt(user))):
|
||||
var TempData = @[NewBannedUsers()]
|
||||
dbConn.select(TempData, "userid = ?", int64(parseInt(user)))
|
||||
for i in TempData:
|
||||
var e = i
|
||||
dbConn.delete(e)
|
||||
discard await b.sendMessage(c.message.chat.id, "Unbanned!")
|
||||
|
||||
# ban Handler
|
||||
proc banHandler(b: Telebot, c: Command): Future[bool] {.gcsafe, async.} =
|
||||
if $c.message.chat.id in AdminID:
|
||||
let user = c.params
|
||||
|
@ -208,4 +220,5 @@ discard waitFor bot.setMyCommands(commands)
|
|||
bot.onUpdate(updateHandler)
|
||||
bot.onCommand("start", startHandler)
|
||||
bot.onCommand("ban", banHandler)
|
||||
bot.onCommand("unban", unbanHandler)
|
||||
bot.poll(timeout=300)
|
||||
|
|
Loading…
Reference in a new issue