Root Commit
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
commit
3b1d344fb9
3 changed files with 32 additions and 0 deletions
1
nim.cfg
Normal file
1
nim.cfg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
-d:ssl
|
14
nim_censor_bot.nimble
Normal file
14
nim_censor_bot.nimble
Normal 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
17
src/nim_censor_bot.nim
Normal 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)
|
Loading…
Reference in a new issue