@vlad-yakovlev/grammy-reply-with-markdown
v2.0.1
Published
replyWithMarkdown method for grammY
Downloads
129
Maintainers
Readme
grammy-reply-with-markdown
replyWithMarkdown method for grammY. Uses @vlad-yakovlev/telegram-md
Table of Contents
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: [] });
});
})()