Scorocode.Bot


new Bot(botId)

Constructor sc.Bot

Returns: sc.Bot - returns the sc.Bot

Parameter Type Description
botId String Telegram Bot identifier given by @BotFather

Example

var sc = require('scorocode');

sc.Init({
    ApplicationID: "xxx", // <- replace xxx with ApplicationID  key
    JavaScriptKey: "xxx", // <- replace xxx with JavaScriptKey  key
    MasterKey: "xxx" // <- replace xxx with MasterKey
});

var bot = new sc.Bot("321196098:AAEDbOYD6iLWsHD7w28vqf3a9oBeJAPXXpg");

var data = {
    "method": "methodname", // Telegram bot API method name 
    "method_params": {
        // Telegram Bot API method params
    }};
bot.send(data)

.send(data)

Making request to Telegram Bot API

Parameter Type Description
data Object Object, containing data to request Telegram Bot API

data object properties.

Name Type Description
method String Telegram bot API method name
method_params Object Telegram Bot API method params

Example

var sc = require('scorocode');

sc.Init({
    ApplicationID: "xxx", // <- replace xxx with ApplicationID  key
    JavaScriptKey: "xxx", // <- replace xxx with JavaScriptKey  key
    MasterKey: "xxx" // <- replace xxx with MasterKey
});

var bot = new sc.Bot("321196098:AAEDbOYD6iLWsHD7w28vqf3a9oBeJAPXXpg");

var data = {
    "method": "methodname", // Telegram bot API method name 
    "method_params": {
        // Telegram Bot API method params
    }};

bot.send(data);