@mks2508/telegram-message-builder 0.2.0

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 (44) hide show
  1. package/dist/index.cjs +445 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.js +422 -0
  4. package/dist/index.js.map +1 -0
  5. package/package.json +39 -0
  6. package/src/builder/builder.d.ts +33 -0
  7. package/src/builder/builder.d.ts.map +1 -0
  8. package/src/builder/builder.ts +124 -0
  9. package/src/builder/index.d.ts +2 -0
  10. package/src/builder/index.d.ts.map +1 -0
  11. package/src/builder/index.ts +1 -0
  12. package/src/escaping.test.ts +133 -0
  13. package/src/formatters/index.d.ts +40 -0
  14. package/src/formatters/index.d.ts.map +1 -0
  15. package/src/formatters/index.ts +117 -0
  16. package/src/formatters.test.ts +163 -0
  17. package/src/index.d.ts +10 -0
  18. package/src/index.d.ts.map +1 -0
  19. package/src/index.ts +22 -0
  20. package/src/keyboard/index.d.ts +114 -0
  21. package/src/keyboard/index.d.ts.map +1 -0
  22. package/src/keyboard/index.ts +286 -0
  23. package/src/keyboard.test.ts +217 -0
  24. package/src/types/constants.d.ts +14 -0
  25. package/src/types/constants.d.ts.map +1 -0
  26. package/src/types/constants.ts +15 -0
  27. package/src/types/core.types.d.ts +75 -0
  28. package/src/types/core.types.d.ts.map +1 -0
  29. package/src/types/core.types.ts +80 -0
  30. package/src/types/index.d.ts +4 -0
  31. package/src/types/index.d.ts.map +1 -0
  32. package/src/types/index.ts +3 -0
  33. package/src/types/keyboard-types.index.d.ts +2 -0
  34. package/src/types/keyboard-types.index.d.ts.map +1 -0
  35. package/src/types/keyboard-types.index.ts +1 -0
  36. package/src/types/keyboard.types.d.ts +96 -0
  37. package/src/types/keyboard.types.d.ts.map +1 -0
  38. package/src/types/keyboard.types.ts +95 -0
  39. package/src/types/main.types.d.ts +23 -0
  40. package/src/types/main.types.d.ts.map +1 -0
  41. package/src/types/main.types.ts +25 -0
  42. package/src/utils/index.d.ts +6 -0
  43. package/src/utils/index.d.ts.map +1 -0
  44. package/src/utils/index.ts +5 -0
