1.0.7 • Published 1 year ago

gramscript v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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();
1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago