Source code command to make the user clear on the bot source
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
parent
af6d4d68ab
commit
010c834aac
1 changed files with 15 additions and 2 deletions
|
@ -96,7 +96,7 @@ proc startHandler(b: Telebot, c: Command): Future[bool] {.gcsafe, async.} =
|
|||
else:
|
||||
RateLimiter[c.message.chat.id] = @[epochTime()]
|
||||
if param == "":
|
||||
discard await b.sendMessage(c.message.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(c.message.chat.id, "Hey, To create a censored post, you can share any album, video, photo, gif, sticker, etc. The response of the bot can be used to share the media with other chats.")
|
||||
else:
|
||||
if not dbConn.exists(CensoredData, "fhash = ?", param):
|
||||
discard await b.sendMessage(c.message.chat.id, "Media does not exist on database, ask the sender to censor this again!")
|
||||
|
@ -125,6 +125,17 @@ 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)
|
||||
|
||||
# Give them source url
|
||||
proc sourceHandler(b: Telebot, c: Command): Future[bool] {.gcsafe, async.} =
|
||||
ManageRateLimit()
|
||||
if not dbConn.exists(BannedUsers, "userid = ?", c.message.chat.id):
|
||||
# Update rate-limit counter
|
||||
if RateLimiter.contains(c.message.chat.id):
|
||||
RateLimiter[c.message.chat.id].insert(epochTime())
|
||||
else:
|
||||
RateLimiter[c.message.chat.id] = @[epochTime()]
|
||||
discard await b.sendMessage(c.message.chat.id, "Hey, this bot is open-source and licensed under AGPL-v3! \n\nYou are welcome to selfhost your own instance of this bot\n\nThe source code is [here](https://git.baalajimaestro.me/baalajimaestro/nim-censor-bot)", parseMode="Markdown", disableWebPagePreview = true)
|
||||
|
||||
# UnBan Handler
|
||||
proc unbanHandler(b: Telebot, c: Command): Future[bool] {.gcsafe, async.} =
|
||||
if $c.message.chat.id in AdminID:
|
||||
|
@ -240,7 +251,8 @@ when isMainModule:
|
|||
echo "*********************"
|
||||
|
||||
var commands = @[
|
||||
BotCommand(command: "start" , description: "Start the bot!")
|
||||
BotCommand(command: "start" , description: "Start the bot!"),
|
||||
BotCommand(command: "source" , description: "Info about bot source")
|
||||
]
|
||||
|
||||
discard waitFor bot.setMyCommands(commands)
|
||||
|
@ -248,6 +260,7 @@ when isMainModule:
|
|||
bot.onCommand("start", startHandler)
|
||||
bot.onCommand("ban", banHandler)
|
||||
bot.onCommand("unban", unbanHandler)
|
||||
bot.onCommand("source", sourceHandler)
|
||||
bot.onInlineQuery(inlineHandler)
|
||||
if getEnv("HOOK_DOMAIN") != "":
|
||||
bot.startWebhook(getEnv("HOOK_SECRET"), getEnv("HOOK_DOMAIN") & "/" & getEnv("HOOK_SECRET"))
|
||||
|
|
Loading…
Reference in a new issue