@@ -0,0 +1,3 @@
1
+ export * from "./core.types";
2
+ export * from "./constants";
3
+ export * from "./keyboard.types";
@@ -0,0 +1,2 @@
1
+ export * from "./keyboard.types";
2
+ //# sourceMappingURL=keyboard-types.index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard-types.index.d.ts","sourceRoot":"","sources":["keyboard-types.index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1 @@
1
+ export * from "./keyboard.types";
@@ -0,0 +1,96 @@
1
+ /**
2
+ * @fileoverview Keyboard Types
3
+ * @description Types for inline and reply keyboards
4
+ * @module telegram-message-builder/types
5
+ */
6
+ /**
7
+ * Inline keyboard button
8
+ */
9
+ export interface IInlineKeyboardButton {
10
+ text: string;
11
+ url?: string;
12
+ callback_data?: string;
13
+ web_app?: {
14
+ url: string;
15
+ };
16
+ login_url?: {
17
+ url: string;
18
+ forward_text?: string;
19
+ bot_username?: string;
20
+ request_write_access?: boolean;
21
+ };
22
+ switch_inline_query?: string;
23
+ switch_inline_query_current_chat?: string;
24
+ callback_game?: string;
25
+ pay?: string;
26
+ }
27
+ /**
28
+ * Inline keyboard markup
29
+ */
30
+ export interface IInlineKeyboardMarkup {
31
+ inline_keyboard: IInlineKeyboardButton[][];
32
+ }
33
+ /**
34
+ * Reply keyboard button
35
+ */
36
+ export interface IKeyboardButton {
37
+ text: string;
38
+ request_contact?: boolean;
39
+ request_location?: boolean;
40
+ request_poll?: {
41
+ type: string;
42
+ };
43
+ request_chat?: {
44
+ chat_is_channel: boolean;
45
+ chat_is_forum?: boolean;
46
+ chat_has_username?: boolean;
47
+ chat_is_created: boolean;
48
+ user_administrator_rights?: number[];
49
+ bot_is_member?: boolean;
50
+ };
51
+ request_user?: {
52
+ request_id: number;
53
+ user_is_bot: boolean;
54
+ user_is_premium: boolean;
55
+ };
56
+ web_app?: {
57
+ url: string;
58
+ };
59
+ }
60
+ /**
61
+ * Reply keyboard markup
62
+ */
63
+ export interface IReplyKeyboardMarkup {
64
+ keyboard: IKeyboardButton[][];
65
+ resize_keyboard?: boolean;
66
+ one_time_keyboard?: boolean;
67
+ input_field_placeholder?: string;
68
+ selective?: boolean;
69
+ is_persistent?: boolean;
70
+ }
71
+ /**
72
+ * Force reply markup
73
+ */
74
+ export interface IForceReplyMarkup {
75
+ force_reply: true;
76
+ input_field_placeholder?: string;
77
+ selective?: boolean;
78
+ }
79
+ /**
80
+ * Reply parameters
81
+ */
82
+ export interface IReplyParameters {
83
+ message_id: number;
84
+ allow_sending_without_reply?: boolean;
85
+ quote?: {
86
+ text: string;
87
+ entities?: unknown[];
88
+ parse_mode?: "html" | "markdown" | "markdownv2";
89
+ quote_position?: number;
90
+ };
91
+ quote_parse_mode?: "html" | "markdown" | "markdownv2";
92
+ quote_text?: string;
93
+ quote_entities?: unknown[];
94
+ quote_position?: number;
95
+ }
96
+ //# sourceMappingURL=keyboard.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard.types.d.ts","sourceRoot":"","sources":["keyboard.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1B,SAAS,CAAC,EAAE;QACV,GAAG,EAAE,MAAM,CAAC;QACZ,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,oBAAoB,CAAC,EAAE,OAAO,CAAC;KAChC,CAAC;IACF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gCAAgC,CAAC,EAAE,MAAM,CAAC;IAC1C,aAAa,CAAC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ED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,YAAY,CAAC;QAChD,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,gBAAgB,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,YAAY,CAAC;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,EAAE,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * @fileoverview Keyboard Types
3
+ * @description Types for inline and reply keyboards
4
+ * @module telegram-message-builder/types
5
+ */
6
+
7
+ /**
8
+ * Inline keyboard button
9
+ */
10
+ export interface IInlineKeyboardButton {
11
+ text: string;
12
+ url?: string;
13
+ callback_data?: string;
14
+ web_app?: { url: string };
15
+ login_url?: {
16
+ url: string;
17
+ forward_text?: string;
18
+ bot_username?: string;
19
+ request_write_access?: boolean;
20
+ };
21
+ switch_inline_query?: string;
22
+ switch_inline_query_current_chat?: string;
23
+ callback_game?: string;
24
+ pay?: string;
25
+ }
26
+
27
+ /**
28
+ * Inline keyboard markup
29
+ */
30
+ export interface IInlineKeyboardMarkup {
31
+ inline_keyboard: IInlineKeyboardButton[][];
32
+ }
33
+
34
+ /**
35
+ * Reply keyboard button
36
+ */
37
+ export interface IKeyboardButton {
38
+ text: string;
39
+ request_contact?: boolean;
40
+ request_location?: boolean;
41
+ request_poll?: { type: string };
42
+ request_chat?: {
43
+ chat_is_channel: boolean;
44
+ chat_is_forum?: boolean;
45
+ chat_has_username?: boolean;
46
+ chat_is_created: boolean;
47
+ user_administrator_rights?: number[];
48
+ bot_is_member?: boolean;
49
+ };
50
+ request_user?: {
51
+ request_id: number;
52
+ user_is_bot: boolean;
53
+ user_is_premium: boolean;
54
+ };
55
+ web_app?: { url: string };
56
+ }
57
+
58
+ /**
59
+ * Reply keyboard markup
60
+ */
61
+ export interface IReplyKeyboardMarkup {
62
+ keyboard: IKeyboardButton[][];
63
+ resize_keyboard?: boolean;
64
+ one_time_keyboard?: boolean;
65
+ input_field_placeholder?: string;
66
+ selective?: boolean;
67
+ is_persistent?: boolean;
68
+ }
69
+
70
+ /**
71
+ * Force reply markup
72
+ */
73
+ export interface IForceReplyMarkup {
74
+ force_reply: true;
75
+ input_field_placeholder?: string;
76
+ selective?: boolean;
77
+ }
78
+
79
+ /**
80
+ * Reply parameters
81
+ */
82
+ export interface IReplyParameters {
83
+ message_id: number;
84
+ allow_sending_without_reply?: boolean;
85
+ quote?: {
86
+ text: string;
87
+ entities?: unknown[];
88
+ parse_mode?: "html" | "markdown" | "markdownv2";
89
+ quote_position?: number;
90
+ };
91
+ quote_parse_mode?: "html" | "markdown" | "markdownv2";
92
+ quote_text?: string;
93
+ quote_entities?: unknown[];
94
+ quote_position?: number;
95
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Tipos del dominio principal.
3
+ *
4
+ * @module
5
+ */
6
+ /**
7
+ * Opciones de configuracion para saludos.
8
+ */
9
+ export interface IGreetOptions {
10
+ /**
11
+ * Prefijo del saludo (default: "Hello").
12
+ */
13
+ prefix?: string;
14
+ /**
15
+ * Sufijo del saludo (default: "!").
16
+ */
17
+ suffix?: string;
18
+ }
19
+ /**
20
+ * Callback para notificar eventos.
21
+ */
22
+ export type IEventCallback = (event: string) => void;
23
+ //# sourceMappingURL=main.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.types.d.ts","sourceRoot":"","sources":["main.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Tipos del dominio principal.
3
+ *
4
+ * @module
5
+ */
6
+
7
+ /**
8
+ * Opciones de configuracion para saludos.
9
+ */
10
+ export interface IGreetOptions {
11
+ /**
12
+ * Prefijo del saludo (default: "Hello").
13
+ */
14
+ prefix?: string;
15
+
16
+ /**
17
+ * Sufijo del saludo (default: "!").
18
+ */
19
+ suffix?: string;
20
+ }
21
+
22
+ /**
23
+ * Callback para notificar eventos.
24
+ */
25
+ export type IEventCallback = (event: string) => void;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Utilidades locales del package telegram-message-builder/core.
3
+ *
4
+ * @module
5
+ */
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Utilidades locales del package telegram-message-builder/core.
3
+ *
4
+ * @module
5
+ */