@effect-ak/tg-bot-client 0.1.0 → 0.2.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.
- package/dist/cjs/bot/factory/_service.js +59 -0
- package/dist/cjs/bot/factory/client-config.js +68 -0
- package/dist/cjs/bot/factory/make-bot.js +59 -0
- package/dist/cjs/bot/message-handler/_service.js +51 -0
- package/dist/cjs/bot/message-handler/types.js +5 -0
- package/dist/cjs/bot/message-handler/utils.js +19 -0
- package/dist/cjs/bot/run.js +10 -0
- package/dist/cjs/bot/update-poller/_service.js +78 -0
- package/dist/cjs/bot/update-poller/errors.js +5 -0
- package/dist/cjs/bot/update-poller/fetch-updates.js +109 -0
- package/dist/cjs/bot/update-poller/poll-and-handle.js +89 -0
- package/dist/cjs/bot/update-poller/settings.js +23 -0
- package/dist/cjs/client/_client.js +56 -14
- package/dist/cjs/client/config.js +56 -0
- package/dist/cjs/client/errors.js +47 -9
- package/dist/cjs/client/execute-request/_service.js +59 -0
- package/dist/cjs/client/execute-request/execute.js +98 -0
- package/dist/cjs/client/{request.js → execute-request/payload.js} +2 -2
- package/dist/cjs/client/file/_service.js +61 -0
- package/dist/cjs/client/file/get-file.js +77 -0
- package/dist/cjs/client/guards.js +12 -0
- package/dist/cjs/const.js +20 -0
- package/dist/cjs/index.js +24 -22
- package/dist/dts/bot/factory/_service.d.ts +37 -0
- package/dist/dts/bot/factory/client-config.d.ts +3 -0
- package/dist/dts/bot/factory/make-bot.d.ts +7 -0
- package/dist/dts/bot/message-handler/_service.d.ts +6 -0
- package/dist/dts/bot/message-handler/types.d.ts +16 -0
- package/dist/dts/bot/message-handler/utils.d.ts +6 -0
- package/dist/dts/bot/run.d.ts +7 -0
- package/dist/dts/bot/update-poller/_service.d.ts +21 -0
- package/dist/dts/bot/update-poller/errors.d.ts +1 -0
- package/dist/dts/bot/update-poller/fetch-updates.d.ts +17 -0
- package/dist/dts/bot/update-poller/poll-and-handle.d.ts +16 -0
- package/dist/dts/bot/update-poller/settings.d.ts +6 -0
- package/dist/dts/client/_client.d.ts +6 -17
- package/dist/dts/client/config.d.ts +8 -0
- package/dist/dts/client/errors.d.ts +6 -4
- package/dist/dts/client/execute-request/_service.d.ts +15 -0
- package/dist/dts/client/execute-request/execute.d.ts +5 -0
- package/dist/dts/client/file/_service.d.ts +16 -0
- package/dist/dts/client/file/get-file.d.ts +5 -0
- package/dist/dts/client/guards.d.ts +17 -0
- package/dist/dts/index.d.ts +4 -1
- package/dist/dts/specification/api.d.ts +14 -14
- package/dist/dts/specification/types.d.ts +77 -77
- package/dist/esm/bot/factory/_service.js +49 -0
- package/dist/esm/bot/factory/client-config.js +57 -0
- package/dist/esm/bot/factory/make-bot.js +46 -0
- package/dist/esm/bot/message-handler/_service.js +41 -0
- package/dist/esm/bot/message-handler/types.js +2 -0
- package/dist/esm/bot/message-handler/utils.js +16 -0
- package/dist/esm/bot/run.js +10 -0
- package/dist/esm/bot/update-poller/_service.js +68 -0
- package/dist/esm/bot/update-poller/errors.js +2 -0
- package/dist/esm/bot/update-poller/fetch-updates.js +86 -0
- package/dist/esm/bot/update-poller/poll-and-handle.js +74 -0
- package/dist/esm/bot/update-poller/settings.js +19 -0
- package/dist/esm/client/_client.js +50 -12
- package/dist/esm/client/config.js +46 -0
- package/dist/esm/client/errors.js +42 -8
- package/dist/esm/client/execute-request/_service.js +49 -0
- package/dist/esm/client/execute-request/execute.js +74 -0
- package/dist/esm/client/{request.js → execute-request/payload.js} +7 -5
- package/dist/esm/client/file/_service.js +51 -0
- package/dist/esm/client/file/get-file.js +61 -0
- package/dist/esm/client/guards.js +13 -0
- package/dist/esm/const.js +17 -0
- package/dist/esm/index.js +21 -4
- package/dist/esm/specification/api.js +2 -1
- package/dist/esm/specification/types.js +2 -1
- package/package.json +13 -9
- package/readme.md +75 -25
- package/dist/cjs/client/const.js +0 -20
- package/dist/cjs/client/download-file.js +0 -44
- package/dist/cjs/client/execute-request.js +0 -69
- package/dist/cjs/client/response.js +0 -22
- package/dist/dts/client/download-file.d.ts +0 -13
- package/dist/dts/client/execute-request.d.ts +0 -13
- package/dist/dts/client/response.d.ts +0 -7
- package/dist/esm/client/const.js +0 -13
- package/dist/esm/client/download-file.js +0 -36
- package/dist/esm/client/execute-request.js +0 -62
- package/dist/esm/client/response.js +0 -15
- /package/dist/dts/client/{request.d.ts → execute-request/payload.d.ts} +0 -0
- /package/dist/dts/{client/const.d.ts → const.d.ts} +0 -0
|
@@ -78,29 +78,29 @@ export interface BotCommand {
|
|
|
78
78
|
}
|
|
79
79
|
export type BotCommandScope = BotCommandScopeDefault | BotCommandScopeAllPrivateChats | BotCommandScopeAllGroupChats | BotCommandScopeAllChatAdministrators | BotCommandScopeChat | BotCommandScopeChatAdministrators | BotCommandScopeChatMember;
|
|
80
80
|
export interface BotCommandScopeAllChatAdministrators {
|
|
81
|
-
type: "
|
|
81
|
+
type: "all_chat_administrators";
|
|
82
82
|
}
|
|
83
83
|
export interface BotCommandScopeAllGroupChats {
|
|
84
|
-
type: "
|
|
84
|
+
type: "all_group_chats";
|
|
85
85
|
}
|
|
86
86
|
export interface BotCommandScopeAllPrivateChats {
|
|
87
|
-
type: "
|
|
87
|
+
type: "all_private_chats";
|
|
88
88
|
}
|
|
89
89
|
export interface BotCommandScopeChat {
|
|
90
|
-
type: "
|
|
90
|
+
type: "chat";
|
|
91
91
|
chat_id: number | string;
|
|
92
92
|
}
|
|
93
93
|
export interface BotCommandScopeChatAdministrators {
|
|
94
|
-
type: "
|
|
94
|
+
type: "chat_administrators";
|
|
95
95
|
chat_id: number | string;
|
|
96
96
|
}
|
|
97
97
|
export interface BotCommandScopeChatMember {
|
|
98
|
-
type: "
|
|
98
|
+
type: "chat_member";
|
|
99
99
|
chat_id: number | string;
|
|
100
100
|
user_id: number;
|
|
101
101
|
}
|
|
102
102
|
export interface BotCommandScopeDefault {
|
|
103
|
-
type: "
|
|
103
|
+
type: "default";
|
|
104
104
|
}
|
|
105
105
|
export interface BotDescription {
|
|
106
106
|
description: string;
|
|
@@ -153,7 +153,7 @@ export interface CallbackQuery {
|
|
|
153
153
|
}
|
|
154
154
|
export interface Chat {
|
|
155
155
|
id: number;
|
|
156
|
-
type:
|
|
156
|
+
type: "private" | "group" | "supergroup" | "channel";
|
|
157
157
|
title?: string;
|
|
158
158
|
username?: string;
|
|
159
159
|
first_name?: string;
|
|
@@ -217,7 +217,7 @@ export interface ChatBoostUpdated {
|
|
|
217
217
|
}
|
|
218
218
|
export interface ChatFullInfo {
|
|
219
219
|
id: number;
|
|
220
|
-
type:
|
|
220
|
+
type: "private" | "group" | "supergroup" | "channel";
|
|
221
221
|
accent_color_id: number;
|
|
222
222
|
max_reaction_count: number;
|
|
223
223
|
title?: string;
|
|
@@ -572,12 +572,12 @@ export interface InlineQuery {
|
|
|
572
572
|
from: User;
|
|
573
573
|
query: string;
|
|
574
574
|
offset: string;
|
|
575
|
-
chat_type?:
|
|
575
|
+
chat_type?: string;
|
|
576
576
|
location?: Location;
|
|
577
577
|
}
|
|
578
578
|
export type InlineQueryResult = InlineQueryResultCachedAudio | InlineQueryResultCachedDocument | InlineQueryResultCachedGif | InlineQueryResultCachedMpeg4Gif | InlineQueryResultCachedPhoto | InlineQueryResultCachedSticker | InlineQueryResultCachedVideo | InlineQueryResultCachedVoice | InlineQueryResultArticle | InlineQueryResultAudio | InlineQueryResultContact | InlineQueryResultGame | InlineQueryResultDocument | InlineQueryResultGif | InlineQueryResultLocation | InlineQueryResultMpeg4Gif | InlineQueryResultPhoto | InlineQueryResultVenue | InlineQueryResultVideo | InlineQueryResultVoice;
|
|
579
579
|
export interface InlineQueryResultArticle {
|
|
580
|
-
type: "
|
|
580
|
+
type: "article";
|
|
581
581
|
id: string;
|
|
582
582
|
title: string;
|
|
583
583
|
input_message_content: InputMessageContent;
|
|
@@ -590,12 +590,12 @@ export interface InlineQueryResultArticle {
|
|
|
590
590
|
thumbnail_height?: number;
|
|
591
591
|
}
|
|
592
592
|
export interface InlineQueryResultAudio {
|
|
593
|
-
type: "
|
|
593
|
+
type: "audio";
|
|
594
594
|
id: string;
|
|
595
595
|
audio_url: string;
|
|
596
596
|
title: string;
|
|
597
597
|
caption?: string;
|
|
598
|
-
parse_mode?:
|
|
598
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
599
599
|
caption_entities?: MessageEntity[];
|
|
600
600
|
performer?: string;
|
|
601
601
|
audio_duration?: number;
|
|
@@ -603,97 +603,97 @@ export interface InlineQueryResultAudio {
|
|
|
603
603
|
input_message_content?: InputMessageContent;
|
|
604
604
|
}
|
|
605
605
|
export interface InlineQueryResultCachedAudio {
|
|
606
|
-
type: "
|
|
606
|
+
type: "audio";
|
|
607
607
|
id: string;
|
|
608
608
|
audio_file_id: string;
|
|
609
609
|
caption?: string;
|
|
610
|
-
parse_mode?:
|
|
610
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
611
611
|
caption_entities?: MessageEntity[];
|
|
612
612
|
reply_markup?: InlineKeyboardMarkup;
|
|
613
613
|
input_message_content?: InputMessageContent;
|
|
614
614
|
}
|
|
615
615
|
export interface InlineQueryResultCachedDocument {
|
|
616
|
-
type: "
|
|
616
|
+
type: "document";
|
|
617
617
|
id: string;
|
|
618
618
|
title: string;
|
|
619
619
|
document_file_id: string;
|
|
620
620
|
description?: string;
|
|
621
621
|
caption?: string;
|
|
622
|
-
parse_mode?:
|
|
622
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
623
623
|
caption_entities?: MessageEntity[];
|
|
624
624
|
reply_markup?: InlineKeyboardMarkup;
|
|
625
625
|
input_message_content?: InputMessageContent;
|
|
626
626
|
}
|
|
627
627
|
export interface InlineQueryResultCachedGif {
|
|
628
|
-
type: "
|
|
628
|
+
type: "gif";
|
|
629
629
|
id: string;
|
|
630
630
|
gif_file_id: string;
|
|
631
631
|
title?: string;
|
|
632
632
|
caption?: string;
|
|
633
|
-
parse_mode?:
|
|
633
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
634
634
|
caption_entities?: MessageEntity[];
|
|
635
635
|
show_caption_above_media?: boolean;
|
|
636
636
|
reply_markup?: InlineKeyboardMarkup;
|
|
637
637
|
input_message_content?: InputMessageContent;
|
|
638
638
|
}
|
|
639
639
|
export interface InlineQueryResultCachedMpeg4Gif {
|
|
640
|
-
type: "
|
|
640
|
+
type: "mpeg4_gif";
|
|
641
641
|
id: string;
|
|
642
642
|
mpeg4_file_id: string;
|
|
643
643
|
title?: string;
|
|
644
644
|
caption?: string;
|
|
645
|
-
parse_mode?:
|
|
645
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
646
646
|
caption_entities?: MessageEntity[];
|
|
647
647
|
show_caption_above_media?: boolean;
|
|
648
648
|
reply_markup?: InlineKeyboardMarkup;
|
|
649
649
|
input_message_content?: InputMessageContent;
|
|
650
650
|
}
|
|
651
651
|
export interface InlineQueryResultCachedPhoto {
|
|
652
|
-
type: "
|
|
652
|
+
type: "photo";
|
|
653
653
|
id: string;
|
|
654
654
|
photo_file_id: string;
|
|
655
655
|
title?: string;
|
|
656
656
|
description?: string;
|
|
657
657
|
caption?: string;
|
|
658
|
-
parse_mode?:
|
|
658
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
659
659
|
caption_entities?: MessageEntity[];
|
|
660
660
|
show_caption_above_media?: boolean;
|
|
661
661
|
reply_markup?: InlineKeyboardMarkup;
|
|
662
662
|
input_message_content?: InputMessageContent;
|
|
663
663
|
}
|
|
664
664
|
export interface InlineQueryResultCachedSticker {
|
|
665
|
-
type: "
|
|
665
|
+
type: "sticker";
|
|
666
666
|
id: string;
|
|
667
667
|
sticker_file_id: string;
|
|
668
668
|
reply_markup?: InlineKeyboardMarkup;
|
|
669
669
|
input_message_content?: InputMessageContent;
|
|
670
670
|
}
|
|
671
671
|
export interface InlineQueryResultCachedVideo {
|
|
672
|
-
type: "
|
|
672
|
+
type: "video";
|
|
673
673
|
id: string;
|
|
674
674
|
video_file_id: string;
|
|
675
675
|
title: string;
|
|
676
676
|
description?: string;
|
|
677
677
|
caption?: string;
|
|
678
|
-
parse_mode?:
|
|
678
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
679
679
|
caption_entities?: MessageEntity[];
|
|
680
680
|
show_caption_above_media?: boolean;
|
|
681
681
|
reply_markup?: InlineKeyboardMarkup;
|
|
682
682
|
input_message_content?: InputMessageContent;
|
|
683
683
|
}
|
|
684
684
|
export interface InlineQueryResultCachedVoice {
|
|
685
|
-
type: "
|
|
685
|
+
type: "voice";
|
|
686
686
|
id: string;
|
|
687
687
|
voice_file_id: string;
|
|
688
688
|
title: string;
|
|
689
689
|
caption?: string;
|
|
690
|
-
parse_mode?:
|
|
690
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
691
691
|
caption_entities?: MessageEntity[];
|
|
692
692
|
reply_markup?: InlineKeyboardMarkup;
|
|
693
693
|
input_message_content?: InputMessageContent;
|
|
694
694
|
}
|
|
695
695
|
export interface InlineQueryResultContact {
|
|
696
|
-
type: "
|
|
696
|
+
type: "contact";
|
|
697
697
|
id: string;
|
|
698
698
|
phone_number: string;
|
|
699
699
|
first_name: string;
|
|
@@ -706,13 +706,13 @@ export interface InlineQueryResultContact {
|
|
|
706
706
|
thumbnail_height?: number;
|
|
707
707
|
}
|
|
708
708
|
export interface InlineQueryResultDocument {
|
|
709
|
-
type: "
|
|
709
|
+
type: "document";
|
|
710
710
|
id: string;
|
|
711
711
|
title: string;
|
|
712
712
|
document_url: string;
|
|
713
713
|
mime_type: string;
|
|
714
714
|
caption?: string;
|
|
715
|
-
parse_mode?:
|
|
715
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
716
716
|
caption_entities?: MessageEntity[];
|
|
717
717
|
description?: string;
|
|
718
718
|
reply_markup?: InlineKeyboardMarkup;
|
|
@@ -722,13 +722,13 @@ export interface InlineQueryResultDocument {
|
|
|
722
722
|
thumbnail_height?: number;
|
|
723
723
|
}
|
|
724
724
|
export interface InlineQueryResultGame {
|
|
725
|
-
type: "
|
|
725
|
+
type: "game";
|
|
726
726
|
id: string;
|
|
727
727
|
game_short_name: string;
|
|
728
728
|
reply_markup?: InlineKeyboardMarkup;
|
|
729
729
|
}
|
|
730
730
|
export interface InlineQueryResultGif {
|
|
731
|
-
type: "
|
|
731
|
+
type: "gif";
|
|
732
732
|
id: string;
|
|
733
733
|
gif_url: string;
|
|
734
734
|
thumbnail_url: string;
|
|
@@ -738,14 +738,14 @@ export interface InlineQueryResultGif {
|
|
|
738
738
|
thumbnail_mime_type?: "image/jpeg" | "image/gif" | "video/mp4";
|
|
739
739
|
title?: string;
|
|
740
740
|
caption?: string;
|
|
741
|
-
parse_mode?:
|
|
741
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
742
742
|
caption_entities?: MessageEntity[];
|
|
743
743
|
show_caption_above_media?: boolean;
|
|
744
744
|
reply_markup?: InlineKeyboardMarkup;
|
|
745
745
|
input_message_content?: InputMessageContent;
|
|
746
746
|
}
|
|
747
747
|
export interface InlineQueryResultLocation {
|
|
748
|
-
type: "
|
|
748
|
+
type: "location";
|
|
749
749
|
id: string;
|
|
750
750
|
latitude: number;
|
|
751
751
|
longitude: number;
|
|
@@ -761,7 +761,7 @@ export interface InlineQueryResultLocation {
|
|
|
761
761
|
thumbnail_height?: number;
|
|
762
762
|
}
|
|
763
763
|
export interface InlineQueryResultMpeg4Gif {
|
|
764
|
-
type: "
|
|
764
|
+
type: "mpeg4_gif";
|
|
765
765
|
id: string;
|
|
766
766
|
mpeg4_url: string;
|
|
767
767
|
thumbnail_url: string;
|
|
@@ -771,23 +771,23 @@ export interface InlineQueryResultMpeg4Gif {
|
|
|
771
771
|
thumbnail_mime_type?: "image/jpeg" | "image/gif" | "video/mp4";
|
|
772
772
|
title?: string;
|
|
773
773
|
caption?: string;
|
|
774
|
-
parse_mode?:
|
|
774
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
775
775
|
caption_entities?: MessageEntity[];
|
|
776
776
|
show_caption_above_media?: boolean;
|
|
777
777
|
reply_markup?: InlineKeyboardMarkup;
|
|
778
778
|
input_message_content?: InputMessageContent;
|
|
779
779
|
}
|
|
780
780
|
export interface InlineQueryResultPhoto {
|
|
781
|
-
type: "
|
|
781
|
+
type: "photo";
|
|
782
782
|
id: string;
|
|
783
|
-
photo_url:
|
|
783
|
+
photo_url: string;
|
|
784
784
|
thumbnail_url: string;
|
|
785
785
|
photo_width?: number;
|
|
786
786
|
photo_height?: number;
|
|
787
787
|
title?: string;
|
|
788
788
|
description?: string;
|
|
789
789
|
caption?: string;
|
|
790
|
-
parse_mode?:
|
|
790
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
791
791
|
caption_entities?: MessageEntity[];
|
|
792
792
|
show_caption_above_media?: boolean;
|
|
793
793
|
reply_markup?: InlineKeyboardMarkup;
|
|
@@ -799,7 +799,7 @@ export interface InlineQueryResultsButton {
|
|
|
799
799
|
start_parameter?: string;
|
|
800
800
|
}
|
|
801
801
|
export interface InlineQueryResultVenue {
|
|
802
|
-
type: "
|
|
802
|
+
type: "venue";
|
|
803
803
|
id: string;
|
|
804
804
|
latitude: number;
|
|
805
805
|
longitude: number;
|
|
@@ -816,14 +816,14 @@ export interface InlineQueryResultVenue {
|
|
|
816
816
|
thumbnail_height?: number;
|
|
817
817
|
}
|
|
818
818
|
export interface InlineQueryResultVideo {
|
|
819
|
-
type: "
|
|
819
|
+
type: "video";
|
|
820
820
|
id: string;
|
|
821
821
|
video_url: string;
|
|
822
822
|
mime_type: string;
|
|
823
823
|
thumbnail_url: string;
|
|
824
824
|
title: string;
|
|
825
825
|
caption?: string;
|
|
826
|
-
parse_mode?:
|
|
826
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
827
827
|
caption_entities?: MessageEntity[];
|
|
828
828
|
show_caption_above_media?: boolean;
|
|
829
829
|
video_width?: number;
|
|
@@ -834,12 +834,12 @@ export interface InlineQueryResultVideo {
|
|
|
834
834
|
input_message_content?: InputMessageContent;
|
|
835
835
|
}
|
|
836
836
|
export interface InlineQueryResultVoice {
|
|
837
|
-
type: "
|
|
837
|
+
type: "voice";
|
|
838
838
|
id: string;
|
|
839
839
|
voice_url: string;
|
|
840
840
|
title: string;
|
|
841
841
|
caption?: string;
|
|
842
|
-
parse_mode?:
|
|
842
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
843
843
|
caption_entities?: MessageEntity[];
|
|
844
844
|
voice_duration?: number;
|
|
845
845
|
reply_markup?: InlineKeyboardMarkup;
|
|
@@ -887,11 +887,11 @@ export interface InputLocationMessageContent {
|
|
|
887
887
|
}
|
|
888
888
|
export type InputMedia = InputMediaAnimation | InputMediaDocument | InputMediaAudio | InputMediaPhoto | InputMediaVideo;
|
|
889
889
|
export interface InputMediaAnimation {
|
|
890
|
-
type: "
|
|
890
|
+
type: "animation";
|
|
891
891
|
media: string;
|
|
892
892
|
thumbnail?: InputFile | string;
|
|
893
893
|
caption?: string;
|
|
894
|
-
parse_mode?:
|
|
894
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
895
895
|
caption_entities?: MessageEntity[];
|
|
896
896
|
show_caption_above_media?: boolean;
|
|
897
897
|
width?: number;
|
|
@@ -900,40 +900,40 @@ export interface InputMediaAnimation {
|
|
|
900
900
|
has_spoiler?: boolean;
|
|
901
901
|
}
|
|
902
902
|
export interface InputMediaAudio {
|
|
903
|
-
type: "
|
|
903
|
+
type: "audio";
|
|
904
904
|
media: string;
|
|
905
905
|
thumbnail?: InputFile | string;
|
|
906
906
|
caption?: string;
|
|
907
|
-
parse_mode?:
|
|
907
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
908
908
|
caption_entities?: MessageEntity[];
|
|
909
909
|
duration?: number;
|
|
910
910
|
performer?: string;
|
|
911
911
|
title?: string;
|
|
912
912
|
}
|
|
913
913
|
export interface InputMediaDocument {
|
|
914
|
-
type: "
|
|
914
|
+
type: "document";
|
|
915
915
|
media: string;
|
|
916
916
|
thumbnail?: InputFile | string;
|
|
917
917
|
caption?: string;
|
|
918
|
-
parse_mode?:
|
|
918
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
919
919
|
caption_entities?: MessageEntity[];
|
|
920
920
|
disable_content_type_detection?: boolean;
|
|
921
921
|
}
|
|
922
922
|
export interface InputMediaPhoto {
|
|
923
|
-
type: "
|
|
923
|
+
type: "photo";
|
|
924
924
|
media: string;
|
|
925
925
|
caption?: string;
|
|
926
|
-
parse_mode?:
|
|
926
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
927
927
|
caption_entities?: MessageEntity[];
|
|
928
928
|
show_caption_above_media?: boolean;
|
|
929
929
|
has_spoiler?: boolean;
|
|
930
930
|
}
|
|
931
931
|
export interface InputMediaVideo {
|
|
932
|
-
type: "
|
|
932
|
+
type: "video";
|
|
933
933
|
media: string;
|
|
934
934
|
thumbnail?: InputFile | string;
|
|
935
935
|
caption?: string;
|
|
936
|
-
parse_mode?:
|
|
936
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
937
937
|
caption_entities?: MessageEntity[];
|
|
938
938
|
show_caption_above_media?: boolean;
|
|
939
939
|
width?: number;
|
|
@@ -945,11 +945,11 @@ export interface InputMediaVideo {
|
|
|
945
945
|
export type InputMessageContent = InputTextMessageContent | InputLocationMessageContent | InputVenueMessageContent | InputContactMessageContent | InputInvoiceMessageContent;
|
|
946
946
|
export type InputPaidMedia = InputPaidMediaPhoto | InputPaidMediaVideo;
|
|
947
947
|
export interface InputPaidMediaPhoto {
|
|
948
|
-
type: "
|
|
948
|
+
type: "photo";
|
|
949
949
|
media: string;
|
|
950
950
|
}
|
|
951
951
|
export interface InputPaidMediaVideo {
|
|
952
|
-
type: "
|
|
952
|
+
type: "video";
|
|
953
953
|
media: string;
|
|
954
954
|
thumbnail?: InputFile | string;
|
|
955
955
|
width?: number;
|
|
@@ -959,7 +959,7 @@ export interface InputPaidMediaVideo {
|
|
|
959
959
|
}
|
|
960
960
|
export interface InputPollOption {
|
|
961
961
|
text: string;
|
|
962
|
-
text_parse_mode?:
|
|
962
|
+
text_parse_mode?: "HTML" | "MarkdownV2";
|
|
963
963
|
text_entities?: MessageEntity[];
|
|
964
964
|
}
|
|
965
965
|
export interface InputSticker {
|
|
@@ -971,7 +971,7 @@ export interface InputSticker {
|
|
|
971
971
|
}
|
|
972
972
|
export interface InputTextMessageContent {
|
|
973
973
|
message_text: string;
|
|
974
|
-
parse_mode?:
|
|
974
|
+
parse_mode?: "HTML" | "MarkdownV2";
|
|
975
975
|
entities?: MessageEntity[];
|
|
976
976
|
link_preview_options?: LinkPreviewOptions;
|
|
977
977
|
}
|
|
@@ -1046,9 +1046,9 @@ export interface Location {
|
|
|
1046
1046
|
proximity_alert_radius?: number;
|
|
1047
1047
|
}
|
|
1048
1048
|
export interface LoginUrl {
|
|
1049
|
-
url:
|
|
1049
|
+
url: string;
|
|
1050
1050
|
forward_text?: string;
|
|
1051
|
-
bot_username?:
|
|
1051
|
+
bot_username?: string;
|
|
1052
1052
|
request_write_access?: boolean;
|
|
1053
1053
|
}
|
|
1054
1054
|
export interface MaskPosition {
|
|
@@ -1060,13 +1060,13 @@ export interface MaskPosition {
|
|
|
1060
1060
|
export type MaybeInaccessibleMessage = Message | InaccessibleMessage;
|
|
1061
1061
|
export type MenuButton = MenuButtonCommands | MenuButtonWebApp | MenuButtonDefault;
|
|
1062
1062
|
export interface MenuButtonCommands {
|
|
1063
|
-
type: "
|
|
1063
|
+
type: "commands";
|
|
1064
1064
|
}
|
|
1065
1065
|
export interface MenuButtonDefault {
|
|
1066
|
-
type: "
|
|
1066
|
+
type: "default";
|
|
1067
1067
|
}
|
|
1068
1068
|
export interface MenuButtonWebApp {
|
|
1069
|
-
type: "
|
|
1069
|
+
type: "web_app";
|
|
1070
1070
|
text: string;
|
|
1071
1071
|
web_app: WebAppInfo;
|
|
1072
1072
|
}
|
|
@@ -1161,7 +1161,7 @@ export interface MessageAutoDeleteTimerChanged {
|
|
|
1161
1161
|
message_auto_delete_time: number;
|
|
1162
1162
|
}
|
|
1163
1163
|
export interface MessageEntity {
|
|
1164
|
-
type:
|
|
1164
|
+
type: "mention" | "hashtag" | "cashtag" | "bot_command" | "url" | "email" | "phone_number" | "bold" | "italic" | "underline" | "strikethrough" | "spoiler" | "blockquote" | "expandable_blockquote" | "code" | "pre" | "text_link" | "text_mention" | "custom_emoji";
|
|
1165
1165
|
offset: number;
|
|
1166
1166
|
length: number;
|
|
1167
1167
|
url?: string;
|
|
@@ -1246,56 +1246,56 @@ export interface PassportData {
|
|
|
1246
1246
|
}
|
|
1247
1247
|
export type PassportElementError = PassportElementErrorDataField | PassportElementErrorFrontSide | PassportElementErrorReverseSide | PassportElementErrorSelfie | PassportElementErrorFile | PassportElementErrorFiles | PassportElementErrorTranslationFile | PassportElementErrorTranslationFiles | PassportElementErrorUnspecified;
|
|
1248
1248
|
export interface PassportElementErrorDataField {
|
|
1249
|
-
source: "
|
|
1249
|
+
source: "data";
|
|
1250
1250
|
type: "personal_details" | "passport" | "driver_license" | "identity_card" | "internal_passport" | "address";
|
|
1251
1251
|
field_name: string;
|
|
1252
1252
|
data_hash: string;
|
|
1253
1253
|
message: string;
|
|
1254
1254
|
}
|
|
1255
1255
|
export interface PassportElementErrorFile {
|
|
1256
|
-
source: "
|
|
1256
|
+
source: "file";
|
|
1257
1257
|
type: "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration";
|
|
1258
1258
|
file_hash: string;
|
|
1259
1259
|
message: string;
|
|
1260
1260
|
}
|
|
1261
1261
|
export interface PassportElementErrorFiles {
|
|
1262
|
-
source: "
|
|
1262
|
+
source: "files";
|
|
1263
1263
|
type: "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration";
|
|
1264
1264
|
file_hashes: string[];
|
|
1265
1265
|
message: string;
|
|
1266
1266
|
}
|
|
1267
1267
|
export interface PassportElementErrorFrontSide {
|
|
1268
|
-
source: "
|
|
1268
|
+
source: "front_side";
|
|
1269
1269
|
type: "passport" | "driver_license" | "identity_card" | "internal_passport";
|
|
1270
1270
|
file_hash: string;
|
|
1271
1271
|
message: string;
|
|
1272
1272
|
}
|
|
1273
1273
|
export interface PassportElementErrorReverseSide {
|
|
1274
|
-
source: "
|
|
1274
|
+
source: "reverse_side";
|
|
1275
1275
|
type: "driver_license" | "identity_card";
|
|
1276
1276
|
file_hash: string;
|
|
1277
1277
|
message: string;
|
|
1278
1278
|
}
|
|
1279
1279
|
export interface PassportElementErrorSelfie {
|
|
1280
|
-
source: "
|
|
1280
|
+
source: "selfie";
|
|
1281
1281
|
type: "passport" | "driver_license" | "identity_card" | "internal_passport";
|
|
1282
1282
|
file_hash: string;
|
|
1283
1283
|
message: string;
|
|
1284
1284
|
}
|
|
1285
1285
|
export interface PassportElementErrorTranslationFile {
|
|
1286
|
-
source: "
|
|
1286
|
+
source: "translation_file";
|
|
1287
1287
|
type: "passport" | "driver_license" | "identity_card" | "internal_passport" | "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration";
|
|
1288
1288
|
file_hash: string;
|
|
1289
1289
|
message: string;
|
|
1290
1290
|
}
|
|
1291
1291
|
export interface PassportElementErrorTranslationFiles {
|
|
1292
|
-
source: "
|
|
1292
|
+
source: "translation_files";
|
|
1293
1293
|
type: "passport" | "driver_license" | "identity_card" | "internal_passport" | "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration";
|
|
1294
1294
|
file_hashes: string[];
|
|
1295
1295
|
message: string;
|
|
1296
1296
|
}
|
|
1297
1297
|
export interface PassportElementErrorUnspecified {
|
|
1298
|
-
source: "
|
|
1298
|
+
source: "unspecified";
|
|
1299
1299
|
type: string;
|
|
1300
1300
|
element_hash: string;
|
|
1301
1301
|
message: string;
|
|
@@ -1320,7 +1320,7 @@ export interface Poll {
|
|
|
1320
1320
|
total_voter_count: number;
|
|
1321
1321
|
is_closed: boolean;
|
|
1322
1322
|
is_anonymous: boolean;
|
|
1323
|
-
type:
|
|
1323
|
+
type: "regular" | "quiz";
|
|
1324
1324
|
allows_multiple_answers: boolean;
|
|
1325
1325
|
question_entities?: MessageEntity[];
|
|
1326
1326
|
correct_option_id?: number;
|
|
@@ -1397,8 +1397,8 @@ export interface ReplyParameters {
|
|
|
1397
1397
|
message_id: number;
|
|
1398
1398
|
chat_id?: number | string;
|
|
1399
1399
|
allow_sending_without_reply?: boolean;
|
|
1400
|
-
quote?:
|
|
1401
|
-
quote_parse_mode?:
|
|
1400
|
+
quote?: string;
|
|
1401
|
+
quote_parse_mode?: "HTML" | "MarkdownV2";
|
|
1402
1402
|
quote_entities?: MessageEntity[];
|
|
1403
1403
|
quote_position?: number;
|
|
1404
1404
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.BotFactoryServiceDefault = exports.BotFactoryService = void 0;
|
|
37
|
+
const Micro = __importStar(require("effect/Micro"));
|
|
38
|
+
const Context = __importStar(require("effect/Context"));
|
|
39
|
+
const config_js_1 = require("../../client/config.js");
|
|
40
|
+
const client_config_js_1 = require("./client-config.js");
|
|
41
|
+
const make_bot_js_1 = require("./make-bot.js");
|
|
42
|
+
class BotFactoryService extends Context.Tag("BotFactoryService")() {
|
|
43
|
+
}
|
|
44
|
+
exports.BotFactoryService = BotFactoryService;
|
|
45
|
+
;
|
|
46
|
+
exports.BotFactoryServiceDefault = {
|
|
47
|
+
makeBot: make_bot_js_1.makeBot,
|
|
48
|
+
runBot: (input) => (0, make_bot_js_1.makeBot)(input).pipe(Micro.provideServiceEffect(config_js_1.TgBotClientConfig, (0, client_config_js_1.makeClientConfigFrom)(input)))
|
|
49
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.makeClientConfigFrom = void 0;
|
|
37
|
+
const Micro = __importStar(require("effect/Micro"));
|
|
38
|
+
const fs_1 = require("fs");
|
|
39
|
+
const config_js_1 = require("../../client/config.js");
|
|
40
|
+
const guards_js_1 = require("../../client/guards.js");
|
|
41
|
+
const makeClientConfigFrom = (input) => Micro.gen(function* () {
|
|
42
|
+
if (input.type == "config") {
|
|
43
|
+
return (0, config_js_1.makeTgBotClientConfig)(input);
|
|
44
|
+
}
|
|
45
|
+
const config = yield* Micro.try({
|
|
46
|
+
try: () => JSON.parse((0, fs_1.readFileSync)("config.json").toString("utf-8")),
|
|
47
|
+
catch: error => {
|
|
48
|
+
console.warn(error);
|
|
49
|
+
return "ReadingConfigError";
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
if (!(0, guards_js_1.isTgBotClientSettingsInput)(config)) {
|
|
53
|
+
return yield* Micro.fail("InvalidConfig");
|
|
54
|
+
}
|
|
55
|
+
return (0, config_js_1.makeTgBotClientConfig)(config);
|
|
56
|
+
});
|
|
57
|
+
exports.makeClientConfigFrom = makeClientConfigFrom;
|