All Projects → ba0f3 → Telebot.nim

ba0f3 / Telebot.nim

Licence: mit
Async client for Telegram Bot API in pure Nim [Bot API 5.1]

Programming Languages

nim
578 projects

Projects that are alternatives of or similar to Telebot.nim

Telebot
Write Telegram bots in Rust with Tokio and Futures
Stars: ✭ 179 (+92.47%)
Mutual labels:  bot, telegram-bot, async, chat, telegram
Java Telegram Bot Tutorial
Java Telegram Bot Tutorial. Feel free to submit issue if you found a mistake.
Stars: ✭ 165 (+77.42%)
Mutual labels:  telegram-bot-api, bot, telegram-bot, telegram
Bot Telegram
Exemplo de como criar um BOT para o melhor app de mensagens do mundo: Telegram.
Stars: ✭ 53 (-43.01%)
Mutual labels:  telegram-bot-api, bot, telegram-bot, telegram
Novagram
An Object-Oriented PHP library for Telegram Bots
Stars: ✭ 112 (+20.43%)
Mutual labels:  api, bot, telegram-bot, telegram
Zanzara
Asynchronous PHP Telegram Bot Framework built on top of ReactPHP
Stars: ✭ 107 (+15.05%)
Mutual labels:  telegram-bot-api, bot, telegram-bot, telegram
Telegram Bot Sdk
🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
Stars: ✭ 2,212 (+2278.49%)
Mutual labels:  telegram-bot-api, bot, telegram-bot, telegram
Telebot
The easy way to write Telegram bots in Node.js
Stars: ✭ 1,096 (+1078.49%)
Mutual labels:  telegram-bot-api, bot, telegram-bot, telegram
Telegram.bot
.NET Client for Telegram Bot API
Stars: ✭ 1,964 (+2011.83%)
Mutual labels:  telegram-bot-api, bot, telegram-bot, telegram
Telegram Bot
Ruby gem for building Telegram Bot with optional Rails integration
Stars: ✭ 433 (+365.59%)
Mutual labels:  bot, telegram-bot, async, telegram
Twitchlib
C# Twitch Chat, Whisper, API and PubSub Library. Allows for chatting, whispering, stream event subscription and channel/account modification. Supports .NET Core 2.0
Stars: ✭ 519 (+458.06%)
Mutual labels:  api, bot, chat, client
Informer
A Telegram Mass Surveillance Bot in Python
Stars: ✭ 745 (+701.08%)
Mutual labels:  telegram-bot-api, bot, telegram-bot, telegram
Mypackbot
🤖 Your own unlimited pack of Telegram-stickers
Stars: ✭ 18 (-80.65%)
Mutual labels:  telegram-bot-api, bot, telegram-bot, telegram
Ex gram
Telegram Bot API low level API and framework
Stars: ✭ 103 (+10.75%)
Mutual labels:  api, telegram-bot-api, bot, telegram
Groupbutler
This bot can help you in managing your group with rules, anti-flood, description, custom triggers, and much more!
Stars: ✭ 399 (+329.03%)
Mutual labels:  bot, telegram-bot, chat, telegram
Java Telegram Bot Api
Telegram Bot API for Java
Stars: ✭ 819 (+780.65%)
Mutual labels:  telegram-bot-api, bot, telegram-bot, telegram
Spytrojan keylogger
[Solo para programadores] Troyano espía | Keylogger solo para Windows, se replica en el sistema y se inicia automaticamente al iniciar sesión. | Envío de registro mediante [Base de Datos], [Gmail] o [BotTelegram].
Stars: ✭ 32 (-65.59%)
Mutual labels:  telegram-bot-api, bot, telegram-bot, telegram
Nikoro
A plugin-based, all-in-one, Telegram Bot written in Node.js
Stars: ✭ 51 (-45.16%)
Mutual labels:  bot, telegram-bot, telegram
Marvin
The paranoid bot (framework)
Stars: ✭ 51 (-45.16%)
Mutual labels:  bot, telegram-bot, telegram
Telepyth
Telegram notification with IPython magics.
Stars: ✭ 54 (-41.94%)
Mutual labels:  bot, telegram-bot, telegram
Telegram Test Api
Simple implimentation of telegram API which can be used for testing telegram bots
Stars: ✭ 42 (-54.84%)
Mutual labels:  api, bot, telegram

telebot.nim

Async Telegram Bot API Client implement in @Nim-Lang

Notes

From version 1.0.0, procs likes newMessage, newPhoto,.. are gone, use sendMessage, sendDocument instead. If you still prefer the old/ugly way to send stuffs, just import telebot/compat for backward compatible

Installation

$ nimble install telebot

Usage

echo bot

import telebot, asyncdispatch, logging, options
var L = newConsoleLogger(fmtStr="$levelname, [$time] ")
addHandler(L)

const API_KEY = slurp("secret.key")

proc updateHandler(b: Telebot, u: Update): Future[bool] {.async.} =
  if not u.message.isSome:
    # return true will make bot stop process other callbacks
    return true
  var response = u.message.get
  if response.text.isSome:
    let text = response.text.get
    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)

send local photo

import telebot, asyncdispatch, options, logging

const API_KEY = slurp("secret.key")

proc updateHandler(bot: TeleBot, update: Update): Future[bool] {.async.} =
  discard await bot.sendPhoto(response.chat.id, "file:///path/to/photo.jpg")

let bot = newTeleBot(API_KEY)
bot.onUpdate(updateHandler)
bot.poll(timeout=300)

For more information please refer to official Telegram Bot API page

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].