replyWithMarkdown method for grammY. Uses @vlad-yakovlev/telegram-md
npm install @vlad-yakovlev/grammy-reply-with-markdown
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: [] });
});
})()