@vlad-yakovlev/grammy-reply-with-markdown
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

grammy-reply-with-markdown

replyWithMarkdown method for grammY. Uses @vlad-yakovlev/telegram-md

GitHub CI Codecov NPM

Table of Contents

  1. How to Install
  2. Usage Examples

How to install

npm install @vlad-yakovlev/grammy-reply-with-markdown

Usage Examples

import { Bot, Context } from 'grammy';
import { ReplyWithMarkdownFlavour, replyWithMarkdownPlugin } from '@vlad-yakovlev/grammy-reply-with-markdown';
import { md } from 'telegram-md';

(async () => {
  const bot = new Bot<Context & ReplyWithMarkdownFlavour>('<bot-token>');

  bot.use(replyWithMarkdownPlugin());

  bot.command('start', async (ctx) => {
    // Send simple string (all special characters will be escaped)
    await ctx.replyWithMarkdown('Hello, World!');

    // Send Markdown (read more about `md` here: https://www.npmjs.org/package/telegram-md)
    await ctx.replyWithMarkdown(md`Hello, ${md.bold(World)}!`);

    // Options will be passed to ctx.reply
    await ctx.replyWithMarkdown('foo-bar', { reply_markup: { keyboard: [] });
  });
})()

Package Sidebar

Install

npm i @vlad-yakovlev/grammy-reply-with-markdown

Weekly Downloads

35

Version

2.0.1

License

MIT

Unpacked Size

6.96 kB

Total Files

5

Last publish

Collaborators

  • vlad-iakovlev