Skip to content

gramscript/gramscript.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


GitHub code size in bytes CodeFactor GitHub issues GitHub GitHub Repo stars GitHub last commit


Installation

npm install gramscript
npm i gramscript
yarn add gramscript

Usage

Creating custom bot Object

const TeleBot = require('gramscript');
const bot = new TeleBot('TELEGRAM_BOT_TOKEN');

// bot's script here

bot.start();

Quick Examples

const TeleBot = require('gramscript');
const bot = new TeleBot('123yuio456pasd678fghWqaz');

// bot command
bot.on('/hello', (msg) => {
  return bot.sendMessage(msg.from.id, `Hello, ${ msg.from.first_name }!`);
});

// if user send message text , bot will forward same content
bot.on('text', (msg) => msg.reply.text(msg.text));

// if user send sticker, bot will forwad same sticker
bot.on('sticker', (msg) => {
    return msg.reply.sticker('http://i.imgur.com/VRYdhuD.png', { asReply: true });
});

// also work with multiple events
bot.on(['/start', 'audio', 'sticker'], msg => {
  return bot.sendMessage(msg.from.id, 'Bam!');
});

bot.start();

About

PowerFull Node js Telegram bot API

Resources

Stars

Watchers

Forks

Packages

No packages published