All Projects → lukefx → Hubot Telegram

lukefx / Hubot Telegram

Licence: mit
Hubot adapter for Telegram

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Hubot Telegram

Marvin
The paranoid bot (framework)
Stars: ✭ 51 (-66.45%)
Mutual labels:  telegram-bot, hubot, telegram
Telegram Clonebot
Simple Bot to clone Google Drive Files (or Folders) to your Team Drive[or Normal Drive]. P.S This is not a Mirror Bot. Enjoy ✌🏻
Stars: ✭ 114 (-25%)
Mutual labels:  telegram-bot, telegram
Expressbot
一个可以帮你订阅、查询快递物流、跟你闲聊Telegram机器人
Stars: ✭ 137 (-9.87%)
Mutual labels:  telegram-bot, telegram
Vk To Telegram Transfer Bot
Бот, пересылающий сообщения из чатов ВК в Telegram и обратно
Stars: ✭ 143 (-5.92%)
Mutual labels:  telegram-bot, telegram
Mattata
A powerful, plugin-based, multi-purpose Telegram bot designed to serve a wide variety of purposes
Stars: ✭ 107 (-29.61%)
Mutual labels:  telegram-bot, telegram
Novagram
An Object-Oriented PHP library for Telegram Bots
Stars: ✭ 112 (-26.32%)
Mutual labels:  telegram-bot, telegram
Telegraff
Kotlin DSL для разработки Telegram ботов
Stars: ✭ 122 (-19.74%)
Mutual labels:  telegram-bot, telegram
Telegram Bot Github
Allows to you receive GitHub notifications right in the Telegram
Stars: ✭ 103 (-32.24%)
Mutual labels:  telegram-bot, telegram
Bot Api Base
Clear and simple Telegram bot API
Stars: ✭ 122 (-19.74%)
Mutual labels:  telegram-bot, telegram
Teledart
A Dart library interfacing with the latest Telegram Bot API.
Stars: ✭ 142 (-6.58%)
Mutual labels:  telegram-bot, telegram
Botserver
http://telegram.org Bot API Webhooks Framework, for Rubyists
Stars: ✭ 125 (-17.76%)
Mutual labels:  telegram-bot, telegram
Zanzara
Asynchronous PHP Telegram Bot Framework built on top of ReactPHP
Stars: ✭ 107 (-29.61%)
Mutual labels:  telegram-bot, telegram
Hackernewsbot
📰 Telegram bot that posts new hot stories from Hacker News to telegram channel
Stars: ✭ 103 (-32.24%)
Mutual labels:  telegram-bot, telegram
Transmission Telegram
Control your Transmission through a Telegram bot
Stars: ✭ 144 (-5.26%)
Mutual labels:  telegram-bot, telegram
Vk To Telegram Bot
Bot for auto-reposting posts from VK to Telegram channel
Stars: ✭ 103 (-32.24%)
Mutual labels:  telegram-bot, telegram
Node Telegram Api
A simple API to create and control Telegram bots
Stars: ✭ 117 (-23.03%)
Mutual labels:  telegram-bot, telegram
Heroku Node Telegram Bot
Starter pack for running telegram bot on the Heroku using Node.js
Stars: ✭ 128 (-15.79%)
Mutual labels:  telegram-bot, telegram
Telegram Bot
Telegram Bot using AWS API Gateway and AWS Lambda
Stars: ✭ 96 (-36.84%)
Mutual labels:  telegram-bot, telegram
Integram
Integrate Telegram into your workflow – Trello, Gitlab, Bitbucket and other bots
Stars: ✭ 1,365 (+798.03%)
Mutual labels:  telegram-bot, telegram
Qq2tg
帮助QQ与Telegram互联的小程序
Stars: ✭ 122 (-19.74%)
Mutual labels:  telegram-bot, telegram

Hubot Telegram Adapter

Build Status

Hubot adapter for interfacting with the Telegram Bot API

Installation & Usage

First of read the docs on how to create a new Telegram Bot. Once you have a bot created, follow these steps:

  • npm install --save hubot-telegram
  • Set the environment variables specified in Configuration
  • Run hubot bin/hubot -a telegram

Configuration

This adapter uses the following environment variables:

TELEGRAM_TOKEN (required)

The token that the BotFather gives you

TELEGRAM_INTERVAL (optional)

You can specify the interval (in milliseconds) in which the adapter will poll Telegram for updates. This option only applies if you are not using a webhook.

TELEGRAM_WEBHOOK (optional)

You can specify a webhook URL. The adapter will register TELEGRAM_WEBHOOK/TELEGRAM_TOKEN with Telegram and listen there.

Telegram Specific Functionality (ie. Stickers, Images)

The adapter will enhance the Response object with some custom methods with the same signature of the APIs. For example, sending an image:

module.exports = function (robot) {
  robot.hear(/send totoro/i, res => {
    const image = fs.createReadStream(__dirname + '/image.png')
    // https://core.telegram.org/bots/api#sendphoto
    res.sendPhoto(res.envelope.room, image, {
      caption: 'Totoro!'
    })
  })
}

Note: An example script of how to use this is located in the example/ folder

The list of methods exposed through a middleware to the response object is:

  • sendMessage
  • sendMessage
  • sendPhoto
  • sendAudio
  • sendDocument
  • sendMediaGroup
  • sendSticker
  • sendVideo
  • sendVideoNote
  • sendVoice
  • sendChatAction

If you want to supplement your message delivery with extra features such as markdown syntax or keyboard replies, you can specify these parameters on the options of sendMessage:

robot.respond(/(.*)/i, res => {
  res.sendMessage(
    res.envelope.room,
    'Select the option from the keyboard specified.',
    {
      reply_markup: {
        keyboard: [['Start', 'Stop']]
      }
    }
  )
})

inlineQuery are a way to reply without a conversation to the bot. That's why they don't really fit into the normal hear/respond flow of Hubot. To support inlineQuery you can listen to event on the telegram object exposed by the robot object.

module.exports = function (robot) {
  robot.telegram.on('inline_query', async inlineQuery => {
    // Initially there is always a query with empty string
    // Usually is to provide suggestions
    if (inlineQuery.query) {
      const searches = await google.search(inlineQuery.query, 50) // Max 50 results for inlineQuery
      const results = searches.map(result => ({
        type: 'photo',
        id: result.id,
        thumb_url: result['thumbnail'],
        photo_url: result['url']
      }))
      robot.telegram.answerInlineQuery(inlineQuery.id, results)
    }
  })
}

Contributors

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