1.0.0 • Published 2 years ago
grammy-reply-with-markdown v1.0.0
grammy-reply-with-markdown
replyWithMarkdown method for grammY. Uses telegram-md
How to install
npm install grammy-reply-with-markdown
How to use
import { Bot, Context } from 'grammy';
import { ReplyWithMarkdownFlavour, replyWithMarkdownPlugin } from '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: [] });
});
})()