Socket
Socket
Sign inDemoInstall

grammy

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grammy

grammY core package ported to Node.js


Version published
Weekly downloads
19K
decreased by-6.5%
Maintainers
1
Weekly downloads
 
Created
Source

grammY for Node

If you haven't already, install Node.js.

Quickstart

Simple example

Talk to @BotFather to create a new Telegram bot and obtain a bot token.

Paste the following code into a new file example-bot.js.

import { Bot } from 'grammy'
// This works, too (CommonJS modules):
// const { Bot } = require('grammy')

// Create bot
const bot = new Bot('<your-bot-token>')

// Listen for messages
bot.command('start', ctx => ctx.reply('Welcome! Send me your pics!'))
bot.on('message:photo' ctx => ctx.reply('Nice photo!'))

// Launch!
bot.launch()

Congratulations! You have successfully created your first Telegram bot for Node.

You can run it like so:

node example-bot.js

Advanced example

TODO: create more complicated example

const token = process.env.BOT_TOKEN;
node example-bot.js

FAQs

Package last updated on 26 Mar 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc