@mks2508/telegram-message-builder 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/builder/builder.d.ts +87 -0
  2. package/dist/builder/index.d.ts +2 -0
  3. package/dist/builder/media.d.ts +351 -0
  4. package/dist/formatters/index.d.ts +86 -0
  5. package/dist/formatters/markdown.d.ts +178 -0
  6. package/dist/formatters/markdownv2.d.ts +183 -0
  7. package/dist/index.cjs +1057 -12
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.ts +11 -0
  10. package/dist/index.js +1022 -13
  11. package/dist/index.js.map +1 -1
  12. package/dist/keyboard/index.d.ts +113 -0
  13. package/dist/types/constants.d.ts +13 -0
  14. package/dist/types/core.types.d.ts +74 -0
  15. package/dist/types/index.d.ts +4 -0
  16. package/dist/types/keyboard-types.index.d.ts +1 -0
  17. package/dist/types/keyboard.types.d.ts +95 -0
  18. package/dist/types/main.types.d.ts +22 -0
  19. package/dist/types/media.types.d.ts +157 -0
  20. package/package.json +1 -1
  21. package/src/builder/builder.d.ts +55 -0
  22. package/src/builder/builder.d.ts.map +1 -1
  23. package/src/builder/builder.ts +145 -10
  24. package/src/builder/index.d.ts +2 -1
  25. package/src/builder/index.d.ts.map +1 -1
  26. package/src/builder/index.ts +2 -1
  27. package/src/builder/media.d.ts +352 -0
  28. package/src/builder/media.d.ts.map +1 -0
  29. package/src/builder/media.test.ts +664 -0
  30. package/src/builder/media.ts +484 -0
  31. package/src/builder.test.ts +465 -0
  32. package/src/escaping.test.ts +2 -2
  33. package/src/formatters/index.d.ts +47 -0
  34. package/src/formatters/index.d.ts.map +1 -1
  35. package/src/formatters/index.ts +92 -1
  36. package/src/formatters/markdown.d.ts +179 -0
  37. package/src/formatters/markdown.d.ts.map +1 -0
  38. package/src/formatters/markdown.test.ts +417 -0
  39. package/src/formatters/markdown.ts +220 -0
  40. package/src/formatters/markdownv2.d.ts +184 -0
  41. package/src/formatters/markdownv2.d.ts.map +1 -0
  42. package/src/formatters/markdownv2.ts +235 -0
  43. package/src/formatters.test.ts +17 -7
  44. package/src/index.d.ts +2 -0
  45. package/src/index.d.ts.map +1 -1
  46. package/src/index.ts +12 -0
  47. package/src/integration.test.ts +523 -0
  48. package/src/media-integration.test.ts +384 -0
  49. package/src/types/index.d.ts +1 -0
  50. package/src/types/index.d.ts.map +1 -1
  51. package/src/types/index.ts +1 -0
  52. package/src/types/media.types.d.ts +158 -0
  53. package/src/types/media.types.d.ts.map +1 -0
  54. package/src/types/media.types.ts +178 -0
  55. package/src/types.test.ts +539 -0
  56. package/src/utils/index.d.ts +1 -1
  57. package/src/utils/index.ts +0 -5
@@ -0,0 +1,87 @@
1
+ import type { TelegramMessage, ParseMode } from "../types";
2
+ /**
3
+ * Telegram Message Builder - Fluent API for building formatted Telegram messages
4
+ *
5
+ * Supports all three Telegram parse modes: HTML, Markdown, and MarkdownV2
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * // HTML mode (default)
10
+ * const msg1 = TelegramMessageBuilder.text()
11
+ * .title("Welcome")
12
+ * .line("Status", "Active", { bold: true })
13
+ * .build();
14
+ *
15
+ * // Markdown mode
16
+ * const msg2 = TelegramMessageBuilder.text()
17
+ * .setParseMode("markdown")
18
+ * .title("Welcome")
19
+ * .build();
20
+ *
21
+ * // MarkdownV2 mode
22
+ * const msg3 = TelegramMessageBuilder.text()
23
+ * .setParseMode("markdownv2")
24
+ * .title("Welcome")
25
+ * .build();
26
+ * ```
27
+ */
28
+ export declare class TelegramMessageBuilder {
29
+ private parts;
30
+ private parseMode;
31
+ private options;
32
+ private constructor();
33
+ static text(): TelegramMessageBuilder;
34
+ setParseMode(mode: ParseMode): this;
35
+ /**
36
+ * Formats text as bold based on current parse mode
37
+ */
38
+ private bold;
39
+ /**
40
+ * Formats text as italic based on current parse mode
41
+ */
42
+ private italic;
43
+ /**
44
+ * Formats text as underline based on current parse mode
45
+ */
46
+ private underline;
47
+ /**
48
+ * Formats text as code based on current parse mode
49
+ */
50
+ private code;
51
+ /**
52
+ * Formats text as code block based on current parse mode
53
+ */
54
+ private codeBlockFormat;
55
+ /**
56
+ * Creates a link based on current parse mode
57
+ */
58
+ private linkFormat;
59
+ /**
60
+ * Creates a mention based on current parse mode
61
+ */
62
+ private mentionFormat;
63
+ /**
64
+ * Creates a hashtag based on current parse mode
65
+ */
66
+ private hashtagFormat;
67
+ title(text: string): this;
68
+ section(text: string): this;
69
+ line(key: string, value: string, opts?: {
70
+ bold?: boolean;
71
+ italic?: boolean;
72
+ code?: boolean;
73
+ underline?: boolean;
74
+ }): this;
75
+ codeBlock(text: string, language?: string): this;
76
+ listItem(text: string): this;
77
+ newline(count?: number): this;
78
+ separator(): this;
79
+ text(text: string): this;
80
+ link(text: string, url: string): this;
81
+ mention(userId: number, name?: string): this;
82
+ hashtag(tag: string): this;
83
+ build(): TelegramMessage;
84
+ setOption(key: string, value: unknown): this;
85
+ setOptions(options: Record<string, unknown>): this;
86
+ getParseMode(): ParseMode;
87
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./builder";
2
+ export * from "./media";
@@ -0,0 +1,351 @@
1
+ /**
2
+ * @fileoverview Media Builder
3
+ * @description Fluent API for building media messages for Telegram Bot API
4
+ * @module telegram-message-builder/builder
5
+ *
6
+ * @see {@link https://core.telegram.org/bots/api#sendphoto | Telegram Bot API - sendPhoto}
7
+ * @see {@link https://core.telegram.org/bots/api#sendvideo | Telegram Bot API - sendVideo}
8
+ * @see {@link https://core.telegram.org/bots/api#senddocument | Telegram Bot API - sendDocument}
9
+ * @see {@link https://core.telegram.org/bots/api#sendaudio | Telegram Bot API - sendAudio}
10
+ * @see {@link https://core.telegram.org/bots/api#sendvoice | Telegram Bot API - sendVoice}
11
+ */
12
+ import type { MediaSource, MediaType, IMediaCommonOptions, IMediaBuildResult, ParseMode } from "../types";
13
+ /**
14
+ * Telegram Media Builder - Fluent API for building media messages
15
+ *
16
+ * Provides a type-safe, fluent interface for constructing media messages
17
+ * compatible with Telegram Bot API v9.3+.
18
+ *
19
+ * Supports all three Telegram parse modes (HTML, Markdown, MarkdownV2) for caption formatting.
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * // Simple photo with caption
24
+ * const photo = TelegramMediaBuilder.photo("photo.jpg")
25
+ * .caption("My photo")
26
+ * .build();
27
+ *
28
+ * // Video with caption and options
29
+ * const video = TelegramMediaBuilder.video("video.mp4")
30
+ * .caption("My video")
31
+ * .duration(120)
32
+ * .thumbnail("thumb.jpg")
33
+ * .setParseMode("markdown")
34
+ * .build();
35
+ *
36
+ * // Document with custom options
37
+ * const doc = TelegramMediaBuilder.document("report.pdf")
38
+ * .caption("Q4 Report")
39
+ * .fileName("q4_2024.pdf")
40
+ * .mimeType("application/pdf")
41
+ * .build();
42
+ * ```
43
+ */
44
+ export declare class TelegramMediaBuilder<T extends MediaType> {
45
+ protected source: MediaSource;
46
+ protected mediaType: T;
47
+ protected _caption?: string;
48
+ protected parseMode: ParseMode;
49
+ protected options: IMediaCommonOptions;
50
+ protected constructor(source: MediaSource, mediaType: T);
51
+ /**
52
+ * Create a photo message builder
53
+ *
54
+ * @param source - File ID, URL, Buffer, or file path
55
+ * @returns Photo media builder with thumbnail() method
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * const photo = TelegramMediaBuilder.photo("https://example.com/photo.jpg")
60
+ * .caption("Beautiful sunset")
61
+ * .thumbnail("thumb.jpg")
62
+ * .build();
63
+ * ```
64
+ */
65
+ static photo(source: MediaSource): PhotoBuilder;
66
+ /**
67
+ * Create a video message builder
68
+ *
69
+ * @param source - File ID, URL, Buffer, or file path
70
+ * @returns Video media builder with duration(), width(), height(), thumbnail(), enableStreaming() methods
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * const video = TelegramMediaBuilder.video("video.mp4")
75
+ * .caption("My video")
76
+ * .duration(120)
77
+ * .width(1920)
78
+ * .height(1080)
79
+ * .build();
80
+ * ```
81
+ */
82
+ static video(source: MediaSource): VideoBuilder;
83
+ /**
84
+ * Create a document message builder
85
+ *
86
+ * @param source - File ID, URL, Buffer, or file path
87
+ * @returns Document media builder with thumbnail(), fileName(), mimeType(), disableContentTypeDetection() methods
88
+ *
89
+ * @example
90
+ * ```typescript
91
+ * const doc = TelegramMediaBuilder.document("report.pdf")
92
+ * .caption("Q4 Report")
93
+ * .fileName("q4_2024.pdf")
94
+ * .mimeType("application/pdf")
95
+ * .build();
96
+ * ```
97
+ */
98
+ static document(source: MediaSource): DocumentBuilder;
99
+ /**
100
+ * Create an audio message builder
101
+ *
102
+ * @param source - File ID, URL, Buffer, or file path
103
+ * @returns Audio media builder with duration(), performer(), title(), thumbnail() methods
104
+ *
105
+ * @example
106
+ * ```typescript
107
+ * const audio = TelegramMediaBuilder.audio("song.mp3")
108
+ * .caption("My favorite song")
109
+ * .duration(180)
110
+ * .performer("Artist Name")
111
+ * .title("Song Title")
112
+ * .build();
113
+ * ```
114
+ */
115
+ static audio(source: MediaSource): AudioBuilder;
116
+ /**
117
+ * Create a voice message builder
118
+ *
119
+ * @param source - File ID, URL, Buffer, or file path
120
+ * @returns Voice media builder with duration() method
121
+ *
122
+ * @example
123
+ * ```typescript
124
+ * const voice = TelegramMediaBuilder.voice("voice.ogg")
125
+ * .caption("Listen to this")
126
+ * .duration(30)
127
+ * .build();
128
+ * ```
129
+ */
130
+ static voice(source: MediaSource): VoiceBuilder;
131
+ /**
132
+ * Set caption for the media
133
+ *
134
+ * @param text - Caption text (0-1024 characters)
135
+ * @returns This builder for chaining
136
+ */
137
+ caption(text: string): this;
138
+ /**
139
+ * Set parse mode for caption formatting
140
+ *
141
+ * @param mode - Parse mode (html, markdown, or markdownv2)
142
+ * @returns This builder for chaining
143
+ */
144
+ setParseMode(mode: ParseMode): this;
145
+ /**
146
+ * Set a custom option
147
+ *
148
+ * @param key - Option name
149
+ * @param value - Option value
150
+ * @returns This builder for chaining
151
+ */
152
+ setOption<K extends keyof IMediaCommonOptions>(key: K, value: IMediaCommonOptions[K]): this;
153
+ /**
154
+ * Set multiple options at once
155
+ *
156
+ * @param opts - Object with options to set
157
+ * @returns This builder for chaining
158
+ */
159
+ setOptions(opts: Partial<IMediaCommonOptions>): this;
160
+ /**
161
+ * Build the media message object
162
+ *
163
+ * @returns Complete media message ready for Telegram Bot API
164
+ */
165
+ build(): IMediaBuildResult;
166
+ /**
167
+ * Format caption based on current parse mode
168
+ *
169
+ * @param text - Caption text to format
170
+ * @returns Formatted caption
171
+ */
172
+ private formatCaption;
173
+ }
174
+ /**
175
+ * Photo-specific builder with convenience methods
176
+ *
177
+ * @example
178
+ * ```typescript
179
+ * const photo = TelegramMediaBuilder.photo("photo.jpg")
180
+ * .caption("My photo")
181
+ * .thumbnail("thumb.jpg")
182
+ * .build();
183
+ * ```
184
+ */
185
+ export declare class PhotoBuilder extends TelegramMediaBuilder<"photo"> {
186
+ /**
187
+ * Set thumbnail for the photo
188
+ *
189
+ * @param thumb - Thumbnail as Buffer or file path
190
+ * @returns This builder for chaining
191
+ */
192
+ thumbnail(thumb: Buffer | string): this;
193
+ }
194
+ /**
195
+ * Video-specific builder with convenience methods
196
+ *
197
+ * @example
198
+ * ```typescript
199
+ * const video = TelegramMediaBuilder.video("video.mp4")
200
+ * .caption("My video")
201
+ * .duration(120)
202
+ * .width(1920)
203
+ * .height(1080)
204
+ * .thumbnail("thumb.jpg")
205
+ * .enableStreaming()
206
+ * .build();
207
+ * ```
208
+ */
209
+ export declare class VideoBuilder extends TelegramMediaBuilder<"video"> {
210
+ /**
211
+ * Set video duration
212
+ *
213
+ * @param seconds - Duration in seconds
214
+ * @returns This builder for chaining
215
+ */
216
+ duration(seconds: number): this;
217
+ /**
218
+ * Set video width
219
+ *
220
+ * @param px - Width in pixels
221
+ * @returns This builder for chaining
222
+ */
223
+ width(px: number): this;
224
+ /**
225
+ * Set video height
226
+ *
227
+ * @param px - Height in pixels
228
+ * @returns This builder for chaining
229
+ */
230
+ height(px: number): this;
231
+ /**
232
+ * Set thumbnail for the video
233
+ *
234
+ * @param thumb - Thumbnail as Buffer or file path
235
+ * @returns This builder for chaining
236
+ */
237
+ thumbnail(thumb: Buffer | string): this;
238
+ /**
239
+ * Enable streaming for the video
240
+ *
241
+ * @returns This builder for chaining
242
+ */
243
+ enableStreaming(): this;
244
+ }
245
+ /**
246
+ * Document-specific builder with convenience methods
247
+ *
248
+ * @example
249
+ * ```typescript
250
+ * const doc = TelegramMediaBuilder.document("report.pdf")
251
+ * .caption("Q4 Report")
252
+ * .thumbnail("thumb.jpg")
253
+ * .fileName("q4_2024.pdf")
254
+ * .mimeType("application/pdf")
255
+ * .disableContentTypeDetection()
256
+ * .build();
257
+ * ```
258
+ */
259
+ export declare class DocumentBuilder extends TelegramMediaBuilder<"document"> {
260
+ /**
261
+ * Set thumbnail for the document
262
+ *
263
+ * @param thumb - Thumbnail as Buffer or file path
264
+ * @returns This builder for chaining
265
+ */
266
+ thumbnail(thumb: Buffer | string): this;
267
+ /**
268
+ * Set original filename
269
+ *
270
+ * @param name - File name
271
+ * @returns This builder for chaining
272
+ */
273
+ fileName(name: string): this;
274
+ /**
275
+ * Set MIME type
276
+ *
277
+ * @param type - MIME type string
278
+ * @returns This builder for chaining
279
+ */
280
+ mimeType(type: string): this;
281
+ /**
282
+ * Disable automatic file type detection
283
+ *
284
+ * @returns This builder for chaining
285
+ */
286
+ disableContentTypeDetection(): this;
287
+ }
288
+ /**
289
+ * Audio-specific builder with convenience methods
290
+ *
291
+ * @example
292
+ * ```typescript
293
+ * const audio = TelegramMediaBuilder.audio("song.mp3")
294
+ * .caption("My favorite song")
295
+ * .duration(180)
296
+ * .performer("Artist Name")
297
+ * .title("Song Title")
298
+ * .thumbnail("album_art.jpg")
299
+ * .build();
300
+ * ```
301
+ */
302
+ export declare class AudioBuilder extends TelegramMediaBuilder<"audio"> {
303
+ /**
304
+ * Set audio duration
305
+ *
306
+ * @param seconds - Duration in seconds
307
+ * @returns This builder for chaining
308
+ */
309
+ duration(seconds: number): this;
310
+ /**
311
+ * Set performer name
312
+ *
313
+ * @param name - Performer name
314
+ * @returns This builder for chaining
315
+ */
316
+ performer(name: string): this;
317
+ /**
318
+ * Set track title
319
+ *
320
+ * @param name - Track title
321
+ * @returns This builder for chaining
322
+ */
323
+ title(name: string): this;
324
+ /**
325
+ * Set thumbnail (album cover)
326
+ *
327
+ * @param thumb - Thumbnail as Buffer or file path
328
+ * @returns This builder for chaining
329
+ */
330
+ thumbnail(thumb: Buffer | string): this;
331
+ }
332
+ /**
333
+ * Voice-specific builder with convenience methods
334
+ *
335
+ * @example
336
+ * ```typescript
337
+ * const voice = TelegramMediaBuilder.voice("voice.ogg")
338
+ * .caption("Listen to this")
339
+ * .duration(30)
340
+ * .build();
341
+ * ```
342
+ */
343
+ export declare class VoiceBuilder extends TelegramMediaBuilder<"voice"> {
344
+ /**
345
+ * Set voice duration
346
+ *
347
+ * @param seconds - Duration in seconds
348
+ * @returns This builder for chaining
349
+ */
350
+ duration(seconds: number): this;
351
+ }
@@ -0,0 +1,86 @@
1
+ import type { ParseMode } from "../types";
2
+ import { boldMD, italicMD, codeMD, codeBlockMD, linkMD, mentionMD, hashtagMD, underlineMD, strikethroughMD, spoilerMD, emailMD, urlMD, customEmojiMD, rawMD } from "./markdown";
3
+ import { boldMDv2, italicMDv2, underlineMDv2, strikethroughMDv2, spoilerMDv2, codeMDv2, codeBlockMDv2, linkMDv2, mentionMDv2, hashtagMDv2, emailMDv2, urlMDv2, customEmojiMDv2, rawMDv2, escapeMDv2 } from "./markdownv2";
4
+ export * from "./markdown";
5
+ export * from "./markdownv2";
6
+ export declare function escapeHTML(text: string): string;
7
+ export declare function escapeMarkdown(text: string): string;
8
+ export declare function escapeMarkdownV2(text: string): string;
9
+ export declare function bold(text: string): string;
10
+ export declare function italic(text: string): string;
11
+ export declare function underline(text: string): string;
12
+ export declare function strikethrough(text: string): string;
13
+ export declare function spoiler(text: string): string;
14
+ export declare function code(text: string): string;
15
+ export declare function pre(text: string): string;
16
+ export declare function codeBlock(text: string, language?: string): string;
17
+ export declare function link(text: string, url: string): string;
18
+ export declare function mention(userId: number, name?: string): string;
19
+ export declare function hashtag(tag: string): string;
20
+ export declare function customEmoji(emojiId: string): string;
21
+ export declare function email(email: string): string;
22
+ export declare function url(link: string): string;
23
+ /**
24
+ * Raw HTML string - bypasses escaping for combining pre-formatted content
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * // Instead of this (which escapes inner tags):
29
+ * fmt.bold(fmt.italic("Text")) // <b>&lt;i&gt;Text&lt;/i&gt;</b>
30
+ *
31
+ * // Use this:
32
+ * fmt.bold(fmt.raw(fmt.italic("Text"))) // <b><i>Text</i></b>
33
+ * ```
34
+ */
35
+ export declare function raw(html: string): string;
36
+ export declare function escape(text: string, mode?: ParseMode): string;
37
+ export declare const fmt: {
38
+ bold: typeof bold;
39
+ italic: typeof italic;
40
+ underline: typeof underline;
41
+ strikethrough: typeof strikethrough;
42
+ spoiler: typeof spoiler;
43
+ code: typeof code;
44
+ pre: typeof pre;
45
+ codeBlock: typeof codeBlock;
46
+ link: typeof link;
47
+ mention: typeof mention;
48
+ hashtag: typeof hashtag;
49
+ email: typeof email;
50
+ url: typeof url;
51
+ customEmoji: typeof customEmoji;
52
+ escape: typeof escape;
53
+ escapeHTML: typeof escapeHTML;
54
+ escapeMarkdown: typeof escapeMarkdown;
55
+ escapeMarkdownV2: typeof escapeMarkdownV2;
56
+ raw: typeof raw;
57
+ boldMD: typeof boldMD;
58
+ italicMD: typeof italicMD;
59
+ codeMD: typeof codeMD;
60
+ codeBlockMD: typeof codeBlockMD;
61
+ linkMD: typeof linkMD;
62
+ mentionMD: typeof mentionMD;
63
+ hashtagMD: typeof hashtagMD;
64
+ underlineMD: typeof underlineMD;
65
+ strikethroughMD: typeof strikethroughMD;
66
+ spoilerMD: typeof spoilerMD;
67
+ emailMD: typeof emailMD;
68
+ urlMD: typeof urlMD;
69
+ customEmojiMD: typeof customEmojiMD;
70
+ rawMD: typeof rawMD;
71
+ boldMDv2: typeof boldMDv2;
72
+ italicMDv2: typeof italicMDv2;
73
+ underlineMDv2: typeof underlineMDv2;
74
+ strikethroughMDv2: typeof strikethroughMDv2;
75
+ spoilerMDv2: typeof spoilerMDv2;
76
+ codeMDv2: typeof codeMDv2;
77
+ codeBlockMDv2: typeof codeBlockMDv2;
78
+ linkMDv2: typeof linkMDv2;
79
+ mentionMDv2: typeof mentionMDv2;
80
+ hashtagMDv2: typeof hashtagMDv2;
81
+ emailMDv2: typeof emailMDv2;
82
+ urlMDv2: typeof urlMDv2;
83
+ customEmojiMDv2: typeof customEmojiMDv2;
84
+ rawMDv2: typeof rawMDv2;
85
+ escapeMDv2: typeof escapeMDv2;
86
+ };
@@ -0,0 +1,178 @@
1
+ /**
2
+ * @fileoverview Markdown (Legacy) Formatters
3
+ * @description Text formatting functions for Telegram's legacy Markdown parse mode
4
+ * @module telegram-message-builder/formatters
5
+ *
6
+ * @see {@link https://core.telegram.org/bots/api#formatting-options | Telegram Bot API - Formatting Options}
7
+ */
8
+ /**
9
+ * Formats text as bold in Markdown
10
+ *
11
+ * @param text - The text to format
12
+ * @returns Bold formatted text
13
+ * @example
14
+ * ```typescript
15
+ * boldMD("Hello") // "*Hello*"
16
+ * ```
17
+ */
18
+ export declare function boldMD(text: string): string;
19
+ /**
20
+ * Formats text as italic in Markdown
21
+ *
22
+ * @param text - The text to format
23
+ * @returns Italic formatted text
24
+ * @example
25
+ * ```typescript
26
+ * italicMD("Hello") // "_Hello_"
27
+ * ```
28
+ */
29
+ export declare function italicMD(text: string): string;
30
+ /**
31
+ * Formats text as monospace code in Markdown
32
+ *
33
+ * @param text - The text to format
34
+ * @returns Code formatted text
35
+ * @example
36
+ * ```typescript
37
+ * codeMD("const x = 1") // "`const x = 1`"
38
+ * ```
39
+ */
40
+ export declare function codeMD(text: string): string;
41
+ /**
42
+ * Formats text as a code block in Markdown
43
+ *
44
+ * @param text - The code to format
45
+ * @param language - Optional programming language for syntax highlighting
46
+ * @returns Code block formatted text
47
+ * @example
48
+ * ```typescript
49
+ * codeBlockMD("console.log('Hello')") // "```console.log('Hello')```"
50
+ * codeBlockMD("const x = 1", "javascript") // "```javascript\nconst x = 1\n```"
51
+ * ```
52
+ */
53
+ export declare function codeBlockMD(text: string, language?: string): string;
54
+ /**
55
+ * Creates a link in Markdown format
56
+ *
57
+ * @param text - The link text
58
+ * @param url - The URL to link to
59
+ * @returns Link formatted text
60
+ * @example
61
+ * ```typescript
62
+ * linkMD("Google", "https://google.com") // "[Google](https://google.com)"
63
+ * ```
64
+ */
65
+ export declare function linkMD(text: string, url: string): string;
66
+ /**
67
+ * Creates a user mention link in Markdown format
68
+ *
69
+ * @param userId - The user's ID
70
+ * @param name - Optional display name
71
+ * @returns Mention formatted text
72
+ * @example
73
+ * ```typescript
74
+ * mentionMD(123456) // "tg://user?id=123456"
75
+ * mentionMD(123456, "John") // "tg://user?id=123456"
76
+ * ```
77
+ */
78
+ export declare function mentionMD(userId: number, _name?: string): string;
79
+ /**
80
+ * Creates a hashtag link in Markdown format
81
+ *
82
+ * @param tag - The hashtag text (without #)
83
+ * @returns Hashtag formatted text
84
+ * @example
85
+ * ```typescript
86
+ * hashtagMD("test") // "#test"
87
+ * ```
88
+ */
89
+ export declare function hashtagMD(tag: string): string;
90
+ /**
91
+ * Formats text as underline in Markdown (limited support)
92
+ *
93
+ * Note: Standard Markdown doesn't support underline. This uses HTML which
94
+ * may not work in all Telegram clients.
95
+ *
96
+ * @param text - The text to format
97
+ * @returns Underline formatted text (HTML fallback)
98
+ * @example
99
+ * ```typescript
100
+ * underlineMD("Hello") // "<u>Hello</u>"
101
+ * ```
102
+ */
103
+ export declare function underlineMD(text: string): string;
104
+ /**
105
+ * Formats text as strikethrough in Markdown (limited support)
106
+ *
107
+ * Note: Standard Markdown doesn't support strikethrough. This uses HTML which
108
+ * may not work in all Telegram clients.
109
+ *
110
+ * @param text - The text to format
111
+ * @returns Strikethrough formatted text (HTML fallback)
112
+ * @example
113
+ * ```typescript
114
+ * strikethroughMD("Hello") // "<s>Hello</s>"
115
+ * ```
116
+ */
117
+ export declare function strikethroughMD(text: string): string;
118
+ /**
119
+ * Formats text as spoiler in Markdown (limited support)
120
+ *
121
+ * Note: Standard Markdown doesn't support spoiler. This uses HTML which
122
+ * may not work in all Telegram clients.
123
+ *
124
+ * @param text - The text to format
125
+ * @returns Spoiler formatted text (HTML fallback)
126
+ * @example
127
+ * ```typescript
128
+ * spoilerMD("Secret") // "<tg-spoiler>Secret</tg-spoiler>"
129
+ * ```
130
+ */
131
+ export declare function spoilerMD(text: string): string;
132
+ /**
133
+ * Creates an email link in Markdown format
134
+ *
135
+ * @param email - The email address
136
+ * @returns Email link formatted text
137
+ * @example
138
+ * ```typescript
139
+ * emailMD("test@example.com") // "[test@example.com](mailto:test@example.com)"
140
+ * ```
141
+ */
142
+ export declare function emailMD(email: string): string;
143
+ /**
144
+ * Creates a URL link in Markdown format
145
+ *
146
+ * @param url - The URL
147
+ * @returns URL link formatted text
148
+ * @example
149
+ * ```typescript
150
+ * urlMD("https://example.com") // "[https://example.com](https://example.com)"
151
+ * ```
152
+ */
153
+ export declare function urlMD(url: string): string;
154
+ /**
155
+ * Creates a custom emoji in Markdown format (limited support)
156
+ *
157
+ * Note: Standard Markdown doesn't support custom emoji. This uses HTML which
158
+ * may not work in all Telegram clients.
159
+ *
160
+ * @param emojiId - The custom emoji ID
161
+ * @returns Custom emoji formatted text (HTML fallback)
162
+ * @example
163
+ * ```typescript
164
+ * customEmojiMD("5368324170672642286") // "<tg-emoji emoji-id=\"5368324170672642286\">👻</tg-emoji>"
165
+ * ```
166
+ */
167
+ export declare function customEmojiMD(emojiId: string): string;
168
+ /**
169
+ * Raw Markdown string - bypasses any automatic formatting
170
+ *
171
+ * @param markdown - Pre-formatted Markdown string
172
+ * @returns The Markdown string unchanged
173
+ * @example
174
+ * ```typescript
175
+ * rawMD("*Hello*") // "*Hello*"
176
+ * ```
177
+ */
178
+ export declare function rawMD(markdown: string): string;