@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/ban.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { BanChatMember, BanChatSenderChat } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Ban extends Child {
5
- chatMember(parameters: BanChatMember): Promise<boolean | FetchError>;
6
- chatSenderChat(parameters: BanChatSenderChat): Promise<boolean | FetchError>;
7
- }
package/childs/ban.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Ban = void 0;
4
- const child_1 = require("../modules/child");
5
- class Ban extends child_1.Child {
6
- async chatMember(parameters) {
7
- return this.telegram.api.post('banChatMember', parameters);
8
- }
9
- async chatSenderChat(parameters) {
10
- return this.telegram.api.post('banChatSenderChat', parameters);
11
- }
12
- }
13
- exports.Ban = Ban;
package/childs/close.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { CloseForumTopic, CloseGeneralForumTopic } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Close extends Child {
5
- forumTopic(chatID: bigint, messageThreadID: number, parameters?: Partial<CloseForumTopic>): Promise<boolean | FetchError>;
6
- generalForumTopic(chatID: bigint, parameters?: Partial<CloseGeneralForumTopic>): Promise<boolean | FetchError>;
7
- }
package/childs/close.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Close = void 0;
4
- const child_1 = require("../modules/child");
5
- class Close extends child_1.Child {
6
- async forumTopic(chatID, messageThreadID, parameters) {
7
- return this.telegram.api.post('closeForumTopic', { chat_id: chatID, message_thread_id: messageThreadID, ...parameters });
8
- }
9
- async generalForumTopic(chatID, parameters) {
10
- return this.telegram.api.post('closeGeneralForumTopic', { chat_id: chatID, ...parameters });
11
- }
12
- }
13
- exports.Close = Close;
package/childs/copy.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { CopyMessage, CopyMessages, MessageId } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Copy extends Child {
5
- message(messageID: number, parameters: Omit<CopyMessage, 'message_id'>): Promise<MessageId | FetchError>;
6
- messages(messageIDs: number[], parameters: Omit<CopyMessages, 'message_ids'>): Promise<MessageId[] | FetchError>;
7
- }
package/childs/copy.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Copy = void 0;
4
- const child_1 = require("../modules/child");
5
- class Copy extends child_1.Child {
6
- async message(messageID, parameters) {
7
- return this.telegram.api.post('copyMessage', { message_id: messageID, ...parameters });
8
- }
9
- async messages(messageIDs, parameters) {
10
- return this.telegram.api.post('copyMessages', { message_ids: messageIDs, ...parameters });
11
- }
12
- }
13
- exports.Copy = Copy;
@@ -1,10 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { ChatInviteLink, CreateChatInviteLink, CreateChatSubscriptionInviteLink, CreateForumTopic, CreateInvoiceLink, CreateNewStickerSet, InputSticker, LabeledPrice } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Create extends Child {
5
- chatInviteLink(chatID: bigint, parameters?: Partial<CreateChatInviteLink>): Promise<ChatInviteLink | FetchError>;
6
- chatSubscriptionInviteLink(chatID: bigint, parameters: Omit<CreateChatSubscriptionInviteLink, 'chat_id'>): Promise<ChatInviteLink | FetchError>;
7
- forumTopic(chatID: bigint, name: string, parameters?: Partial<CreateForumTopic>): Promise<boolean | FetchError<undefined>>;
8
- invoiceLink(prices: LabeledPrice[], parameters: Omit<CreateInvoiceLink, 'prices'>): Promise<string | FetchError>;
9
- stickerSet(userID: bigint, stickers: InputSticker[], parameters: Omit<CreateNewStickerSet, 'stickers' | 'user_id'>): Promise<boolean | FetchError>;
10
- }
package/childs/create.js DELETED
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Create = void 0;
4
- const child_1 = require("../modules/child");
5
- class Create extends child_1.Child {
6
- async chatInviteLink(chatID, parameters) {
7
- return this.telegram.api.post('createChatInviteLink', { chat_id: chatID, ...parameters });
8
- }
9
- async chatSubscriptionInviteLink(chatID, parameters) {
10
- return this.telegram.api.post('createChatSubscriptionInviteLink', { chat_id: chatID, ...parameters });
11
- }
12
- async forumTopic(chatID, name, parameters) {
13
- return this.telegram.api.post('createForumTopic', { chat_id: chatID, name: name, ...parameters });
14
- }
15
- async invoiceLink(prices, parameters) {
16
- return this.telegram.api.post('createInvoiceLink', { prices: prices, ...parameters });
17
- }
18
- async stickerSet(userID, stickers, parameters) {
19
- return this.telegram.api.post('createNewStickerSet', {
20
- stickers: stickers,
21
- user_id: userID,
22
- ...parameters
23
- });
24
- }
25
- }
26
- exports.Create = Create;
@@ -1,6 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { DeclineChatJoinRequest } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Decline extends Child {
5
- chatJoinRequest(parameters: DeclineChatJoinRequest): Promise<boolean | FetchError>;
6
- }
package/childs/decline.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Decline = void 0;
4
- const child_1 = require("../modules/child");
5
- class Decline extends child_1.Child {
6
- async chatJoinRequest(parameters) {
7
- return this.telegram.api.post('declineChatJoinRequest', parameters);
8
- }
9
- }
10
- exports.Decline = Decline;
@@ -1,13 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { DeleteChatPhoto, DeleteChatStickerSet, DeleteForumTopic, DeleteMessage, DeleteMessages, DeleteMyCommands, DeleteStickerFromSet, DeleteStickerSet } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Delete extends Child {
5
- chatPhoto(chatID: bigint, parameters?: Partial<DeleteChatPhoto>): Promise<boolean | FetchError>;
6
- chatStickerSet(chatID: bigint, parameters?: Partial<DeleteChatStickerSet>): Promise<boolean | FetchError>;
7
- commands(parameters?: Partial<DeleteMyCommands>): Promise<boolean | FetchError>;
8
- forumTopic(chatID: bigint, messageThreadID: number, parameters?: Partial<DeleteForumTopic>): Promise<boolean | FetchError>;
9
- message(chatID: bigint, messageID: number, parameters?: Partial<DeleteMessage>): Promise<boolean | FetchError>;
10
- messages(chatID: bigint, messageIDs: number[], parameters?: Partial<DeleteMessages>): Promise<boolean | FetchError>;
11
- stickerFromSet(sticker: string, parameters?: Partial<DeleteStickerFromSet>): Promise<boolean | FetchError>;
12
- stickerSet(name: string, parameters?: Partial<DeleteStickerSet>): Promise<boolean | FetchError>;
13
- }
package/childs/delete.js DELETED
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Delete = void 0;
4
- const child_1 = require("../modules/child");
5
- class Delete extends child_1.Child {
6
- async chatPhoto(chatID, parameters) {
7
- return this.telegram.api.post('deleteChatPhoto', { chat_id: chatID, ...parameters });
8
- }
9
- async chatStickerSet(chatID, parameters) {
10
- return this.telegram.api.post('deleteChatStickerSet', { chat_id: chatID, ...parameters });
11
- }
12
- async commands(parameters) {
13
- return this.telegram.api.post('deleteMyCommands', parameters);
14
- }
15
- async forumTopic(chatID, messageThreadID, parameters) {
16
- return this.telegram.api.post('deleteForumTopic', { chat_id: chatID, message_thread_id: messageThreadID, ...parameters });
17
- }
18
- async message(chatID, messageID, parameters) {
19
- return this.telegram.api.post('deleteMessage', { chat_id: chatID, message_id: messageID, ...parameters });
20
- }
21
- async messages(chatID, messageIDs, parameters) {
22
- return this.telegram.api.post('deleteMessages', { chat_id: chatID, message_ids: messageIDs, ...parameters });
23
- }
24
- async stickerFromSet(sticker, parameters) {
25
- return this.telegram.api.post('deleteStickerFromSet', { sticker: sticker, ...parameters });
26
- }
27
- async stickerSet(name, parameters) {
28
- return this.telegram.api.post('deleteChatStickerSet', { name: name, ...parameters });
29
- }
30
- }
31
- exports.Delete = Delete;
@@ -1,8 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import { API } from '../modules/api';
3
- import { Child } from '../modules/child';
4
- export declare class Download extends Child {
5
- api: API;
6
- file(id: string): Promise<Buffer | FetchError>;
7
- userFirstProfilePhoto(id: bigint): Promise<Buffer | FetchError | Error>;
8
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Download = void 0;
4
- const api_1 = require("../modules/api");
5
- const child_1 = require("../modules/child");
6
- class Download extends child_1.Child {
7
- api = new api_1.API('https://api.telegram.org/file/bot' + this.telegram.token + '/');
8
- async file(id) {
9
- let file, buffer;
10
- file = await this.telegram.get.file(id);
11
- if (file instanceof Error)
12
- return file;
13
- buffer = await this.api.get(file.file_path ?? '');
14
- if (buffer instanceof Error)
15
- return buffer;
16
- return buffer.data;
17
- }
18
- async userFirstProfilePhoto(id) {
19
- let photos, sizes, buffer;
20
- photos = await this.telegram.get.userProfilePhotos(id, { limit: 1 });
21
- if (photos instanceof Error)
22
- return photos;
23
- sizes = photos.photos;
24
- if (sizes.length <= 0)
25
- return new Error(JSON.stringify(photos));
26
- buffer = await this.file(sizes[0].reduce((r, v) => (v.height + v.width > r.height + r.width ? v : r), sizes[0][0]).file_id);
27
- if (buffer instanceof Error)
28
- return buffer;
29
- return buffer;
30
- }
31
- }
32
- exports.Download = Download;
package/childs/edit.d.ts DELETED
@@ -1,14 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { ChatInviteLink, EditChatInviteLink, EditChatSubscriptionInviteLink, EditForumTopic, EditGeneralForumTopic, EditMessageCaption, EditMessageLiveLocation, EditMessageMedia, EditMessageReplyMarkup, EditMessageText, InputMedia, Message } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Edit extends Child {
5
- chatInviteLink(chatID: bigint, inviteLink: string, parameters?: Partial<EditChatInviteLink>): Promise<ChatInviteLink | FetchError>;
6
- chatSubscriptionInviteLInk(chatID: bigint, inviteLink: string, parameters?: Partial<EditChatSubscriptionInviteLink>): Promise<ChatInviteLink | FetchError>;
7
- forumTopic(chatID: bigint, messageThreadID: number, parameters?: Partial<EditForumTopic>): Promise<boolean | FetchError>;
8
- generalForumTopic(chatID: bigint, name: string, parameters?: Partial<EditGeneralForumTopic>): Promise<boolean | FetchError>;
9
- messageCaption(parameters: EditMessageCaption): Promise<Message | FetchError>;
10
- messageLiveLocation(parameters: EditMessageLiveLocation): Promise<Message | FetchError>;
11
- messageMedia(media: InputMedia, parameters?: Partial<EditMessageMedia>): Promise<Message | FetchError>;
12
- messageReplyMarkup(parameters: EditMessageReplyMarkup): Promise<Message | FetchError>;
13
- messageText(text: string, parameters?: Partial<EditMessageText>): Promise<Message | FetchError>;
14
- }
package/childs/edit.js DELETED
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Edit = void 0;
4
- const child_1 = require("../modules/child");
5
- class Edit extends child_1.Child {
6
- async chatInviteLink(chatID, inviteLink, parameters) {
7
- return this.telegram.api.post('editChatInviteLink', { chat_id: chatID, invite_link: inviteLink, ...parameters });
8
- }
9
- async chatSubscriptionInviteLInk(chatID, inviteLink, parameters) {
10
- return this.telegram.api.post('editChatSubscriptionInviteLink', {
11
- chat_id: chatID,
12
- invite_link: inviteLink,
13
- ...parameters
14
- });
15
- }
16
- async forumTopic(chatID, messageThreadID, parameters) {
17
- return this.telegram.api.post('editForumTopic', { chat_id: chatID, message_thread_id: messageThreadID, ...parameters });
18
- }
19
- async generalForumTopic(chatID, name, parameters) {
20
- return this.telegram.api.post('editGeneralForumTopic', { chat_id: chatID, name: name, ...parameters });
21
- }
22
- async messageCaption(parameters) {
23
- return this.telegram.api.post('editMessageCaption', parameters);
24
- }
25
- async messageLiveLocation(parameters) {
26
- return this.telegram.api.post('editMessageLiveLocation', parameters);
27
- }
28
- async messageMedia(media, parameters) {
29
- return this.telegram.api.post('editMessageMedia', { media: media, ...parameters });
30
- }
31
- async messageReplyMarkup(parameters) {
32
- return this.telegram.api.post('editMessageReplyMarkup', parameters);
33
- }
34
- async messageText(text, parameters) {
35
- return this.telegram.api.post('editMessageText', { text: text, ...parameters });
36
- }
37
- }
38
- exports.Edit = Edit;
@@ -1,6 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { ExportChatInviteLink } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Export extends Child {
5
- chatInviteLink(chatID: bigint, parameters?: Partial<ExportChatInviteLink>): Promise<string | FetchError>;
6
- }
package/childs/export.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Export = void 0;
4
- const child_1 = require("../modules/child");
5
- class Export extends child_1.Child {
6
- async chatInviteLink(chatID, parameters) {
7
- return this.telegram.api.post('exportChatInviteLink', { chat_id: chatID, ...parameters });
8
- }
9
- }
10
- exports.Export = Export;
@@ -1,7 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { ForwardMessage, ForwardMessages, Message, MessageId } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Forward extends Child {
5
- message(messageID: number, parameters: Omit<ForwardMessage, 'message_id'>): Promise<Message | FetchError>;
6
- messages(messageIDs: number[], parameters: Omit<ForwardMessages, 'message_ids'>): Promise<MessageId[] | FetchError>;
7
- }
package/childs/forward.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Forward = void 0;
4
- const child_1 = require("../modules/child");
5
- class Forward extends child_1.Child {
6
- async message(messageID, parameters) {
7
- return this.telegram.api.post('forwardMessage', { message_id: messageID, ...parameters });
8
- }
9
- async messages(messageIDs, parameters) {
10
- return this.telegram.api.post('forwardMessages', { message_ids: messageIDs, ...parameters });
11
- }
12
- }
13
- exports.Forward = Forward;
package/childs/get.d.ts DELETED
@@ -1,26 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { BotCommand, BotDescription, BotName, BotShortDescription, BusinessConnection, Chat, ChatAdministratorRights, ChatMember, File, GameHighScore, GetBusinessConnection, GetChat, GetChatAdministrators, GetChatMember, GetChatMemberCount, GetChatMenuButton, GetCustomEmojiStickers, GetFile, GetGameHighScores, GetMyCommands, GetMyDefaultAdministratorRights, GetMyDescription, GetMyName, GetMyShortDescription, GetStarTransactions, GetStickerSet, GetUpdates, GetUserChatBoosts, GetUserProfilePhotos, MenuButton, StarTransactions, Sticker, StickerSet, Update, User, UserChatBoosts, UserProfilePhotos } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Get extends Child {
5
- businessConnection(businessConnectionID: string, parameters?: Partial<GetBusinessConnection>): Promise<BusinessConnection | FetchError>;
6
- chat(chatID: bigint, parameters?: Partial<GetChat>): Promise<Chat | FetchError>;
7
- chatAdministrators(chatID: bigint, parameters?: Partial<GetChatAdministrators>): Promise<ChatMember[] | FetchError>;
8
- chatMember(parameters: GetChatMember): Promise<ChatMember | FetchError>;
9
- chatMemberCount(chatID: bigint, parameters?: Partial<GetChatMemberCount>): Promise<bigint | FetchError>;
10
- chatMenuButton(chatID: bigint, parameters?: Partial<GetChatMenuButton>): Promise<MenuButton | FetchError>;
11
- commands(parameters?: Partial<GetMyCommands>): Promise<BotCommand[] | FetchError>;
12
- customEmojiStickers(customEmojiIDs: string[], parameters?: Partial<GetCustomEmojiStickers>): Promise<Sticker[] | FetchError>;
13
- defaultAdministratorRights(parameters?: Partial<GetMyDefaultAdministratorRights>): Promise<ChatAdministratorRights | FetchError>;
14
- description(parameters?: Partial<GetMyDescription>): Promise<BotDescription | FetchError>;
15
- file(fileID: string, parameters?: Partial<GetFile>): Promise<File | FetchError>;
16
- forumTopicIconStickers(): Promise<Sticker[] | FetchError>;
17
- gameHighScores(userID: bigint, parameters?: Partial<GetGameHighScores>): Promise<GameHighScore | FetchError>;
18
- me(): Promise<User | FetchError>;
19
- name(parameters?: Partial<GetMyName>): Promise<BotName | FetchError>;
20
- shortDescription(parameters?: Partial<GetMyShortDescription>): Promise<BotShortDescription | FetchError>;
21
- starTransactions(parameters?: Partial<GetStarTransactions>): Promise<StarTransactions | FetchError>;
22
- stickerSet(name: string, parameters?: Partial<GetStickerSet>): Promise<StickerSet | FetchError>;
23
- updates(parameters?: Partial<GetUpdates>): Promise<Update[] | FetchError>;
24
- userChatBoosts(parameters: GetUserChatBoosts): Promise<UserChatBoosts | FetchError>;
25
- userProfilePhotos(userID: bigint, parameters?: Partial<GetUserProfilePhotos>): Promise<UserProfilePhotos | FetchError>;
26
- }
package/childs/get.js DELETED
@@ -1,73 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Get = void 0;
4
- const child_1 = require("../modules/child");
5
- class Get extends child_1.Child {
6
- async businessConnection(businessConnectionID, parameters) {
7
- return this.telegram.api.post('getBusinessConnection', {
8
- business_connection_id: businessConnectionID,
9
- ...parameters
10
- });
11
- }
12
- async chat(chatID, parameters) {
13
- return this.telegram.api.post('getChat', { chat_id: chatID, ...parameters });
14
- }
15
- async chatAdministrators(chatID, parameters) {
16
- return this.telegram.api.post('getChatAdministrators', { chat_id: chatID, ...parameters });
17
- }
18
- async chatMember(parameters) {
19
- return this.telegram.api.post('getChatMember', parameters);
20
- }
21
- async chatMemberCount(chatID, parameters) {
22
- return this.telegram.api.post('getChatMemberCount', { chat_id: chatID, ...parameters });
23
- }
24
- async chatMenuButton(chatID, parameters) {
25
- return this.telegram.api.post('getChatMenuButton', { chat_id: chatID, ...parameters });
26
- }
27
- async commands(parameters) {
28
- return this.telegram.api.post('getMyCommands', parameters);
29
- }
30
- async customEmojiStickers(customEmojiIDs, parameters) {
31
- return this.telegram.api.post('getCustomEmojiStickers', { custom_emoji_ids: customEmojiIDs, ...parameters });
32
- }
33
- async defaultAdministratorRights(parameters) {
34
- return this.telegram.api.post('getMyDefaultAdministratorRights', parameters);
35
- }
36
- async description(parameters) {
37
- return this.telegram.api.post('getMyDescription', parameters);
38
- }
39
- async file(fileID, parameters) {
40
- return this.telegram.api.post('getFile', { file_id: fileID, ...parameters });
41
- }
42
- async forumTopicIconStickers() {
43
- return this.telegram.api.post('getForumTopicIconStickers');
44
- }
45
- async gameHighScores(userID, parameters) {
46
- return this.telegram.api.post('getGameHighScores', { user_id: userID, ...parameters });
47
- }
48
- async me() {
49
- return this.telegram.api.post('getMe');
50
- }
51
- async name(parameters) {
52
- return this.telegram.api.post('getMyName', parameters);
53
- }
54
- async shortDescription(parameters) {
55
- return this.telegram.api.post('getMyShortDescription', parameters);
56
- }
57
- async starTransactions(parameters) {
58
- return this.telegram.api.post('getStarTransactions', parameters);
59
- }
60
- async stickerSet(name, parameters) {
61
- return this.telegram.api.post('getStickerSet', { name: name, ...parameters });
62
- }
63
- async updates(parameters) {
64
- return this.telegram.api.post('getUpdates', parameters);
65
- }
66
- async userChatBoosts(parameters) {
67
- return this.telegram.api.post('getUserChatBoosts', parameters);
68
- }
69
- async userProfilePhotos(userID, parameters) {
70
- return this.telegram.api.post('getUserProfilePhotos', { user_id: userID, ...parameters });
71
- }
72
- }
73
- exports.Get = Get;
package/childs/hide.d.ts DELETED
@@ -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 Hide extends Child {
5
- generalForumTopic(chatID: bigint, parameters?: Partial<HideGeneralForumTopic>): Promise<boolean | FetchError>;
6
- }
package/childs/hide.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Hide = void 0;
4
- const child_1 = require("../modules/child");
5
- class Hide extends child_1.Child {
6
- async generalForumTopic(chatID, parameters) {
7
- return this.telegram.api.post('hideGeneralForumTopic', { chat_id: chatID, ...parameters });
8
- }
9
- }
10
- exports.Hide = Hide;
package/childs/leave.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { LeaveChat } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Leave extends Child {
5
- chat(chatID: bigint, parameters?: Partial<LeaveChat>): Promise<boolean | FetchError>;
6
- }
package/childs/leave.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Leave = void 0;
4
- const child_1 = require("../modules/child");
5
- class Leave extends child_1.Child {
6
- async chat(chatID, parameters) {
7
- return this.telegram.api.post('leaveChat', { chat_id: chatID, ...parameters });
8
- }
9
- }
10
- exports.Leave = Leave;
package/childs/log.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import { Child } from '../modules/child';
3
- export declare class Log extends Child {
4
- out(): Promise<boolean | FetchError>;
5
- }
package/childs/log.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Log = void 0;
4
- const child_1 = require("../modules/child");
5
- class Log extends child_1.Child {
6
- async out() {
7
- return this.telegram.api.post('logOut');
8
- }
9
- }
10
- exports.Log = Log;
package/childs/pin.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { PinChatMessage } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Pin extends Child {
5
- chatMessage(chatID: bigint, messageID: number, parameters?: Partial<PinChatMessage>): Promise<boolean | FetchError>;
6
- }
package/childs/pin.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Pin = void 0;
4
- const child_1 = require("../modules/child");
5
- class Pin extends child_1.Child {
6
- async chatMessage(chatID, messageID, parameters) {
7
- return this.telegram.api.post('pinChatMessage', { chat_id: chatID, message_id: messageID, ...parameters });
8
- }
9
- }
10
- exports.Pin = Pin;
@@ -1,9 +0,0 @@
1
- import type { GetUpdates } from '@aracna/telegram-bot-types';
2
- import { Child } from '../modules/child';
3
- export declare class Polling extends Child {
4
- active: boolean;
5
- offset: number;
6
- start(ms?: number, parameters?: Partial<GetUpdates>): void;
7
- stop(): void;
8
- private get;
9
- }
package/childs/polling.js DELETED
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Polling = void 0;
4
- const enums_1 = require("../definitions/enums");
5
- const child_1 = require("../modules/child");
6
- class Polling extends child_1.Child {
7
- active = false;
8
- offset = 0;
9
- start(ms = 1000, parameters) {
10
- this.active = true;
11
- this.get(ms, parameters);
12
- }
13
- stop() {
14
- this.active = false;
15
- }
16
- async get(ms, parameters) {
17
- let body, updates;
18
- body = {
19
- allowed_updates: Object.values(enums_1.UpdateType).map((v) => v.toLowerCase()),
20
- offset: this.offset,
21
- ...parameters
22
- };
23
- updates = await this.telegram.get.updates(parameters);
24
- if (updates instanceof Error)
25
- return updates;
26
- updates.forEach((v) => this.telegram.handle(v));
27
- this.offset = updates.length > 0 ? updates[updates.length - 1].update_id + 1 : this.offset;
28
- if (this.active) {
29
- setTimeout(() => this.get(ms, parameters), ms);
30
- }
31
- return updates;
32
- }
33
- }
34
- exports.Polling = Polling;
@@ -1,8 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { InlineKeyboardButton, Message, SendMessage } from '@aracna/telegram-bot-types';
3
- import type { SendRepliable } from '../../definitions/interfaces';
4
- import { Child } from '../../modules/child';
5
- export declare class SendPrivate extends Child {
6
- buttons(chatIDs: [bigint, bigint], text: string, buttons: InlineKeyboardButton[], parameters?: Partial<SendMessage>): Promise<Message | FetchError | Error>;
7
- repliable<T>(chatIDs: [bigint, bigint], data: T, parameters: Omit<SendRepliable, 'chat_id' | 'data' | 'from_chat_id'>): Promise<Message | FetchError | Error>;
8
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SendPrivate = void 0;
4
- const child_1 = require("../../modules/child");
5
- const callback_query_utils_1 = require("../../utils/callback.query.utils");
6
- class SendPrivate extends child_1.Child {
7
- async buttons(chatIDs, text, buttons, parameters) {
8
- return this.telegram.send.buttons(chatIDs[1], text, buttons.map((v) => {
9
- let decoded;
10
- decoded = callback_query_utils_1.CallbackQueryUtils.decodeBody(v.callback_data);
11
- decoded.c = chatIDs[0];
12
- return this.telegram.builder.button.callback(v.text, decoded.d, decoded.t, decoded.c);
13
- }), parameters);
14
- }
15
- async repliable(chatIDs, data, parameters) {
16
- return this.telegram.send.repliable(chatIDs[1], data, { from_chat_id: chatIDs[0], ...parameters });
17
- }
18
- }
19
- exports.SendPrivate = SendPrivate;
@@ -1,6 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { PromoteChatMember } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Promote extends Child {
5
- chatMember(parameters: PromoteChatMember): Promise<boolean | FetchError>;
6
- }
package/childs/promote.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Promote = void 0;
4
- const child_1 = require("../modules/child");
5
- class Promote extends child_1.Child {
6
- async chatMember(parameters) {
7
- return this.telegram.api.post('promoteChatMember', parameters);
8
- }
9
- }
10
- exports.Promote = Promote;
@@ -1,6 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { RefundStarPayment } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Refund extends Child {
5
- starPayment(userID: bigint, telegramPaymentChargeID: string, parameters?: Partial<RefundStarPayment>): Promise<boolean | FetchError>;
6
- }
package/childs/refund.js DELETED
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Refund = void 0;
4
- const child_1 = require("../modules/child");
5
- class Refund extends child_1.Child {
6
- async starPayment(userID, telegramPaymentChargeID, parameters) {
7
- return this.telegram.api.post('refundStarPayment', {
8
- telegram_payment_charge_id: telegramPaymentChargeID,
9
- user_id: userID,
10
- ...parameters
11
- });
12
- }
13
- }
14
- exports.Refund = Refund;
@@ -1,7 +0,0 @@
1
- import type { FetchError } from '@aracna/core';
2
- import type { ReopenForumTopic, ReopenGeneralForumTopic } from '@aracna/telegram-bot-types';
3
- import { Child } from '../modules/child';
4
- export declare class Reopen extends Child {
5
- forumTopic(chatID: bigint, messageThreadID: number, parameters?: Partial<ReopenForumTopic>): Promise<boolean | FetchError>;
6
- generalForumTopic(chatID: bigint, parameters?: Partial<ReopenGeneralForumTopic>): Promise<boolean | FetchError>;
7
- }