1.0.9 • Published 10 years ago

simple-telegram-bot v1.0.9

Weekly downloads
16
License
ISC
Repository
github
Last release
10 years ago

Example app

var config = require("./example-config.json");

var token = config.botToken,
    connectionString = config.connectionString;

var Bot = require("node-telegram-bot-api"),
    bot = new Bot(token, { polling: true }),
    Massive = require("massive"),
    db = Massive.connectSync({ connectionString: connectionString }),
    SimpleBot = require('simple-telegram-bot'),
    simpleBot = new SimpleBot(bot, db.users, "echo");

simpleBot.on("chatstarted", function(chat){

    chat.send("Say something!");

    chat.on("command:echo", function(message){
        chat.send(message.text);
    });

    chat.on("command:broadcast", function(message){
        simpleBot.broadcast(message.text);
    });
    
});

Example config

{
    "botToken": "123123123:ABCABCABCABCABCABCABC-ABCABCABCABCA",
    "connectionString": "postgres://username:password@localhost/databasename"
}
1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago