🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

small-simple-bot

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

small-simple-bot

Really simple telegram bot

latest
npmnpm
Version
0.3.0
Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 07 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts