@aracna/telegram-bot 1.9.14 → 2.0.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 (194) hide show
  1. package/apis/telegram-api.d.ts +9 -0
  2. package/apis/telegram-api.js +55 -0
  3. package/apis/telegram-file-api.d.ts +7 -0
  4. package/apis/telegram-file-api.js +14 -0
  5. package/classes/client.d.ts +46 -0
  6. package/classes/client.js +409 -0
  7. package/definitions/constants.d.ts +10 -0
  8. package/definitions/constants.js +53 -1
  9. package/definitions/enums.d.ts +1 -20
  10. package/definitions/enums.js +2 -22
  11. package/definitions/interfaces.d.ts +82 -78
  12. package/definitions/telegram-api-definitions.d.ts +12 -0
  13. package/definitions/telegram-api-definitions.js +2 -0
  14. package/definitions/types.d.ts +3 -2
  15. package/index.d.ts +475 -441
  16. package/index.js +236 -20
  17. package/loggers/class-logger.d.ts +2 -0
  18. package/loggers/{module.logger.js → class-logger.js} +2 -2
  19. package/package.json +12 -3
  20. package/requests/add-requests.d.ts +3 -0
  21. package/requests/add-requests.js +14 -0
  22. package/requests/answer-requests.d.ts +7 -0
  23. package/requests/answer-requests.js +23 -0
  24. package/requests/approve-requests.d.ts +3 -0
  25. package/requests/approve-requests.js +7 -0
  26. package/requests/ban-requests.d.ts +4 -0
  27. package/requests/ban-requests.js +11 -0
  28. package/requests/close-requests.d.ts +4 -0
  29. package/requests/close-requests.js +11 -0
  30. package/requests/copy-requests.d.ts +4 -0
  31. package/requests/copy-requests.js +11 -0
  32. package/requests/create-requests.d.ts +7 -0
  33. package/requests/create-requests.js +30 -0
  34. package/requests/decline-requests.d.ts +3 -0
  35. package/requests/decline-requests.js +7 -0
  36. package/requests/delete-requests.d.ts +10 -0
  37. package/requests/delete-requests.js +35 -0
  38. package/requests/download-requests.d.ts +3 -0
  39. package/requests/download-requests.js +29 -0
  40. package/requests/edit-requests.d.ts +12 -0
  41. package/requests/edit-requests.js +46 -0
  42. package/requests/export-requests.d.ts +3 -0
  43. package/requests/export-requests.js +7 -0
  44. package/requests/forward-requests.d.ts +4 -0
  45. package/requests/forward-requests.js +11 -0
  46. package/requests/get-requests.d.ts +23 -0
  47. package/requests/get-requests.js +92 -0
  48. package/requests/hide-requests.d.ts +3 -0
  49. package/requests/hide-requests.js +7 -0
  50. package/requests/leave-requests.d.ts +3 -0
  51. package/requests/leave-requests.js +7 -0
  52. package/requests/log-requests.d.ts +2 -0
  53. package/requests/log-requests.js +7 -0
  54. package/requests/pin-requests.d.ts +3 -0
  55. package/requests/pin-requests.js +7 -0
  56. package/requests/promote-requests.d.ts +3 -0
  57. package/requests/promote-requests.js +7 -0
  58. package/requests/refund-requests.d.ts +3 -0
  59. package/requests/refund-requests.js +7 -0
  60. package/requests/reopen-requests.d.ts +4 -0
  61. package/requests/reopen-requests.js +11 -0
  62. package/requests/replace-requests.d.ts +3 -0
  63. package/requests/replace-requests.js +14 -0
  64. package/requests/restrict-requests.d.ts +3 -0
  65. package/requests/restrict-requests.js +7 -0
  66. package/requests/revoke-requests.d.ts +3 -0
  67. package/requests/revoke-requests.js +7 -0
  68. package/requests/send-requests.d.ts +24 -0
  69. package/requests/send-requests.js +102 -0
  70. package/requests/set-requests.d.ts +24 -0
  71. package/requests/set-requests.js +95 -0
  72. package/requests/stop-requests.d.ts +4 -0
  73. package/requests/stop-requests.js +11 -0
  74. package/requests/unban-requests.d.ts +4 -0
  75. package/requests/unban-requests.js +11 -0
  76. package/requests/unhide-requests.d.ts +3 -0
  77. package/requests/unhide-requests.js +7 -0
  78. package/requests/unpin-requests.d.ts +6 -0
  79. package/requests/unpin-requests.js +19 -0
  80. package/requests/upload-requests.d.ts +3 -0
  81. package/requests/upload-requests.js +7 -0
  82. package/requests/webhook-requests.d.ts +6 -0
  83. package/requests/webhook-requests.js +20 -0
  84. package/utils/callback-query-utils.d.ts +3 -0
  85. package/utils/callback-query-utils.js +25 -0
  86. package/utils/command-utils.d.ts +5 -0
  87. package/utils/command-utils.js +28 -0
  88. package/utils/context-utils.d.ts +11 -0
  89. package/utils/context-utils.js +42 -0
  90. package/utils/html-utils.d.ts +2 -0
  91. package/utils/html-utils.js +18 -0
  92. package/utils/inline-keyboard-utils.d.ts +12 -0
  93. package/utils/inline-keyboard-utils.js +43 -0
  94. package/utils/reply-to-message-utils.d.ts +6 -0
  95. package/utils/reply-to-message-utils.js +36 -0
  96. package/utils/start-message-utils.d.ts +6 -0
  97. package/utils/start-message-utils.js +40 -0
  98. package/builders/button.builder.d.ts +0 -11
  99. package/builders/button.builder.js +0 -31
  100. package/childs/add.d.ts +0 -6
  101. package/childs/add.js +0 -10
  102. package/childs/answer.d.ts +0 -10
  103. package/childs/answer.js +0 -22
  104. package/childs/approve.d.ts +0 -6
  105. package/childs/approve.js +0 -10
  106. package/childs/ban.d.ts +0 -7
  107. package/childs/ban.js +0 -13
  108. package/childs/close.d.ts +0 -7
  109. package/childs/close.js +0 -13
  110. package/childs/copy.d.ts +0 -7
  111. package/childs/copy.js +0 -13
  112. package/childs/create.d.ts +0 -10
  113. package/childs/create.js +0 -26
  114. package/childs/decline.d.ts +0 -6
  115. package/childs/decline.js +0 -10
  116. package/childs/delete.d.ts +0 -13
  117. package/childs/delete.js +0 -31
  118. package/childs/download.d.ts +0 -8
  119. package/childs/download.js +0 -32
  120. package/childs/edit.d.ts +0 -14
  121. package/childs/edit.js +0 -38
  122. package/childs/export.d.ts +0 -6
  123. package/childs/export.js +0 -10
  124. package/childs/forward.d.ts +0 -7
  125. package/childs/forward.js +0 -13
  126. package/childs/get.d.ts +0 -26
  127. package/childs/get.js +0 -73
  128. package/childs/hide.d.ts +0 -6
  129. package/childs/hide.js +0 -10
  130. package/childs/leave.d.ts +0 -6
  131. package/childs/leave.js +0 -10
  132. package/childs/log.d.ts +0 -5
  133. package/childs/log.js +0 -10
  134. package/childs/pin.d.ts +0 -6
  135. package/childs/pin.js +0 -10
  136. package/childs/polling.d.ts +0 -9
  137. package/childs/polling.js +0 -34
  138. package/childs/privates/send.private.d.ts +0 -8
  139. package/childs/privates/send.private.js +0 -19
  140. package/childs/promote.d.ts +0 -6
  141. package/childs/promote.js +0 -10
  142. package/childs/refund.d.ts +0 -6
  143. package/childs/refund.js +0 -14
  144. package/childs/reopen.d.ts +0 -7
  145. package/childs/reopen.js +0 -13
  146. package/childs/replace.d.ts +0 -6
  147. package/childs/replace.js +0 -10
  148. package/childs/restrict.d.ts +0 -6
  149. package/childs/restrict.js +0 -13
  150. package/childs/revoke.d.ts +0 -6
  151. package/childs/revoke.js +0 -10
  152. package/childs/send.d.ts +0 -32
  153. package/childs/send.js +0 -111
  154. package/childs/set.d.ts +0 -28
  155. package/childs/set.js +0 -82
  156. package/childs/stop.d.ts +0 -7
  157. package/childs/stop.js +0 -13
  158. package/childs/unban.d.ts +0 -7
  159. package/childs/unban.js +0 -13
  160. package/childs/unhide.d.ts +0 -6
  161. package/childs/unhide.js +0 -10
  162. package/childs/unpin.d.ts +0 -9
  163. package/childs/unpin.js +0 -23
  164. package/childs/upload.d.ts +0 -6
  165. package/childs/upload.js +0 -10
  166. package/childs/webhook.d.ts +0 -10
  167. package/childs/webhook.js +0 -28
  168. package/loggers/module.logger.d.ts +0 -2
  169. package/modules/api.d.ts +0 -5
  170. package/modules/api.js +0 -24
  171. package/modules/builder.d.ts +0 -4
  172. package/modules/builder.js +0 -8
  173. package/modules/child.d.ts +0 -5
  174. package/modules/child.js +0 -10
  175. package/modules/configuration.d.ts +0 -8
  176. package/modules/configuration.js +0 -10
  177. package/modules/dummy.d.ts +0 -9
  178. package/modules/dummy.js +0 -56
  179. package/modules/telegram.d.ts +0 -109
  180. package/modules/telegram.js +0 -391
  181. package/utils/callback.query.utils.d.ts +0 -5
  182. package/utils/callback.query.utils.js +0 -26
  183. package/utils/command.utils.d.ts +0 -7
  184. package/utils/command.utils.js +0 -29
  185. package/utils/context.utils.d.ts +0 -13
  186. package/utils/context.utils.js +0 -41
  187. package/utils/html.utils.d.ts +0 -5
  188. package/utils/html.utils.js +0 -20
  189. package/utils/inline.keyboard.utils.d.ts +0 -4
  190. package/utils/inline.keyboard.utils.js +0 -26
  191. package/utils/reply.to.message.utils.d.ts +0 -6
  192. package/utils/reply.to.message.utils.js +0 -27
  193. package/utils/start.utils.d.ts +0 -7
  194. package/utils/start.utils.js +0 -32
package/childs/reopen.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Reopen = void 0;
4
- const child_1 = require("../modules/child");
5
- class Reopen extends child_1.Child {
6
- async forumTopic(chatID, messageThreadID, parameters) {
7
- return this.telegram.api.post('reopenForumTopic', { chat_id: chatID, message_thread_id: messageThreadID, ...parameters });
8
- }
9
- async generalForumTopic(chatID, parameters) {
10
- return this.telegram.api.post('reopenGeneralForumTopic', { chat_id: chatID, ...parameters });
11
- }
12
- }
13
- exports.Reopen = Reopen;
@@ -1,6 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { InputSticker, ReplaceStickerInSet } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Replace extends Child {
5
- stickerInSet(userID: bigint, sticker: InputSticker, parameters: Omit<ReplaceStickerInSet, 'sticker' | 'user_id'>): Promise<boolean | FetchError>;
6
- }
package/childs/replace.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Replace = void 0;
4
- const child_1 = require("../modules/child");
5
- class Replace extends child_1.Child {
6
- async stickerInSet(userID, sticker, parameters) {
7
- return this.telegram.api.post('replaceStickerInSet', { sticker: sticker, user_id: userID, ...parameters });
8
- }
9
- }
10
- exports.Replace = Replace;
@@ -1,6 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { ChatPermissions, RestrictChatMember } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Restrict extends Child {
5
- chatMember(permissions: ChatPermissions, parameters: Omit<RestrictChatMember, 'permissions'>): Promise<boolean | FetchError>;
6
- }
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Restrict = void 0;
4
- const child_1 = require("../modules/child");
5
- class Restrict extends child_1.Child {
6
- async chatMember(permissions, parameters) {
7
- return this.telegram.api.post('restrictChatMember', {
8
- permissions: permissions,
9
- ...parameters
10
- });
11
- }
12
- }
13
- exports.Restrict = Restrict;
@@ -1,6 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { ChatInviteLink, RevokeChatInviteLink } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Revoke extends Child {
5
- chatInviteLink(chatID: bigint, inviteLink: string, parameters?: Partial<RevokeChatInviteLink>): Promise<ChatInviteLink | FetchError>;
6
- }
package/childs/revoke.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Revoke = void 0;
4
- const child_1 = require("../modules/child");
5
- class Revoke extends child_1.Child {
6
- async chatInviteLink(chatID, inviteLink, parameters) {
7
- return this.telegram.api.post('revokeChatInviteLink', { chat_id: chatID, invite_link: inviteLink, ...parameters });
8
- }
9
- }
10
- exports.Revoke = Revoke;
package/childs/send.d.ts DELETED
@@ -1,32 +0,0 @@
1
- import { type FetchError } from '@aracna/core';
2
- import type { InlineKeyboardButton, InputPollOption, LabeledPrice, Message, SendAnimation, SendAudio, SendChatAction, SendContact, SendDice, SendDocument, SendGame, SendInvoice, SendLocation, SendMediaGroup, SendMessage, SendPaidMedia, SendPhoto, SendPoll, SendSticker, SendVenue, SendVideo, SendVideoNote, SendVoice } from '@aracna/telegram-bot-types';
3
- import type { InputMediaAlternative, InputPaidMediaAlternative, SendRepliable } from '../definitions/interfaces';
4
- import type { InputFile } from '../definitions/types';
5
- import { Child } from '../modules/child';
6
- import { SendPrivate } from './privates/send.private';
7
- export declare class Send extends Child {
8
- private: SendPrivate;
9
- animation(chatID: bigint, file: InputFile, parameters?: Partial<SendAnimation>): Promise<Message | FetchError>;
10
- audio(chatID: bigint, file: InputFile, parameters?: Partial<SendAudio>): Promise<Message | FetchError>;
11
- document(chatID: bigint, file: InputFile, parameters?: Partial<SendDocument>): Promise<Message | FetchError>;
12
- buttons(chatID: bigint, text: string, buttons: InlineKeyboardButton[], parameters?: Partial<SendMessage>): Promise<Message | FetchError | Error>;
13
- chatAction(chatID: bigint, action: string, parameters?: Partial<SendChatAction>): Promise<boolean | FetchError>;
14
- contact(chatID: bigint, parameters: Omit<SendContact, 'chat_id'>): Promise<Message | FetchError>;
15
- dice(chatID: bigint, parameters?: Partial<SendDice>): Promise<Message | FetchError>;
16
- game(chatID: bigint, gameShortName: string, parameters?: Partial<SendGame>): Promise<Message | FetchError>;
17
- html(chatID: bigint, text: string, parameters?: Partial<SendMessage>): Promise<Message | FetchError>;
18
- invoice(chatID: bigint, prices: LabeledPrice[], parameters: Omit<SendInvoice, 'chat_id' | 'prices'>): Promise<Message | FetchError>;
19
- location(chatID: bigint, parameters: Omit<SendLocation, 'chat_id'>): Promise<Message | FetchError>;
20
- mediaGroup(chatID: bigint, media: InputMediaAlternative[], parameters?: Partial<SendMediaGroup>): Promise<Message | FetchError>;
21
- message(chatID: bigint, text: string, parameters?: Partial<SendMessage>): Promise<Message | FetchError>;
22
- paidMedia(chatID: bigint, media: InputPaidMediaAlternative[], stars: number, parameters?: Partial<SendPaidMedia>): Promise<Message | FetchError>;
23
- photo(chatID: bigint, file: InputFile, parameters?: Partial<SendPhoto>): Promise<Message | FetchError>;
24
- poll(chatID: bigint, question: string, options: InputPollOption[], parameters?: Partial<SendPoll>): Promise<Message | FetchError>;
25
- repliable<T>(chatID: bigint, data: T, parameters: Omit<SendRepliable, 'chat_id' | 'data'>): Promise<Message | FetchError>;
26
- sticker(chatID: bigint, file: InputFile, parameters?: Partial<SendSticker>): Promise<Message | FetchError>;
27
- venue(chatID: bigint, parameters: Omit<SendVenue, 'chat_id'>): Promise<Message | FetchError>;
28
- video(chatID: bigint, file: InputFile, parameters?: Partial<SendVideo>): Promise<Message | FetchError>;
29
- videoNote(chatID: bigint, file: InputFile, parameters?: Partial<SendVideoNote>): Promise<Message | FetchError>;
30
- voice(chatID: bigint, file: InputFile, parameters?: Partial<SendVoice>): Promise<Message | FetchError>;
31
- private file;
32
- }
package/childs/send.js DELETED
@@ -1,111 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Send = void 0;
4
- const core_1 = require("@aracna/core");
5
- const child_1 = require("../modules/child");
6
- const configuration_1 = require("../modules/configuration");
7
- const html_utils_1 = require("../utils/html.utils");
8
- const inline_keyboard_utils_1 = require("../utils/inline.keyboard.utils");
9
- const reply_to_message_utils_1 = require("../utils/reply.to.message.utils");
10
- const send_private_1 = require("./privates/send.private");
11
- class Send extends child_1.Child {
12
- private = new send_private_1.SendPrivate(this.telegram);
13
- async animation(chatID, file, parameters) {
14
- return this.file(chatID, file, 'animation', parameters);
15
- }
16
- async audio(chatID, file, parameters) {
17
- return this.file(chatID, file, 'audio', parameters);
18
- }
19
- async document(chatID, file, parameters) {
20
- return this.file(chatID, file, 'document', parameters);
21
- }
22
- async buttons(chatID, text, buttons, parameters) {
23
- return buttons.length <= 0
24
- ? configuration_1.Configuration.handler.send.buttons.empty(chatID)
25
- : this.message(chatID, text, {
26
- reply_markup: {
27
- inline_keyboard: buttons
28
- .concat(await (0, core_1.getObjectProperty)(configuration_1.Configuration.default.buttons, inline_keyboard_utils_1.InlineKeyboardUtils.getButtonsType(buttons), async (chatID) => [])(chatID))
29
- .map((v) => [v])
30
- },
31
- ...parameters
32
- });
33
- }
34
- async chatAction(chatID, action, parameters) {
35
- return this.telegram.api.post('sendChatAction', { action: action, chat_id: chatID, ...parameters });
36
- }
37
- async contact(chatID, parameters) {
38
- return this.telegram.api.post('sendContact', { chat_id: chatID, ...parameters });
39
- }
40
- async dice(chatID, parameters) {
41
- return this.telegram.api.post('sendDice', { chat_id: chatID, ...parameters });
42
- }
43
- async game(chatID, gameShortName, parameters) {
44
- return this.telegram.api.post('sendGame', { chat_id: chatID, game_short_name: gameShortName, ...parameters });
45
- }
46
- async html(chatID, text, parameters) {
47
- return this.message(chatID, html_utils_1.HTMLUtils.sanitize(text), { parse_mode: 'HTML', ...parameters });
48
- }
49
- async invoice(chatID, prices, parameters) {
50
- return this.telegram.api.post('sendInvoice', { chat_id: chatID, prices: prices, ...parameters });
51
- }
52
- async location(chatID, parameters) {
53
- return this.telegram.api.post('sendLocation', { chat_id: chatID, ...parameters });
54
- }
55
- async mediaGroup(chatID, media, parameters) {
56
- return this.telegram.api.post('sendMediaGroup', media.every((v) => v.media instanceof Buffer)
57
- ? {
58
- chat_id: chatID,
59
- media: media.map((v, k) => ({ ...v, media: `attach://media_${k}` })),
60
- ...media.reduce((r, v, k) => ({ ...r, [`media_${k}`]: v.media }), {}),
61
- ...parameters
62
- }
63
- : { chat_id: chatID, media: media, ...parameters });
64
- }
65
- async message(chatID, text, parameters) {
66
- return this.telegram.api.post('sendMessage', { chat_id: chatID, text: text, ...parameters });
67
- }
68
- async paidMedia(chatID, media, stars, parameters) {
69
- return this.telegram.api.post('sendPaidMedia', {
70
- chat_id: chatID,
71
- media: media.map((v, k) => ({ ...v, media: `attach://media_${k}` })),
72
- ...media.reduce((r, v, k) => ({ ...r, [`media_${k}`]: v.media }), {}),
73
- star_count: stars,
74
- ...parameters
75
- });
76
- }
77
- async photo(chatID, file, parameters) {
78
- return this.file(chatID, file, 'photo', parameters);
79
- }
80
- async poll(chatID, question, options, parameters) {
81
- return this.telegram.api.post('sendPoll', { chat_id: chatID, options: options, question: question, ...parameters });
82
- }
83
- async repliable(chatID, data, parameters) {
84
- return this.html(chatID, parameters.text + reply_to_message_utils_1.ReplyToMessageUtils.encodeBody(data, parameters.type, parameters.from_chat_id), {
85
- reply_markup: { force_reply: true, selective: true },
86
- ...parameters
87
- });
88
- }
89
- async sticker(chatID, file, parameters) {
90
- return this.file(chatID, file, 'sticker', parameters);
91
- }
92
- async venue(chatID, parameters) {
93
- return this.telegram.api.post('sendVenue', {
94
- chat_id: chatID,
95
- ...parameters
96
- });
97
- }
98
- async video(chatID, file, parameters) {
99
- return this.file(chatID, file, 'video', parameters);
100
- }
101
- async videoNote(chatID, file, parameters) {
102
- return this.file(chatID, file, 'video_note', parameters);
103
- }
104
- async voice(chatID, file, parameters) {
105
- return this.file(chatID, file, 'voice', parameters);
106
- }
107
- file(chatID, data, type, parameters) {
108
- return this.telegram.api.post('send' + (0, core_1.getPascalCaseString)(type), { chat_id: chatID, [type]: data, ...parameters });
109
- }
110
- }
111
- exports.Send = Send;
package/childs/set.d.ts DELETED
@@ -1,28 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { BotCommand, ChatAdministratorRights, ChatPermissions, MaskPosition, MenuButton, PassportElementError, ReactionType, SetChatAdministratorCustomTitle, SetChatDescription, SetChatMenuButton, SetChatPermissions, SetChatPhoto, SetChatStickerSet, SetChatTitle, SetCustomEmojiStickerSetThumbnail, SetGameScore, SetMessageReaction, SetMyCommands, SetMyDefaultAdministratorRights, SetMyDescription, SetMyName, SetMyShortDescription, SetPassportDataErrors, SetStickerEmojiList, SetStickerKeywords, SetStickerMaskPosition, SetStickerPositionInSet, SetStickerSetThumbnail, SetStickerSetTitle } from '@aracna/telegram-bot-types';
3
- import type { InputFile } from '../definitions/types';
4
- import { Child } from '../modules/child';
5
- export declare class Set extends Child {
6
- chatAdministratorCustomTitle(customTitle: string, parameters: Omit<SetChatAdministratorCustomTitle, 'custom_title'>): Promise<boolean | FetchError>;
7
- chatDescription(chatID: bigint, description?: string, parameters?: Partial<SetChatDescription>): Promise<boolean | FetchError>;
8
- chatMenuButton(chatID: bigint, menuButton?: MenuButton, parameters?: Partial<SetChatMenuButton>): Promise<boolean | FetchError>;
9
- chatPermissions(chatID: bigint, permissions: ChatPermissions, parameters?: Partial<SetChatPermissions>): Promise<boolean | FetchError>;
10
- chatPhoto(chatID: bigint, photo: InputFile, parameters?: Partial<SetChatPhoto>): Promise<boolean | FetchError>;
11
- chatStickerSet(chatID: bigint, stickerSetName: string, parameters?: Partial<SetChatStickerSet>): Promise<boolean | FetchError>;
12
- chatTitle(chatID: bigint, title: string, parameters?: Partial<SetChatTitle>): Promise<boolean | FetchError>;
13
- commands(commands: BotCommand[], parameters?: Partial<SetMyCommands>): Promise<boolean | FetchError>;
14
- customEmojiStickerSetThumbnail(name: string, customEmojiID?: string, parameters?: Partial<SetCustomEmojiStickerSetThumbnail>): Promise<boolean | FetchError>;
15
- defaultAdministratorRights(rights: ChatAdministratorRights, parameters?: Partial<SetMyDefaultAdministratorRights>): Promise<boolean | FetchError>;
16
- description(description?: string, parameters?: Partial<SetMyDescription>): Promise<boolean | FetchError>;
17
- gameScore(userID: bigint, score: number, parameters?: Partial<SetGameScore>): Promise<boolean | FetchError>;
18
- messageReaction(chatID: bigint, messageID: number, reaction: ReactionType[], parameters?: Partial<SetMessageReaction>): Promise<boolean | FetchError>;
19
- name(name?: string, parameters?: Partial<SetMyName>): Promise<boolean | FetchError>;
20
- passportDataErrors(userID: bigint, errors: PassportElementError[], parameters?: Partial<SetPassportDataErrors>): Promise<boolean | FetchError>;
21
- shortDescription(shortDescription?: string, parameters?: Partial<SetMyShortDescription>): Promise<boolean | FetchError>;
22
- stickerEmojiList(sticker: string, emojis: string[], parameters?: Partial<SetStickerEmojiList>): Promise<boolean | FetchError>;
23
- stickerKeywords(sticker: string, keywords?: string[], parameters?: Partial<SetStickerKeywords>): Promise<boolean | FetchError>;
24
- stickerMaskPosition(sticker: string, maskPosition?: MaskPosition, parameters?: Partial<SetStickerMaskPosition>): Promise<boolean | FetchError>;
25
- stickerPositionInSet(sticker: string, position: number, parameters?: Partial<SetStickerPositionInSet>): Promise<boolean | FetchError>;
26
- stickerSetThumbnail(userID: bigint, parameters: Omit<SetStickerSetThumbnail, 'user_id'>): Promise<boolean | FetchError>;
27
- stickerSetTitle(name: string, title: string, parameters?: Partial<SetStickerSetTitle>): Promise<boolean | FetchError>;
28
- }
package/childs/set.js DELETED
@@ -1,82 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Set = void 0;
4
- const child_1 = require("../modules/child");
5
- class Set extends child_1.Child {
6
- async chatAdministratorCustomTitle(customTitle, parameters) {
7
- return this.telegram.api.post('setChatAdministratorCustomTitle', { custom_title: customTitle, ...parameters });
8
- }
9
- async chatDescription(chatID, description, parameters) {
10
- return this.telegram.api.post('setChatDescription', { chat_id: chatID, description: description, ...parameters });
11
- }
12
- async chatMenuButton(chatID, menuButton, parameters) {
13
- return this.telegram.api.post('setChatMenuButton', { chat_id: chatID, menu_button: menuButton, ...parameters });
14
- }
15
- async chatPermissions(chatID, permissions, parameters) {
16
- return this.telegram.api.post('setChatPermissions', { chat_id: chatID, permissions: permissions, ...parameters });
17
- }
18
- async chatPhoto(chatID, photo, parameters) {
19
- return this.telegram.api.post('setChatPhoto', { chat_id: chatID, photo: photo, ...parameters });
20
- }
21
- async chatStickerSet(chatID, stickerSetName, parameters) {
22
- return this.telegram.api.post('setChatStickerSet', { chat_id: chatID, sticker_set_name: stickerSetName, ...parameters });
23
- }
24
- async chatTitle(chatID, title, parameters) {
25
- return this.telegram.api.post('setChatTitle', { chat_id: chatID, title: title, ...parameters });
26
- }
27
- async commands(commands, parameters) {
28
- return this.telegram.api.post('setMyCommands', { commands: commands, ...parameters });
29
- }
30
- async customEmojiStickerSetThumbnail(name, customEmojiID, parameters) {
31
- return this.telegram.api.post('setCustomEmojiStickerSetThumbnail', {
32
- custom_emoji_id: customEmojiID,
33
- name: name,
34
- ...parameters
35
- });
36
- }
37
- async defaultAdministratorRights(rights, parameters) {
38
- return this.telegram.api.post('setMyDefaultAdministratorRights', { rights: rights, ...parameters });
39
- }
40
- async description(description, parameters) {
41
- return this.telegram.api.post('setMyDescription', { description: description, ...parameters });
42
- }
43
- async gameScore(userID, score, parameters) {
44
- return this.telegram.api.post('setGameScore', { score: score, user_id: userID, ...parameters });
45
- }
46
- async messageReaction(chatID, messageID, reaction, parameters) {
47
- return this.telegram.api.post('setMessageReaction', {
48
- chat_id: chatID,
49
- message_id: messageID,
50
- reaction: reaction,
51
- ...parameters
52
- });
53
- }
54
- async name(name, parameters) {
55
- return this.telegram.api.post('setMyName', { name: name, ...parameters });
56
- }
57
- async passportDataErrors(userID, errors, parameters) {
58
- return this.telegram.api.post('setPassportDataErrors', { errors: errors, user_id: userID, ...parameters });
59
- }
60
- async shortDescription(shortDescription, parameters) {
61
- return this.telegram.api.post('setMyShortDescription', { short_description: shortDescription, ...parameters });
62
- }
63
- async stickerEmojiList(sticker, emojis, parameters) {
64
- return this.telegram.api.post('setStickerEmojiList', { emoji_list: emojis, sticker: sticker, ...parameters });
65
- }
66
- async stickerKeywords(sticker, keywords, parameters) {
67
- return this.telegram.api.post('setStickerKeywords', { keywords: keywords, sticker: sticker, ...parameters });
68
- }
69
- async stickerMaskPosition(sticker, maskPosition, parameters) {
70
- return this.telegram.api.post('setStickerMaskPosition', { mask_position: maskPosition, sticker: sticker, ...parameters });
71
- }
72
- async stickerPositionInSet(sticker, position, parameters) {
73
- return this.telegram.api.post('setStickerPositionInSet', { position: position, sticker: sticker, ...parameters });
74
- }
75
- async stickerSetThumbnail(userID, parameters) {
76
- return this.telegram.api.post('setStickerSetThumbnail', { user_id: userID, ...parameters });
77
- }
78
- async stickerSetTitle(name, title, parameters) {
79
- return this.telegram.api.post('setStickerSetTitle', { name: name, title: title, ...parameters });
80
- }
81
- }
82
- exports.Set = Set;
package/childs/stop.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { Message, Poll, StopMessageLiveLocation, StopPoll } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Stop extends Child {
5
- messageLiveLocation(parameters: StopMessageLiveLocation): Promise<Message | boolean | FetchError>;
6
- poll(chatID: bigint, messageID: number, parameters?: Partial<StopPoll>): Promise<Poll | FetchError>;
7
- }
package/childs/stop.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Stop = void 0;
4
- const child_1 = require("../modules/child");
5
- class Stop extends child_1.Child {
6
- async messageLiveLocation(parameters) {
7
- return this.telegram.api.post('stopMessageLiveLocation', parameters);
8
- }
9
- async poll(chatID, messageID, parameters) {
10
- return this.telegram.api.post('stopPoll', { chat_id: chatID, message_id: messageID, ...parameters });
11
- }
12
- }
13
- exports.Stop = Stop;
package/childs/unban.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { UnbanChatMember, UnbanChatSenderChat } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Unban extends Child {
5
- chatMember(parameters: UnbanChatMember): Promise<boolean | FetchError>;
6
- chatSenderChat(parameters: UnbanChatSenderChat): Promise<boolean | FetchError>;
7
- }
package/childs/unban.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Unban = void 0;
4
- const child_1 = require("../modules/child");
5
- class Unban extends child_1.Child {
6
- async chatMember(parameters) {
7
- return this.telegram.api.post('unbanChatMember', parameters);
8
- }
9
- async chatSenderChat(parameters) {
10
- return this.telegram.api.post('unbanChatSenderChat', parameters);
11
- }
12
- }
13
- exports.Unban = Unban;
@@ -1,6 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { HideGeneralForumTopic } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Unhide extends Child {
5
- generalForumTopic(chatID: bigint, parameters?: Partial<HideGeneralForumTopic>): Promise<boolean | FetchError>;
6
- }
package/childs/unhide.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Unhide = void 0;
4
- const child_1 = require("../modules/child");
5
- class Unhide extends child_1.Child {
6
- async generalForumTopic(chatID, parameters) {
7
- return this.telegram.api.post('unhideGeneralForumTopic', { chat_id: chatID, ...parameters });
8
- }
9
- }
10
- exports.Unhide = Unhide;
package/childs/unpin.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { UnpinAllChatMessages, UnpinAllForumTopicMessages, UnpinAllGeneralForumTopicMessages, UnpinChatMessage } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Unpin extends Child {
5
- allChatMessages(chatID: bigint, parameters?: Partial<UnpinAllChatMessages>): Promise<boolean | FetchError>;
6
- allForumTopicMessages(chatID: bigint, messageThreadID: number, parameters?: Partial<UnpinAllForumTopicMessages>): Promise<boolean | FetchError>;
7
- allGeneralForumTopicMessages(chatID: bigint, parameters?: Partial<UnpinAllGeneralForumTopicMessages>): Promise<boolean | FetchError>;
8
- chatMessage(chatID: bigint, parameters?: Partial<UnpinChatMessage>): Promise<boolean | FetchError>;
9
- }
package/childs/unpin.js DELETED
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Unpin = void 0;
4
- const child_1 = require("../modules/child");
5
- class Unpin extends child_1.Child {
6
- async allChatMessages(chatID, parameters) {
7
- return this.telegram.api.post('unpinAllChatMessages', { chat_id: chatID, ...parameters });
8
- }
9
- async allForumTopicMessages(chatID, messageThreadID, parameters) {
10
- return this.telegram.api.post('unpinAllForumTopicMessages', {
11
- chat_id: chatID,
12
- message_thread_id: messageThreadID,
13
- ...parameters
14
- });
15
- }
16
- async allGeneralForumTopicMessages(chatID, parameters) {
17
- return this.telegram.api.post('unpinAllGeneralForumTopicMessages', { chat_id: chatID, ...parameters });
18
- }
19
- async chatMessage(chatID, parameters) {
20
- return this.telegram.api.post('unpinChatMessage', { chat_id: chatID, ...parameters });
21
- }
22
- }
23
- exports.Unpin = Unpin;
@@ -1,6 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { File, UploadStickerFile } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Upload extends Child {
5
- stickerFile(userID: bigint, parameters: Omit<UploadStickerFile, 'user_id'>): Promise<File | FetchError>;
6
- }
package/childs/upload.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Upload = void 0;
4
- const child_1 = require("../modules/child");
5
- class Upload extends child_1.Child {
6
- async stickerFile(userID, parameters) {
7
- return this.telegram.api.post('uploadStickerFile', { user_id: userID, ...parameters });
8
- }
9
- }
10
- exports.Upload = Upload;
@@ -1,10 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { DeleteWebhook, SetWebhook, WebhookInfo } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Webhook extends Child {
5
- close(): Promise<boolean | FetchError>;
6
- delete(parameters?: Partial<DeleteWebhook>): Promise<boolean | FetchError>;
7
- getInfo(): Promise<WebhookInfo | FetchError>;
8
- set(route?: string, parameters?: Partial<SetWebhook>): Promise<boolean | FetchError>;
9
- url(route: string): string;
10
- }
package/childs/webhook.js DELETED
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Webhook = void 0;
4
- const enums_1 = require("../definitions/enums");
5
- const child_1 = require("../modules/child");
6
- class Webhook extends child_1.Child {
7
- async close() {
8
- return this.telegram.api.post('close');
9
- }
10
- async delete(parameters) {
11
- return this.telegram.api.post('deleteWebhook', parameters);
12
- }
13
- async getInfo() {
14
- return this.telegram.api.post('getWebhookInfo');
15
- }
16
- async set(route = '', parameters) {
17
- return this.telegram.api.post('setWebhook', {
18
- allowed_updates: Object.values(enums_1.UpdateType).map((v) => v.toLowerCase()),
19
- max_connections: 100,
20
- url: this.url(route),
21
- ...parameters
22
- });
23
- }
24
- url(route) {
25
- return 'https://' + this.telegram.hostname + ':' + this.telegram.port + '/' + route + 'bot' + this.telegram.token;
26
- }
27
- }
28
- exports.Webhook = Webhook;
@@ -1,2 +0,0 @@
1
- import { Logger } from '@aracna/core';
2
- export declare const ModuleLogger: Logger;
package/modules/api.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { type FetchError, type RequestMethod, RestAPI, type RestApiConfig } from '@aracna/core';
2
- export declare class API extends RestAPI {
3
- post<V, W, X = undefined>(path: string, body?: W, config?: RestApiConfig<void>): Promise<V | FetchError<X>>;
4
- transformBody<V>(method: RequestMethod, path: string, body: V, config: RestApiConfig<void>): Promise<FormData>;
5
- }
package/modules/api.js DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.API = void 0;
4
- const core_1 = require("@aracna/core");
5
- class API extends core_1.RestAPI {
6
- async post(path, body, config) {
7
- let response;
8
- response = await this.post(path, body, config);
9
- if (response instanceof Error)
10
- return response;
11
- return response.data.result;
12
- }
13
- async transformBody(method, path, body, config) {
14
- switch (method) {
15
- case 'GET':
16
- case 'POST':
17
- await (0, core_1.useNodeFetch)(await (0, core_1.importNodeFetch)());
18
- return (0, core_1.serializeFormData)(typeof body === 'object' ? body : {});
19
- default:
20
- return (0, core_1.serializeFormData)({});
21
- }
22
- }
23
- }
24
- exports.API = API;
@@ -1,4 +0,0 @@
1
- import { ButtonBuilder } from '../builders/button.builder';
2
- export declare class Builder {
3
- button: ButtonBuilder;
4
- }
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Builder = void 0;
4
- const button_builder_1 = require("../builders/button.builder");
5
- class Builder {
6
- button = new button_builder_1.ButtonBuilder();
7
- }
8
- exports.Builder = Builder;
@@ -1,5 +0,0 @@
1
- import type { Telegram } from './telegram';
2
- export declare class Child {
3
- protected telegram: Telegram;
4
- constructor(telegram: Telegram);
5
- }
package/modules/child.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Child = void 0;
4
- class Child {
5
- telegram;
6
- constructor(telegram) {
7
- this.telegram = telegram;
8
- }
9
- }
10
- exports.Child = Child;
@@ -1,8 +0,0 @@
1
- import type { ConfigurationAPI, ConfigurationDefault, ConfigurationHandler } from '../definitions/interfaces';
2
- declare class ConfigurationBuilder {
3
- api: ConfigurationAPI;
4
- default: ConfigurationDefault;
5
- handler: ConfigurationHandler;
6
- }
7
- export declare const Configuration: ConfigurationBuilder;
8
- export {};
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Configuration = void 0;
4
- const dummy_1 = require("./dummy");
5
- class ConfigurationBuilder {
6
- api = dummy_1.Dummy.configurationAPI;
7
- default = dummy_1.Dummy.configurationDefault;
8
- handler = dummy_1.Dummy.configurationHandler;
9
- }
10
- exports.Configuration = new ConfigurationBuilder();
@@ -1,9 +0,0 @@
1
- import type { CallbackQueryBody, ConfigurationAPI, ConfigurationDefault, ConfigurationHandler, Handler, MessageBody } from '../definitions/interfaces';
2
- export declare class Dummy {
3
- static get callbackQueryBody(): CallbackQueryBody;
4
- static get configurationAPI(): ConfigurationAPI;
5
- static get configurationDefault(): ConfigurationDefault;
6
- static get configurationHandler(): ConfigurationHandler;
7
- static get handler(): Handler<any, any>;
8
- static get messageBody(): MessageBody;
9
- }