@aracna/telegram-bot 1.9.13 → 1.9.14

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 (84) hide show
  1. package/builders/button.builder.d.ts +2 -2
  2. package/childs/add.d.ts +3 -3
  3. package/childs/answer.d.ts +3 -2
  4. package/childs/answer.js +3 -0
  5. package/childs/approve.d.ts +6 -0
  6. package/childs/approve.js +10 -0
  7. package/childs/ban.d.ts +4 -3
  8. package/childs/ban.js +5 -2
  9. package/childs/close.d.ts +7 -0
  10. package/childs/close.js +13 -0
  11. package/childs/copy.d.ts +7 -0
  12. package/childs/copy.js +13 -0
  13. package/childs/create.d.ts +7 -3
  14. package/childs/create.js +13 -4
  15. package/childs/decline.d.ts +6 -0
  16. package/childs/decline.js +10 -0
  17. package/childs/delete.d.ts +10 -5
  18. package/childs/delete.js +20 -8
  19. package/childs/download.d.ts +2 -2
  20. package/childs/edit.d.ts +9 -5
  21. package/childs/edit.js +19 -3
  22. package/childs/export.d.ts +3 -2
  23. package/childs/export.js +2 -2
  24. package/childs/forward.d.ts +4 -3
  25. package/childs/forward.js +5 -7
  26. package/childs/get.d.ts +22 -11
  27. package/childs/get.js +52 -16
  28. package/childs/hide.d.ts +6 -0
  29. package/childs/hide.js +10 -0
  30. package/childs/leave.d.ts +3 -2
  31. package/childs/leave.js +2 -2
  32. package/childs/log.d.ts +5 -0
  33. package/childs/log.js +10 -0
  34. package/childs/pin.d.ts +3 -3
  35. package/childs/pin.js +2 -2
  36. package/childs/polling.d.ts +1 -1
  37. package/childs/polling.js +1 -1
  38. package/childs/privates/send.private.d.ts +5 -4
  39. package/childs/privates/send.private.js +2 -2
  40. package/childs/promote.d.ts +3 -3
  41. package/childs/promote.js +2 -2
  42. package/childs/refund.d.ts +6 -0
  43. package/childs/refund.js +14 -0
  44. package/childs/reopen.d.ts +7 -0
  45. package/childs/reopen.js +13 -0
  46. package/childs/replace.d.ts +6 -0
  47. package/childs/replace.js +10 -0
  48. package/childs/restrict.d.ts +3 -3
  49. package/childs/restrict.js +1 -3
  50. package/childs/revoke.d.ts +6 -0
  51. package/childs/revoke.js +10 -0
  52. package/childs/send.d.ts +26 -25
  53. package/childs/send.js +22 -41
  54. package/childs/set.d.ts +24 -13
  55. package/childs/set.js +60 -22
  56. package/childs/stop.d.ts +3 -3
  57. package/childs/stop.js +2 -2
  58. package/childs/unban.d.ts +4 -2
  59. package/childs/unban.js +5 -2
  60. package/childs/unhide.d.ts +6 -0
  61. package/childs/unhide.js +10 -0
  62. package/childs/unpin.d.ts +6 -2
  63. package/childs/unpin.js +15 -2
  64. package/childs/upload.d.ts +3 -4
  65. package/childs/upload.js +2 -2
  66. package/childs/webhook.d.ts +5 -3
  67. package/childs/webhook.js +8 -2
  68. package/definitions/interfaces.d.ts +27 -15
  69. package/definitions/interfaces.js +0 -1
  70. package/definitions/types.d.ts +2 -2
  71. package/index.d.ts +367 -161
  72. package/modules/api.d.ts +1 -1
  73. package/modules/configuration.d.ts +1 -1
  74. package/modules/dummy.d.ts +1 -1
  75. package/modules/telegram.d.ts +27 -5
  76. package/modules/telegram.js +37 -4
  77. package/package.json +3 -3
  78. package/utils/callback.query.utils.d.ts +2 -2
  79. package/utils/command.utils.d.ts +2 -2
  80. package/utils/context.utils.d.ts +5 -5
  81. package/utils/context.utils.js +5 -5
  82. package/utils/inline.keyboard.utils.d.ts +1 -1
  83. package/utils/reply.to.message.utils.d.ts +3 -3
  84. package/utils/start.utils.d.ts +4 -4
@@ -1,8 +1,10 @@
1
- import { FetchError } from '@aracna/core';
2
- import { SetWebhook } from '@aracna/telegram-bot-types';
1
+ import type { FetchError } from '@aracna/core';
2
+ import type { DeleteWebhook, SetWebhook, WebhookInfo } from '@aracna/telegram-bot-types';
3
3
  import { Child } from '../modules/child';
4
4
  export declare class Webhook extends Child {
5
- delete(): Promise<boolean | FetchError>;
5
+ close(): Promise<boolean | FetchError>;
6
+ delete(parameters?: Partial<DeleteWebhook>): Promise<boolean | FetchError>;
7
+ getInfo(): Promise<WebhookInfo | FetchError>;
6
8
  set(route?: string, parameters?: Partial<SetWebhook>): Promise<boolean | FetchError>;
7
9
  url(route: string): string;
8
10
  }
package/childs/webhook.js CHANGED
@@ -4,8 +4,14 @@ exports.Webhook = void 0;
4
4
  const enums_1 = require("../definitions/enums");
5
5
  const child_1 = require("../modules/child");
