Skip to content

Commit f58c6fb

Browse files
committed
fmt
1 parent b926ace commit f58c6fb

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

README.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,18 @@ The plugin is compatible with both Deno and Node.js, and is designed to work as
1313

1414
```ts
1515
import { Bot } from "grammy";
16-
import { fmt, b, u } from "@grammyjs/parse-mode";
16+
import { b, fmt, u } from "@grammyjs/parse-mode";
1717

1818
const bot = new Bot("");
1919

2020
bot.command("demo", async (ctx) => {
21-
// Using return values of fmt
22-
const combined = fmt`${b}bolded${b} ${ctx.msg.text} ${u}underlined${u}`;
23-
await ctx.reply(combined.text, { entities: combined.entities });
24-
await ctx.replyWithPhoto(photo, { caption: combined.caption, caption_entities: combined.caption_entities });
21+
// Using return values of fmt
22+
const combined = fmt`${b}bolded${b} ${ctx.msg.text} ${u}underlined${u}`;
23+
await ctx.reply(combined.text, { entities: combined.entities });
24+
await ctx.replyWithPhoto(photo, {
25+
caption: combined.caption,
26+
caption_entities: combined.caption_entities,
27+
});
2528
});
2629

2730
bot.start();
@@ -36,10 +39,15 @@ import { FormattedString } from "@grammyjs/parse-mode";
3639
const bot = new Bot("");
3740

3841
bot.command("demo", async (ctx) => {
39-
// Using return values of Fmt
40-
const combined = FormattedString.b("bolded").plain(ctx.msg.text).u("underlined");
41-
await ctx.reply(combined.text, { entities: combined.entities });
42-
await ctx.replyWithPhoto(photo, { caption: combined.caption, caption_entities: combined.caption_entities });
42+
// Using return values of Fmt
43+
const combined = FormattedString.b("bolded").plain(ctx.msg.text).u(
44+
"underlined",
45+
);
46+
await ctx.reply(combined.text, { entities: combined.entities });
47+
await ctx.replyWithPhoto(photo, {
48+
caption: combined.caption,
49+
caption_entities: combined.caption_entities,
50+
});
4351
});
4452

4553
bot.start();

0 commit comments

Comments
 (0)