All Projects → edisonchee → Slimbot

edisonchee / Slimbot

Licence: mit
Telegram Bot API for Node.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Slimbot

Telegraf
Modern Telegram Bot Framework for Node.js
Stars: ✭ 5,178 (+3198.09%)
Mutual labels:  bot-api, telegram
Telegram
✈️ Telegram Notifications Channel for Laravel
Stars: ✭ 450 (+186.62%)
Mutual labels:  bot-api, telegram
Core
PHP Telegram Bot based on the official Telegram Bot API
Stars: ✭ 2,899 (+1746.5%)
Mutual labels:  bot-api, telegram
Tgfancy
A Fancy, Higher-Level Wrapper for Telegram Bot API
Stars: ✭ 131 (-16.56%)
Mutual labels:  bot-api, telegram
Botogram
Just focus on your bots.
Stars: ✭ 106 (-32.48%)
Mutual labels:  bot-api, telegram
Telegram Api
Complete async capable Telegram bot API implementation for PHP7
Stars: ✭ 650 (+314.01%)
Mutual labels:  bot-api, telegram
Pytelegrambotapi
Python Telegram bot api.
Stars: ✭ 4,986 (+3075.8%)
Mutual labels:  bot-api, telegram
Mypackbot
🤖 Your own unlimited pack of Telegram-stickers
Stars: ✭ 18 (-88.54%)
Mutual labels:  bot-api, telegram
Mattata
A powerful, plugin-based, multi-purpose Telegram bot designed to serve a wide variety of purposes
Stars: ✭ 107 (-31.85%)
Mutual labels:  bot-api, telegram
Pyrogram
Telegram MTProto API Client Library and Framework in Pure Python for Users and Bots
Stars: ✭ 2,252 (+1334.39%)
Mutual labels:  bot-api, telegram
Tascalate Concurrent
Implementation of blocking (IO-Bound) cancellable java.util.concurrent.CompletionStage and related extensions to java.util.concurrent.ExecutorService-s
Stars: ✭ 144 (-8.28%)
Mutual labels:  promise
Vue Prom
Vue promise wrapper component
Stars: ✭ 148 (-5.73%)
Mutual labels:  promise
Telegramapiserver
Fast, simple, async php telegram api server: MadelineProto + Amp HTTP Server
Stars: ✭ 152 (-3.18%)
Mutual labels:  telegram
Webapp
Tinode web chat using React
Stars: ✭ 156 (-0.64%)
Mutual labels:  telegram
Ton
Telegram Open Network research group. Telegram: https://t.me/ton_research
Stars: ✭ 146 (-7.01%)
Mutual labels:  telegram
Mux
Creates a promise that waits for the promises in nested data structures and resolves to data structures of the same form. It recursively traverses the input data structure and multiplexes its promises.
Stars: ✭ 153 (-2.55%)
Mutual labels:  promise
Telegramgo
CLI telegram client written in golang
Stars: ✭ 145 (-7.64%)
Mutual labels:  telegram
Transmission Telegram
Control your Transmission through a Telegram bot
Stars: ✭ 144 (-8.28%)
Mutual labels:  telegram
Bdreborn
An administration bot based on ➣ https://valtman.name/telegram-cli :)
Stars: ✭ 144 (-8.28%)
Mutual labels:  telegram
Tg Index
Python web app to index telegram channel and serve its files for download.
Stars: ✭ 157 (+0%)
Mutual labels:  telegram

Build Status Coverage Status MIT licensed

Slimbot

A fuss-free, thin wrapper around Telegram Bot API for Node.js. No frills.

Updated for Telegram Bot API 5.0. Works with Node 15.4.0. Runs on latest Node version 15.4.0. Tested on 10.16.0 and 12.10.0 as well.

Note: Slimbot patch versions (e.g. x.y.Z) do not track or reflect Telegram Bot API changes.

Resources

Getting started

npm i slimbot
const Slimbot = require('slimbot');
const slimbot = new Slimbot('123456789:AA...');

// Register listeners

slimbot.on('message', message => {
  slimbot.sendMessage(message.chat.id, 'Message received');
});

// Call API

slimbot.startPolling();

Now go ahead and type a message to your bot in Telegram. It should reply you with 'Message received' in the chat. Check out all other events you can listen to in the wiki.

How it works

All methods return a promise. This means you can inspect the returned objects if you want to:

slimbot.sendMessage('123456789', 'Message received')
  .then(message => {
    console.log(message);
  });

In this case, the sendMessage method returns a Message object as stated in the documentation.

You can also use callbacks instead of promises:

const Slimbot = require('./src/slimbot');
const slimbot = new Slimbot(process.env['TELEGRAM_BOT_TOKEN']);

function callback(err, obj) {
  if (err) {
    // handle error
    console.log(obj);
  }
  // handle returned object
  console.log(obj);
};

slimbot.on('message', message => {
  slimbot.sendMessage(message.chat.id, 'Message received', callback);
});

slimbot.startPolling(callback);

Examples

Documentation (Wiki)

Learn more about the implementation details in the Wiki. Feel free to contribute to the Wiki or add more examples.

Contributing

Heartfelt thanks to the following folks for making Slimbot better: @lgg @ago @rpaskin @matteocontrini @jakimenko @nahanil

The guiding principle for this library is to be as simple as possible. I put serious thought into adding features to guard against bloat. Nonetheless, I am very open to dialogue and contributions are most welcome.

If you have built a public bot using this library, send me a PM and I'll feature it here.

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].