6
6
  class Webhook extends child_1.Child {
7
- async delete() {
8
- return this.telegram.api.post('deleteWebhook');
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');
9
15
  }
10
16
  async set(route = '', parameters) {
11
17
  return this.telegram.api.post('setWebhook', {
@@ -1,7 +1,7 @@
1
- import { FetchResponse } from '@aracna/core';
2
- import { CallbackQuery as NativeCallbackQuery, ChatJoinRequest, ChatMemberUpdated, ChosenInlineResult, InlineKeyboardButton, InlineQuery, InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo, Message, Poll, PollAnswer, PreCheckoutQuery, SendMediaGroup, ShippingQuery } from '@aracna/telegram-bot-types';
3
- import { UpdateType } from './enums';
4
- import { HandlerMiddleware, InputFile } from './types';
1
+ import type { FetchResponse } from '@aracna/core';
2
+ import type { ChatJoinRequest, ChatMemberUpdated, ChosenInlineResult, InlineKeyboardButton, InlineQuery, InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo, Message, CallbackQuery as NativeCallbackQuery, Poll, PollAnswer, PreCheckoutQuery, SendMediaGroup, SendMessage, SendPaidMedia, ShippingQuery } from '@aracna/telegram-bot-types';
3
+ import type { UpdateType } from './enums';
4
+ import type { HandlerMiddleware, InputFile } from './types';
5
5
  export interface APIResponse<T> extends FetchResponse<APIResponseData<T>> {
6
6
  }
7
7
  export interface APIResponseData<T> {
@@ -12,7 +12,7 @@ export interface CallbackQuery<T = any> extends NativeCallbackQuery {
12
12
  body: CallbackQueryBody<T>;
13
13
  }
14
14
  export interface CallbackQueryBody<T = any> {
15
- c?: number;
15
+ c?: bigint;
16
16
  d: T;
17
17
  t: string;
18
18
  }
@@ -25,20 +25,20 @@ export interface ConfigurationAPI {
25
25
  }
26
26
  export interface ConfigurationDefault {
27
27
  buttons: {
28
- text: (chatID: number) => Promise<InlineKeyboardButton[]>;
29
- url: (chatID: number) => Promise<InlineKeyboardButton[]>;
30
- login: (chatID: number) => Promise<InlineKeyboardButton[]>;
31
- callback: (chatID: number) => Promise<InlineKeyboardButton[]>;
32
- query: (chatID: number) => Promise<InlineKeyboardButton[]>;
33
- queryCurrentChat: (chatID: number) => Promise<InlineKeyboardButton[]>;
34
- game: (chatID: number) => Promise<InlineKeyboardButton[]>;
35
- pay: (chatID: number) => Promise<InlineKeyboardButton[]>;
28
+ text: (chatID: bigint) => Promise<InlineKeyboardButton[]>;
29
+ url: (chatID: bigint) => Promise<InlineKeyboardButton[]>;
30
+ login: (chatID: bigint) => Promise<InlineKeyboardButton[]>;
31
+ callback: (chatID: bigint) => Promise<InlineKeyboardButton[]>;
32
+ query: (chatID: bigint) => Promise<InlineKeyboardButton[]>;
33
+ queryCurrentChat: (chatID: bigint) => Promise<InlineKeyboardButton[]>;
34
+ game: (chatID: bigint) => Promise<InlineKeyboardButton[]>;
35
+ pay: (chatID: bigint) => Promise<InlineKeyboardButton[]>;
36
36
  };
37
37
  }
38
38
  export interface ConfigurationHandler {
39
39
  send: {
40
40
  buttons: {
41
- empty: (chatID: number) => Error;
41
+ empty: (chatID: bigint) => Error;
42
42
  };
43
43
  };
44
44
  }
@@ -77,8 +77,11 @@ export interface HandlerOptions {
77
77
  export interface InputMediaAlternative extends Omit<InputMediaAudio | InputMediaDocument | InputMediaPhoto | InputMediaVideo, 'media'> {
78
78
  media: InputFile;
79
79
  }
80
+ export interface InputPaidMediaAlternative extends Omit<InputMediaPhoto | InputMediaVideo, 'media'> {
81
+ media: InputFile;
82
+ }
80
83
  export interface MessageBody<T = any> {
81
- chatID?: number;
84
+ chatID?: bigint;
82
85
  data: T;
83
86
  type: string;
84
87
  }
@@ -88,6 +91,15 @@ export interface ReplyToMessage<T = any> extends Message {
88
91
  export interface SendMediaGroupAlternative extends Omit<SendMediaGroup, 'media'> {
89
92
  media: InputMediaAlternative[];
90
93
  }
94
+ export interface SendPaidMediaAlternative extends Omit<SendPaidMedia, 'media'> {
95
+ media: InputPaidMediaAlternative[];
96
+ }
97
+ export interface SendRepliable<T = any> extends SendMessage {
98
+ data: T;
99
+ from_chat_id?: bigint;
100
+ text: string;
101
+ type: string;
102
+ }
91
103
  export interface Start<T = any> extends Message {
92
104
  body: MessageBody<T>;
93
105
  }
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const enums_1 = require("./enums");
@@ -1,4 +1,4 @@
1
- import { UpdateType } from './enums';
2
- import { Context } from './interfaces';
1
+ import type { UpdateType } from './enums';
2
+ import type { Context } from './interfaces';
3
3
  export type HandlerMiddleware<T extends UpdateType> = (context: Context[T]) => any;
4
4
  export type InputFile = File | string;