rubika 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -0
- package/package.json +19 -0
- package/src/bot.ts +197 -0
- package/src/filters.ts +92 -0
- package/src/index.ts +8 -0
- package/src/methods/advanced/builder.ts +23 -0
- package/src/methods/advanced/index.ts +3 -0
- package/src/methods/bot/getMe.ts +8 -0
- package/src/methods/bot/index.ts +3 -0
- package/src/methods/chat/getChat.ts +7 -0
- package/src/methods/chat/index.ts +3 -0
- package/src/methods/files/_sendFile.ts +47 -0
- package/src/methods/files/getFile.ts +7 -0
- package/src/methods/files/index.ts +6 -0
- package/src/methods/files/requestSendFile.ts +8 -0
- package/src/methods/files/uploadFile.ts +88 -0
- package/src/methods/index.ts +223 -0
- package/src/methods/messages/deleteMessage.ts +14 -0
- package/src/methods/messages/editChatKeypad.ts +20 -0
- package/src/methods/messages/editMessageKeypad.ts +19 -0
- package/src/methods/messages/editMessageText.ts +16 -0
- package/src/methods/messages/forwardMessage.ts +18 -0
- package/src/methods/messages/index.ts +36 -0
- package/src/methods/messages/sendContact.ts +40 -0
- package/src/methods/messages/sendFile.ts +30 -0
- package/src/methods/messages/sendGif.ts +30 -0
- package/src/methods/messages/sendImage.ts +30 -0
- package/src/methods/messages/sendLocation.ts +38 -0
- package/src/methods/messages/sendMessage.ts +41 -0
- package/src/methods/messages/sendMusic.ts +30 -0
- package/src/methods/messages/sendPoll.ts +12 -0
- package/src/methods/messages/sendSticker.ts +38 -0
- package/src/methods/messages/sendVideo.ts +30 -0
- package/src/methods/messages/sendVoice.ts +30 -0
- package/src/methods/settings/index.ts +4 -0
- package/src/methods/settings/setCommands.ts +9 -0
- package/src/methods/settings/updateBotEndpoints.ts +15 -0
- package/src/methods/utilities/getUpdates.ts +7 -0
- package/src/methods/utilities/handleUpdates.ts +49 -0
- package/src/methods/utilities/index.ts +7 -0
- package/src/methods/utilities/polling.ts +63 -0
- package/src/methods/utilities/run.ts +21 -0
- package/src/methods/utilities/start.ts +23 -0
- package/src/methods/utilities/webhook.ts +55 -0
- package/src/network.ts +46 -0
- package/src/types/enums.ts +125 -0
- package/src/types/handlers.ts +16 -0
- package/src/types/interfaces.ts +263 -0
- package/src/types/methods.ts +21 -0
- package/src/types/utils.ts +9 -0
- package/src/utils/checkFilter.ts +19 -0
- package/src/utils/parser.ts +127 -0
- package/src/utils/prompt.ts +29 -0
- package/src/utils.ts +13 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import Bot from "../bot";
|
|
2
|
+
|
|
3
|
+
// types
|
|
4
|
+
|
|
5
|
+
import * as BotMethods from "./bot";
|
|
6
|
+
import * as Advanced from "./advanced";
|
|
7
|
+
import * as Utilities from "./utilities";
|
|
8
|
+
import * as Files from "./files";
|
|
9
|
+
import * as Messages from "./messages";
|
|
10
|
+
import * as Chat from "./chat";
|
|
11
|
+
import * as Settings from "./settings";
|
|
12
|
+
|
|
13
|
+
import * as Types from "../types/interfaces";
|
|
14
|
+
|
|
15
|
+
export default class Methods {
|
|
16
|
+
// advanced
|
|
17
|
+
async builder(
|
|
18
|
+
this: Bot,
|
|
19
|
+
...args: Parameters<typeof Advanced.builder>
|
|
20
|
+
): Promise<any> {
|
|
21
|
+
return Advanced.builder.apply(this, args);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// bot
|
|
25
|
+
async getMe(
|
|
26
|
+
this: Bot,
|
|
27
|
+
...args: Parameters<typeof BotMethods.getMe>
|
|
28
|
+
): Promise<Types.Bot> {
|
|
29
|
+
return BotMethods.getMe.apply(this, args);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// files
|
|
33
|
+
async getFile(
|
|
34
|
+
this: Bot,
|
|
35
|
+
...args: Parameters<typeof Files.getFile>
|
|
36
|
+
): Promise<any> {
|
|
37
|
+
return Files.getFile.apply(this, args);
|
|
38
|
+
}
|
|
39
|
+
async requestSendFile(
|
|
40
|
+
this: Bot,
|
|
41
|
+
...args: Parameters<typeof Files.requestSendFile>
|
|
42
|
+
): Promise<{ upload_url: string }> {
|
|
43
|
+
return Files.requestSendFile.apply(this, args);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async uploadFile(
|
|
47
|
+
this: Bot,
|
|
48
|
+
...args: Parameters<typeof Files.uploadFile>
|
|
49
|
+
): Promise<Types.UploadFile> {
|
|
50
|
+
return Files.uploadFile.apply(this, args);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async _sendFile(
|
|
54
|
+
this: Bot,
|
|
55
|
+
...args: Parameters<typeof Files._sendFile>
|
|
56
|
+
): Promise<Types.SendMessage> {
|
|
57
|
+
return Files._sendFile.apply(this, args);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async sendMessage(
|
|
61
|
+
this: Bot,
|
|
62
|
+
...args: Parameters<typeof Messages.sendMessage>
|
|
63
|
+
): Promise<Types.SendMessage> {
|
|
64
|
+
return Messages.sendMessage.apply(this, args);
|
|
65
|
+
}
|
|
66
|
+
async sendMusic(
|
|
67
|
+
this: Bot,
|
|
68
|
+
...args: Parameters<typeof Messages.sendMusic>
|
|
69
|
+
): Promise<Types.SendMessage> {
|
|
70
|
+
return Messages.sendMusic.apply(this, args);
|
|
71
|
+
}
|
|
72
|
+
async sendFile(
|
|
73
|
+
this: Bot,
|
|
74
|
+
...args: Parameters<typeof Messages.sendFile>
|
|
75
|
+
): Promise<Types.SendMessage> {
|
|
76
|
+
return Messages.sendFile.apply(this, args);
|
|
77
|
+
}
|
|
78
|
+
async sendGif(
|
|
79
|
+
this: Bot,
|
|
80
|
+
...args: Parameters<typeof Messages.sendGif>
|
|
81
|
+
): Promise<Types.SendMessage> {
|
|
82
|
+
return Messages.sendGif.apply(this, args);
|
|
83
|
+
}
|
|
84
|
+
async sendImage(
|
|
85
|
+
this: Bot,
|
|
86
|
+
...args: Parameters<typeof Messages.sendImage>
|
|
87
|
+
): Promise<Types.SendMessage> {
|
|
88
|
+
return Messages.sendImage.apply(this, args);
|
|
89
|
+
}
|
|
90
|
+
async sendSticker(
|
|
91
|
+
this: Bot,
|
|
92
|
+
...args: Parameters<typeof Messages.sendSticker>
|
|
93
|
+
): Promise<Types.SendMessage> {
|
|
94
|
+
return Messages.sendSticker.apply(this, args);
|
|
95
|
+
}
|
|
96
|
+
async sendVideo(
|
|
97
|
+
this: Bot,
|
|
98
|
+
...args: Parameters<typeof Messages.sendVideo>
|
|
99
|
+
): Promise<Types.SendMessage> {
|
|
100
|
+
return Messages.sendVideo.apply(this, args);
|
|
101
|
+
}
|
|
102
|
+
async sendVoice(
|
|
103
|
+
this: Bot,
|
|
104
|
+
...args: Parameters<typeof Messages.sendVoice>
|
|
105
|
+
): Promise<Types.SendMessage> {
|
|
106
|
+
return Messages.sendVoice.apply(this, args);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async sendPoll(
|
|
110
|
+
this: Bot,
|
|
111
|
+
...args: Parameters<typeof Messages.sendPoll>
|
|
112
|
+
): Promise<Types.SendMessage> {
|
|
113
|
+
return Messages.sendPoll.apply(this, args);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async sendLocation(
|
|
117
|
+
this: Bot,
|
|
118
|
+
...args: Parameters<typeof Messages.sendLocation>
|
|
119
|
+
): Promise<Types.SendMessage> {
|
|
120
|
+
return Messages.sendLocation.apply(this, args);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async sendContact(
|
|
124
|
+
this: Bot,
|
|
125
|
+
...args: Parameters<typeof Messages.sendContact>
|
|
126
|
+
): Promise<Types.SendMessage> {
|
|
127
|
+
return Messages.sendContact.apply(this, args);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
async forwardMessage(
|
|
131
|
+
this: Bot,
|
|
132
|
+
...args: Parameters<typeof Messages.forwardMessage>
|
|
133
|
+
): Promise<Types.SendMessage> {
|
|
134
|
+
return Messages.forwardMessage.apply(this, args);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async editMessageText(
|
|
138
|
+
this: Bot,
|
|
139
|
+
...args: Parameters<typeof Messages.editMessageText>
|
|
140
|
+
): Promise<Types.SendMessage> {
|
|
141
|
+
return Messages.editMessageText.apply(this, args);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async deleteMessage(
|
|
145
|
+
this: Bot,
|
|
146
|
+
...args: Parameters<typeof Messages.deleteMessage>
|
|
147
|
+
): Promise<Types.SendMessage> {
|
|
148
|
+
return Messages.deleteMessage.apply(this, args);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
async editMessageKeypad(
|
|
152
|
+
this: Bot,
|
|
153
|
+
...args: Parameters<typeof Messages.editMessageKeypad>
|
|
154
|
+
): Promise<Types.SendMessage> {
|
|
155
|
+
return Messages.editMessageKeypad.apply(this, args);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async editChatKeypad(
|
|
159
|
+
this: Bot,
|
|
160
|
+
...args: Parameters<typeof Messages.editChatKeypad>
|
|
161
|
+
): Promise<Types.SendMessage> {
|
|
162
|
+
return Messages.editChatKeypad.apply(this, args);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// chat
|
|
166
|
+
async getChat(
|
|
167
|
+
this: Bot,
|
|
168
|
+
...args: Parameters<typeof Chat.getChat>
|
|
169
|
+
): Promise<Types.Chat> {
|
|
170
|
+
return Chat.getChat.apply(this, args);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// utilities
|
|
174
|
+
async start(
|
|
175
|
+
this: Bot,
|
|
176
|
+
...args: Parameters<typeof Utilities.start>
|
|
177
|
+
): Promise<any> {
|
|
178
|
+
return Utilities.start.apply(this, args);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
async run(
|
|
182
|
+
this: Bot,
|
|
183
|
+
...args: Parameters<typeof Utilities.run>
|
|
184
|
+
): Promise<any> {
|
|
185
|
+
return Utilities.run.apply(this, args);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
async getUpdates(
|
|
189
|
+
this: Bot,
|
|
190
|
+
...args: Parameters<typeof Utilities.getUpdates>
|
|
191
|
+
): Promise<any> {
|
|
192
|
+
return Utilities.getUpdates.apply(this, args);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
async __setupWebhook(
|
|
196
|
+
this: Bot,
|
|
197
|
+
...args: Parameters<typeof Utilities.setupWebhook>
|
|
198
|
+
): Promise<any> {
|
|
199
|
+
return Utilities.setupWebhook.apply(this, args);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
async __polling(
|
|
203
|
+
this: Bot,
|
|
204
|
+
...args: Parameters<typeof Utilities.polling>
|
|
205
|
+
): Promise<any> {
|
|
206
|
+
return Utilities.polling.apply(this, args);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// settings
|
|
210
|
+
async setCommands(
|
|
211
|
+
this: Bot,
|
|
212
|
+
...args: Parameters<typeof Settings.setCommands>
|
|
213
|
+
): Promise<any> {
|
|
214
|
+
return Settings.setCommands.apply(this, args);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
async updateBotEndpoints(
|
|
218
|
+
this: Bot,
|
|
219
|
+
...args: Parameters<typeof Settings.updateBotEndpoints>
|
|
220
|
+
): Promise<any> {
|
|
221
|
+
return Settings.updateBotEndpoints.apply(this, args);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Bot from "../..";
|
|
2
|
+
import { Keypad } from "../../types/interfaces";
|
|
3
|
+
import { ChatKeypadTypeEnum } from "../../types/enums";
|
|
4
|
+
|
|
5
|
+
async function editChatKeypad(
|
|
6
|
+
this: Bot,
|
|
7
|
+
chat_id: string,
|
|
8
|
+
chat_keypad: Keypad,
|
|
9
|
+
chat_keypad_type: ChatKeypadTypeEnum = ChatKeypadTypeEnum.New
|
|
10
|
+
) {
|
|
11
|
+
const data = {
|
|
12
|
+
chat_id,
|
|
13
|
+
chat_keypad,
|
|
14
|
+
chat_keypad_type,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return await this.builder("editChatKeypad", data);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default editChatKeypad;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Bot from "../..";
|
|
2
|
+
import { InlineKeypad } from "../../types/interfaces";
|
|
3
|
+
|
|
4
|
+
async function editMessageKeypad(
|
|
5
|
+
this: Bot,
|
|
6
|
+
chat_id: string,
|
|
7
|
+
message_id: string,
|
|
8
|
+
inline_keypad?: InlineKeypad
|
|
9
|
+
) {
|
|
10
|
+
const data = {
|
|
11
|
+
chat_id,
|
|
12
|
+
message_id,
|
|
13
|
+
inline_keypad,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return await this.builder("editMessageKeypad", data);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default editMessageKeypad;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Bot from "../..";
|
|
2
|
+
|
|
3
|
+
async function editMessageText(
|
|
4
|
+
this: Bot,
|
|
5
|
+
chat_id: string,
|
|
6
|
+
text: string,
|
|
7
|
+
message_id: string
|
|
8
|
+
) {
|
|
9
|
+
return await this.builder("editMessageText", {
|
|
10
|
+
chat_id,
|
|
11
|
+
message_id,
|
|
12
|
+
text,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default editMessageText;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Bot from "../..";
|
|
2
|
+
|
|
3
|
+
async function forwardMessage(
|
|
4
|
+
this: Bot,
|
|
5
|
+
from_chat_id: string,
|
|
6
|
+
message_id: string,
|
|
7
|
+
to_chat_id: string,
|
|
8
|
+
disable_notification = false
|
|
9
|
+
) {
|
|
10
|
+
return await this.builder("forwardMessage", {
|
|
11
|
+
from_chat_id,
|
|
12
|
+
message_id,
|
|
13
|
+
to_chat_id,
|
|
14
|
+
disable_notification,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default forwardMessage;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import deleteMessage from './deleteMessage';
|
|
2
|
+
import editChatKeypad from './editChatKeypad';
|
|
3
|
+
import editMessageKeypad from './editMessageKeypad';
|
|
4
|
+
import editMessageText from './editMessageText';
|
|
5
|
+
import forwardMessage from './forwardMessage';
|
|
6
|
+
import sendContact from './sendContact';
|
|
7
|
+
import sendFile from './sendFile';
|
|
8
|
+
import sendGif from './sendGif';
|
|
9
|
+
import sendImage from './sendImage';
|
|
10
|
+
import sendLocation from './sendLocation';
|
|
11
|
+
import sendMessage from './sendMessage';
|
|
12
|
+
import sendMusic from './sendMusic';
|
|
13
|
+
import sendPoll from './sendPoll';
|
|
14
|
+
import sendSticker from './sendSticker';
|
|
15
|
+
import sendVideo from './sendVideo';
|
|
16
|
+
import sendVoice from './sendVoice';
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
sendMessage,
|
|
21
|
+
sendPoll,
|
|
22
|
+
sendLocation,
|
|
23
|
+
sendContact,
|
|
24
|
+
forwardMessage,
|
|
25
|
+
editMessageText,
|
|
26
|
+
deleteMessage,
|
|
27
|
+
editMessageKeypad,
|
|
28
|
+
editChatKeypad,
|
|
29
|
+
sendMusic,
|
|
30
|
+
sendFile,
|
|
31
|
+
sendGif,
|
|
32
|
+
sendImage,
|
|
33
|
+
sendSticker,
|
|
34
|
+
sendVideo,
|
|
35
|
+
sendVoice,
|
|
36
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Bot from '../..';
|
|
2
|
+
import { Keypad } from '../../types/interfaces';
|
|
3
|
+
import { ChatKeypadTypeEnum } from '../../types/enums';
|
|
4
|
+
|
|
5
|
+
async function sendContact(
|
|
6
|
+
this: Bot,
|
|
7
|
+
chat_id: string,
|
|
8
|
+
first_name: string,
|
|
9
|
+
last_name: string,
|
|
10
|
+
phone_number: string,
|
|
11
|
+
chat_keypad?: Keypad,
|
|
12
|
+
inline_keypad?: Keypad,
|
|
13
|
+
disable_notification = false,
|
|
14
|
+
reply_to_message_id?: string,
|
|
15
|
+
chat_keypad_type?: ChatKeypadTypeEnum,
|
|
16
|
+
) {
|
|
17
|
+
const data = {
|
|
18
|
+
chat_id,
|
|
19
|
+
first_name,
|
|
20
|
+
last_name,
|
|
21
|
+
phone_number,
|
|
22
|
+
chat_keypad,
|
|
23
|
+
inline_keypad,
|
|
24
|
+
disable_notification,
|
|
25
|
+
reply_to_message_id,
|
|
26
|
+
chat_keypad_type,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
if (chat_keypad && !chat_keypad_type) {
|
|
30
|
+
data.chat_keypad_type = ChatKeypadTypeEnum.New;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (inline_keypad && chat_keypad_type) {
|
|
34
|
+
data.chat_keypad_type = ChatKeypadTypeEnum.None;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return await this.builder('sendContact', data);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default sendContact;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Bot from "../..";
|
|
2
|
+
import { InlineKeypad, Keypad } from "../../types/interfaces";
|
|
3
|
+
import { ChatKeypadTypeEnum, FileTypeEnum } from "../../types/enums";
|
|
4
|
+
import { FileSource } from "../../types/methods";
|
|
5
|
+
|
|
6
|
+
async function sendFile(
|
|
7
|
+
this: Bot,
|
|
8
|
+
chat_id: string,
|
|
9
|
+
file: FileSource,
|
|
10
|
+
text?: string,
|
|
11
|
+
chat_keypad?: Keypad,
|
|
12
|
+
inline_keypad?: InlineKeypad,
|
|
13
|
+
disable_notification = false,
|
|
14
|
+
reply_to_message_id?: string,
|
|
15
|
+
chat_keypad_type?: ChatKeypadTypeEnum
|
|
16
|
+
) {
|
|
17
|
+
return await this._sendFile(
|
|
18
|
+
chat_id,
|
|
19
|
+
file,
|
|
20
|
+
text,
|
|
21
|
+
FileTypeEnum.File,
|
|
22
|
+
chat_keypad,
|
|
23
|
+
inline_keypad,
|
|
24
|
+
disable_notification,
|
|
25
|
+
reply_to_message_id,
|
|
26
|
+
chat_keypad_type
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default sendFile;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Bot from '../..';
|
|
2
|
+
import { InlineKeypad, Keypad } from "../../types/interfaces";
|
|
3
|
+
import { ChatKeypadTypeEnum, FileTypeEnum } from "../../types/enums";
|
|
4
|
+
import { FileSource } from "../../types/methods";
|
|
5
|
+
|
|
6
|
+
async function sendGif(
|
|
7
|
+
this: Bot,
|
|
8
|
+
chat_id: string,
|
|
9
|
+
file: FileSource,
|
|
10
|
+
text?: string,
|
|
11
|
+
chat_keypad?: Keypad,
|
|
12
|
+
inline_keypad?: InlineKeypad,
|
|
13
|
+
disable_notification = false,
|
|
14
|
+
reply_to_message_id?: string,
|
|
15
|
+
chat_keypad_type?: ChatKeypadTypeEnum,
|
|
16
|
+
) {
|
|
17
|
+
return await this._sendFile(
|
|
18
|
+
chat_id,
|
|
19
|
+
file,
|
|
20
|
+
text,
|
|
21
|
+
FileTypeEnum.Gif,
|
|
22
|
+
chat_keypad,
|
|
23
|
+
inline_keypad,
|
|
24
|
+
disable_notification,
|
|
25
|
+
reply_to_message_id,
|
|
26
|
+
chat_keypad_type,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default sendGif;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Bot from '../..';
|
|
2
|
+
import { InlineKeypad, Keypad } from "../../types/interfaces";
|
|
3
|
+
import { ChatKeypadTypeEnum, FileTypeEnum } from "../../types/enums";
|
|
4
|
+
import { FileSource } from "../../types/methods";
|
|
5
|
+
|
|
6
|
+
async function sendImage(
|
|
7
|
+
this: Bot,
|
|
8
|
+
chat_id: string,
|
|
9
|
+
file: FileSource,
|
|
10
|
+
text?: string,
|
|
11
|
+
chat_keypad?: Keypad,
|
|
12
|
+
inline_keypad?: InlineKeypad,
|
|
13
|
+
disable_notification = false,
|
|
14
|
+
reply_to_message_id?: string,
|
|
15
|
+
chat_keypad_type?: ChatKeypadTypeEnum,
|
|
16
|
+
) {
|
|
17
|
+
return await this._sendFile(
|
|
18
|
+
chat_id,
|
|
19
|
+
file,
|
|
20
|
+
text,
|
|
21
|
+
FileTypeEnum.Image,
|
|
22
|
+
chat_keypad,
|
|
23
|
+
inline_keypad,
|
|
24
|
+
disable_notification,
|
|
25
|
+
reply_to_message_id,
|
|
26
|
+
chat_keypad_type,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default sendImage;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import Bot from "../..";
|
|
2
|
+
import { Keypad } from "../../types/interfaces";
|
|
3
|
+
import { ChatKeypadTypeEnum } from "../../types/enums";
|
|
4
|
+
|
|
5
|
+
async function sendLocation(
|
|
6
|
+
this: Bot,
|
|
7
|
+
chat_id: string,
|
|
8
|
+
latitude: string,
|
|
9
|
+
longitude: string,
|
|
10
|
+
chat_keypad?: Keypad,
|
|
11
|
+
inline_keypad?: Keypad,
|
|
12
|
+
disable_notification = false,
|
|
13
|
+
reply_to_message_id?: string,
|
|
14
|
+
chat_keypad_type?: ChatKeypadTypeEnum
|
|
15
|
+
) {
|
|
16
|
+
const data = {
|
|
17
|
+
chat_id,
|
|
18
|
+
latitude,
|
|
19
|
+
longitude,
|
|
20
|
+
chat_keypad,
|
|
21
|
+
inline_keypad,
|
|
22
|
+
disable_notification,
|
|
23
|
+
reply_to_message_id,
|
|
24
|
+
chat_keypad_type,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
if (chat_keypad && !chat_keypad_type) {
|
|
28
|
+
data.chat_keypad_type = ChatKeypadTypeEnum.New;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (inline_keypad && chat_keypad_type) {
|
|
32
|
+
data.chat_keypad_type = ChatKeypadTypeEnum.None;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return await this.builder("sendLocation", data);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default sendLocation;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import Bot from "../..";
|
|
2
|
+
import { InlineKeypad, Keypad } from "../../types/interfaces";
|
|
3
|
+
import { ChatKeypadTypeEnum } from "../../types/enums";
|
|
4
|
+
import { SendType } from "../../types/methods";
|
|
5
|
+
import Markdown from "../../utils/parser";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
async function sendMessage(
|
|
9
|
+
this: Bot,
|
|
10
|
+
chat_id: string,
|
|
11
|
+
text: string,
|
|
12
|
+
chat_keypad?: Keypad,
|
|
13
|
+
inline_keypad?: InlineKeypad,
|
|
14
|
+
disable_notification = false,
|
|
15
|
+
reply_to_message_id?: string,
|
|
16
|
+
chat_keypad_type?: ChatKeypadTypeEnum
|
|
17
|
+
) {
|
|
18
|
+
|
|
19
|
+
let data: SendType = {
|
|
20
|
+
chat_id,
|
|
21
|
+
disable_notification,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
if (text) data = { ...data, ...Markdown.toMetadata(text.trim()) };
|
|
25
|
+
if (chat_keypad) data.chat_keypad = chat_keypad;
|
|
26
|
+
if (inline_keypad) data.inline_keypad = inline_keypad;
|
|
27
|
+
if (chat_keypad_type) data.chat_keypad_type = chat_keypad_type;
|
|
28
|
+
if (reply_to_message_id) data.reply_to_message_id = reply_to_message_id;
|
|
29
|
+
|
|
30
|
+
if (chat_keypad && !chat_keypad_type) {
|
|
31
|
+
data.chat_keypad_type = ChatKeypadTypeEnum.New;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (inline_keypad && chat_keypad_type) {
|
|
35
|
+
data.chat_keypad_type = ChatKeypadTypeEnum.None;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return await this.builder("sendMessage", data);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default sendMessage;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Bot from '../..';
|
|
2
|
+
import { InlineKeypad, Keypad } from "../../types/interfaces";
|
|
3
|
+
import { ChatKeypadTypeEnum, FileTypeEnum } from "../../types/enums";
|
|
4
|
+
import { FileSource } from "../../types/methods";
|
|
5
|
+
|
|
6
|
+
async function sendMusic(
|
|
7
|
+
this: Bot,
|
|
8
|
+
chat_id: string,
|
|
9
|
+
file: FileSource,
|
|
10
|
+
text?: string,
|
|
11
|
+
chat_keypad?: Keypad,
|
|
12
|
+
inline_keypad?: InlineKeypad,
|
|
13
|
+
disable_notification = false,
|
|
14
|
+
reply_to_message_id?: string,
|
|
15
|
+
chat_keypad_type?: ChatKeypadTypeEnum,
|
|
16
|
+
) {
|
|
17
|
+
return await this._sendFile(
|
|
18
|
+
chat_id,
|
|
19
|
+
file,
|
|
20
|
+
text,
|
|
21
|
+
FileTypeEnum.Music,
|
|
22
|
+
chat_keypad,
|
|
23
|
+
inline_keypad,
|
|
24
|
+
disable_notification,
|
|
25
|
+
reply_to_message_id,
|
|
26
|
+
chat_keypad_type,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default sendMusic;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import Bot from "../..";
|
|
2
|
+
import { SendType } from "../../types/methods";
|
|
3
|
+
import { ChatKeypadTypeEnum } from "../../types/enums";
|
|
4
|
+
import { InlineKeypad, Keypad } from "../../types/interfaces";
|
|
5
|
+
|
|
6
|
+
async function sendSticker(
|
|
7
|
+
this: Bot,
|
|
8
|
+
chat_id: string,
|
|
9
|
+
sticker_id: string,
|
|
10
|
+
chat_keypad?: Keypad,
|
|
11
|
+
inline_keypad?: InlineKeypad,
|
|
12
|
+
disable_notification = false,
|
|
13
|
+
reply_to_message_id?: string,
|
|
14
|
+
chat_keypad_type?: ChatKeypadTypeEnum
|
|
15
|
+
) {
|
|
16
|
+
let data: SendType = {
|
|
17
|
+
chat_id,
|
|
18
|
+
sticker_id,
|
|
19
|
+
disable_notification,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
if (chat_keypad) data.chat_keypad = chat_keypad;
|
|
23
|
+
if (inline_keypad) data.inline_keypad = inline_keypad;
|
|
24
|
+
if (chat_keypad_type) data.chat_keypad_type = chat_keypad_type;
|
|
25
|
+
if (reply_to_message_id) data.reply_to_message_id = reply_to_message_id;
|
|
26
|
+
|
|
27
|
+
if (chat_keypad && !chat_keypad_type) {
|
|
28
|
+
data.chat_keypad_type = ChatKeypadTypeEnum.New;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (inline_keypad && chat_keypad_type) {
|
|
32
|
+
data.chat_keypad_type = ChatKeypadTypeEnum.None;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return await this.builder("sendSticker", data);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default sendSticker;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Bot from '../..';
|
|
2
|
+
import { InlineKeypad, Keypad } from "../../types/interfaces";
|
|
3
|
+
import { ChatKeypadTypeEnum, FileTypeEnum } from "../../types/enums";
|
|
4
|
+
import { FileSource } from "../../types/methods";
|
|
5
|
+
|
|
6
|
+
async function sendVideo(
|
|
7
|
+
this: Bot,
|
|
8
|
+
chat_id: string,
|
|
9
|
+
file: FileSource,
|
|
10
|
+
text?: string,
|
|
11
|
+
chat_keypad?: Keypad,
|
|
12
|
+
inline_keypad?: InlineKeypad,
|
|
13
|
+
disable_notification = false,
|
|
14
|
+
reply_to_message_id?: string,
|
|
15
|
+
chat_keypad_type?: ChatKeypadTypeEnum,
|
|
16
|
+
) {
|
|
17
|
+
return await this._sendFile(
|
|
18
|
+
chat_id,
|
|
19
|
+
file,
|
|
20
|
+
text,
|
|
21
|
+
FileTypeEnum.Video,
|
|
22
|
+
chat_keypad,
|
|
23
|
+
inline_keypad,
|
|
24
|
+
disable_notification,
|
|
25
|
+
reply_to_message_id,
|
|
26
|
+
chat_keypad_type,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default sendVideo;
|