small-simple-bot

    0.3.0 • Public • Published

    Small Simple Bot

    A Really simple Telegram Bot

    Usage

    In your desktop / Local network

    Write my-bot.coffee:

    SmallSimpleBot = require 'small-simple-bot'
    
    bot = new SmallSimpleBot
        token: '123456789:YourBotsTelegramToken'
        adms: [
            { username: 'aurium', id: 123456789 }
            { username: 'diguliu', id: 987654321 }
        ]
    
    bot.addInteractions(
        require './my-interaction-module'
        require './other-interaction-module'
    )
    
    do bot.run

    In a server

    Write my-bot.coffee:

    SmallSimpleBot = require 'small-simple-bot'
    
    bot = new SmallSimpleBot
        token: '123456789:YourBotsTelegramToken'
        webhookPath: 'hidden-end-point'
        adms: [
            { username: 'aurium', id: 123456789 }
            { username: 'diguliu', id: 987654321 }
        ]
    
    bot.addInteractions(
        require './my-interaction-module'
        require './other-interaction-module'
    )
    
    server = do require('http').createServer
    
    bot.bindServer server
    
    server.listen process.env.PORT or 3000

    Create an interation module

    Write my-interaction-module.coffee:

    module.exports = (bot, update)->
        msg = update.message?.text or ''
        if update.toMe and msg
            bot.sendMessage "You said #{msg}", update.message.chat.id

      This feature is exclusive to Teams

      Illustration of wombats

      The package file explorer is only available for Teams at the moment.

      We may support exploring this package in the future. Check back soon.

      Install

      npm i small-simple-bot

      DownloadsWeekly Downloads

      1

      Version

      0.3.0

      License

      AGPL-3.0

      Unpacked Size

      45.2 kB

      Total Files

      10

      Last publish

      Collaborators

      • aurium