Skip to content

Commit

Permalink
merge: #6 from dcdunkan/master
Browse files Browse the repository at this point in the history
feat: Update to Bot API 7.0
  • Loading branch information
MKRhere authored Feb 14, 2024
2 parents c29bfcf + 6705a17 commit 09335fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const TYPE_PRIORITY: Record<MessageEntity["type"], number> = {
phone_number: 50,
underline: 92,
strikethrough: 93,
// @ts-expect-error hasn't landed in telegraf/types yet.
blockquote: 0,
spoiler: 94,
custom_emoji: 99,
Expand Down
4 changes: 4 additions & 0 deletions serialisers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export const HTML: Serialiser = (match: string, node?: Node) => {
return `<a href="${node.url}">${match}</a>`;
case "text_mention":
return `<a href="tg://user?id=${node.user.id}">${match}</a>`;
case "blockquote":
return `<blockquote>${match}</blockquote>`;
case "mention":
case "custom_emoji":
case "hashtag":
Expand Down Expand Up @@ -58,6 +60,8 @@ export function MarkdownV2(match: string, node?: Node): string {
return `[${match}](${node.url})`;
case "text_mention":
return `[${match}](tg://user?id=${node.user.id})`;
case "blockquote":
return `${match.split("\n").map((line) => `>${line}`).join("\n")}`;
case "mention":
case "custom_emoji":
case "hashtag":
Expand Down
2 changes: 1 addition & 1 deletion types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MessageEntity } from "https://deno.land/x/telegraf_types@v6.9.1/message.ts";
import type { MessageEntity } from "https://deno.land/x/telegraf_types@v7.0.1/message.ts";

export type { MessageEntity };

Expand Down

0 comments on commit 09335fd

Please sign in to comment.