Root Commit

Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
baalajimaestro 2022-04-07 16:21:02 +05:30
commit 3b1d344fb9
Signed by: baalajimaestro
GPG key ID: F93C394FE9BBAFD5
3 changed files with 32 additions and 0 deletions

1
nim.cfg Normal file
View file

@ -0,0 +1 @@
-d:ssl

14
nim_censor_bot.nimble Normal file
View file

@ -0,0 +1,14 @@
# Package
version = "0.1.0"
author = "baalajimaestro"
description = "Censor Bot for Telegram written in Nim"
license = "AGPL-3.0-or-later"
srcDir = "src"
bin = @["nim_censor_bot"]
# Dependencies
requires "nim >= 1.6.0"
requires "telebot"

17
src/nim_censor_bot.nim Normal file
View file

@ -0,0 +1,17 @@
import telebot, asyncdispatch, logging, options, strutils
var L = newConsoleLogger(fmtStr="$levelname, [$time] ")
addHandler(L)
# remember to strip your secret key to avoid HTTP error
const API_KEY = ""
proc updateHandler(b: Telebot, u: Update): Future[bool] {.async.} =
var response = u.message.get
if response.photo.isSome:
discard await b.sendPhoto(response.chat.id, response.photo.get[0].fileId)
echo "Found file"
#discard await b.sendMessage(response.chat.id, text, parseMode = "markdown", disableNotification = true, replyToMessageId = response.messageId)
let bot = newTeleBot(API_KEY)
bot.onUpdate(updateHandler)
bot.poll(timeout=300)