rubjs 3.1.3 → 3.1.5
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/lib/core/bot/contexts/inline.context.d.ts +1 -1
- package/lib/core/bot/contexts/inline.context.js +1 -1
- package/lib/core/bot/contexts/message.context.d.ts +3 -3
- package/lib/core/bot/contexts/message.context.js +3 -3
- package/lib/core/bot/methods/files/_sendFile.d.ts +4 -0
- package/lib/core/bot/methods/files/_sendFile.js +37 -0
- package/lib/core/bot/methods/files/index.d.ts +2 -1
- package/lib/core/bot/methods/files/index.js +3 -1
- package/lib/core/bot/methods/files/uploadFile.d.ts +1 -1
- package/lib/core/bot/methods/files/uploadFile.js +10 -12
- package/lib/core/bot/methods/index.d.ts +20 -13
- package/lib/core/bot/methods/index.js +21 -0
- package/lib/core/bot/methods/messages/index.d.ts +7 -1
- package/lib/core/bot/methods/messages/index.js +13 -1
- package/lib/core/bot/methods/messages/sendContact.d.ts +1 -1
- package/lib/core/bot/methods/messages/sendFile.d.ts +4 -0
- package/lib/core/bot/methods/messages/sendFile.js +7 -0
- package/lib/core/bot/methods/messages/sendGif.d.ts +4 -0
- package/lib/core/bot/methods/messages/sendGif.js +7 -0
- package/lib/core/bot/methods/messages/sendImage.d.ts +4 -0
- package/lib/core/bot/methods/messages/sendImage.js +7 -0
- package/lib/core/bot/methods/messages/sendLocation.d.ts +1 -1
- package/lib/core/bot/methods/messages/sendMessage.js +10 -5
- package/lib/core/bot/methods/messages/sendMusic.d.ts +4 -0
- package/lib/core/bot/methods/messages/sendMusic.js +7 -0
- package/lib/core/bot/methods/messages/sendVideo.d.ts +4 -0
- package/lib/core/bot/methods/messages/sendVideo.js +7 -0
- package/lib/core/bot/methods/messages/sendVoice.d.ts +4 -0
- package/lib/core/bot/methods/messages/sendVoice.js +7 -0
- package/lib/core/bot/types/models.d.ts +7 -0
- package/package.json +1 -1
|
@@ -11,6 +11,6 @@ declare class InlineMessage implements InlineMessageType {
|
|
|
11
11
|
store: Record<string, any>;
|
|
12
12
|
bot: Bot;
|
|
13
13
|
constructor(bot: Bot, update: InlineMessageType);
|
|
14
|
-
reply(text: string, chat_keypad?: Keypad, inline_keypad?: InlineKeypad, disable_notification?: boolean, reply_to_message_id?: string, chat_keypad_type?: ChatKeypadTypeEnum): Promise<
|
|
14
|
+
reply(text: string, chat_keypad?: Keypad, inline_keypad?: InlineKeypad, disable_notification?: boolean, reply_to_message_id?: string, chat_keypad_type?: ChatKeypadTypeEnum): Promise<import("../types/models").SendMessage>;
|
|
15
15
|
}
|
|
16
16
|
export default InlineMessage;
|
|
@@ -21,7 +21,7 @@ class InlineMessage {
|
|
|
21
21
|
this.message_id = update.message_id;
|
|
22
22
|
}
|
|
23
23
|
async reply(text, chat_keypad, inline_keypad, disable_notification = false, reply_to_message_id, chat_keypad_type) {
|
|
24
|
-
await this.bot.sendMessage(this.chat_id, text, chat_keypad, inline_keypad, disable_notification, reply_to_message_id, chat_keypad_type);
|
|
24
|
+
return await this.bot.sendMessage(this.chat_id, text, chat_keypad, inline_keypad, disable_notification, reply_to_message_id, chat_keypad_type);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
exports.default = InlineMessage;
|
|
@@ -10,8 +10,8 @@ declare class Message implements Update {
|
|
|
10
10
|
store: Record<string, any>;
|
|
11
11
|
bot: Bot;
|
|
12
12
|
constructor(bot: Bot, update: Update);
|
|
13
|
-
reply(text: string, chat_keypad?: Keypad, inline_keypad?: InlineKeypad, disable_notification?: boolean, reply_to_message_id?: string, chat_keypad_type?: ChatKeypadTypeEnum): Promise<
|
|
14
|
-
forward(to_chat_id: string, disable_notification?: boolean): Promise<
|
|
15
|
-
delete(): Promise<
|
|
13
|
+
reply(text: string, chat_keypad?: Keypad, inline_keypad?: InlineKeypad, disable_notification?: boolean, reply_to_message_id?: string, chat_keypad_type?: ChatKeypadTypeEnum): Promise<import("../types/models").SendMessage>;
|
|
14
|
+
forward(to_chat_id: string, disable_notification?: boolean): Promise<import("../types/models").SendMessage | undefined>;
|
|
15
|
+
delete(): Promise<import("../types/models").SendMessage | undefined>;
|
|
16
16
|
}
|
|
17
17
|
export default Message;
|
|
@@ -21,19 +21,19 @@ class Message {
|
|
|
21
21
|
this.removed_message_id = update.removed_message_id;
|
|
22
22
|
}
|
|
23
23
|
async reply(text, chat_keypad, inline_keypad, disable_notification = false, reply_to_message_id, chat_keypad_type) {
|
|
24
|
-
await this.bot.sendMessage(this.chat_id, text, chat_keypad, inline_keypad, disable_notification, reply_to_message_id, chat_keypad_type);
|
|
24
|
+
return await this.bot.sendMessage(this.chat_id, text, chat_keypad, inline_keypad, disable_notification, reply_to_message_id, chat_keypad_type);
|
|
25
25
|
}
|
|
26
26
|
async forward(to_chat_id, disable_notification = false) {
|
|
27
27
|
const message_id = this.new_message?.message_id || this.updated_message?.message_id;
|
|
28
28
|
if (!message_id)
|
|
29
29
|
return;
|
|
30
|
-
await this.bot.forwardMessage(this.chat_id, message_id, to_chat_id, disable_notification);
|
|
30
|
+
return await this.bot.forwardMessage(this.chat_id, message_id, to_chat_id, disable_notification);
|
|
31
31
|
}
|
|
32
32
|
async delete() {
|
|
33
33
|
const message_id = this.new_message?.message_id || this.updated_message?.message_id;
|
|
34
34
|
if (!message_id)
|
|
35
35
|
return;
|
|
36
|
-
await this.bot.deleteMessage(this.chat_id, message_id);
|
|
36
|
+
return await this.bot.deleteMessage(this.chat_id, message_id);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
exports.default = Message;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import Bot from '../../bot';
|
|
2
|
+
import { ChatKeypadTypeEnum, FileTypeEnum, InlineKeypad, Keypad } from '../../types/models';
|
|
3
|
+
declare function _sendFile(this: Bot, chat_id: string, path_file: string, text?: string, type?: FileTypeEnum, chat_keypad?: Keypad, inline_keypad?: InlineKeypad, disable_notification?: boolean, reply_to_message_id?: string, chat_keypad_type?: ChatKeypadTypeEnum): Promise<any>;
|
|
4
|
+
export default _sendFile;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
|
+
const models_1 = require("../../types/models");
|
|
8
|
+
async function _sendFile(chat_id, path_file, text, type = models_1.FileTypeEnum.File, chat_keypad, inline_keypad, disable_notification = false, reply_to_message_id, chat_keypad_type) {
|
|
9
|
+
if (!fs_1.default.existsSync(path_file)) {
|
|
10
|
+
throw new Error('');
|
|
11
|
+
}
|
|
12
|
+
const { upload_url } = await this.requestSendFile(type);
|
|
13
|
+
const { data: { file_id }, } = await this.uploadFile(upload_url, path_file);
|
|
14
|
+
const data = {
|
|
15
|
+
chat_id,
|
|
16
|
+
file_id,
|
|
17
|
+
disable_notification,
|
|
18
|
+
};
|
|
19
|
+
if (text)
|
|
20
|
+
data.text = text;
|
|
21
|
+
if (chat_keypad)
|
|
22
|
+
data.chat_keypad = chat_keypad;
|
|
23
|
+
if (inline_keypad)
|
|
24
|
+
data.inline_keypad = inline_keypad;
|
|
25
|
+
if (chat_keypad_type)
|
|
26
|
+
data.chat_keypad_type = chat_keypad_type;
|
|
27
|
+
if (reply_to_message_id)
|
|
28
|
+
data.reply_to_message_id = reply_to_message_id;
|
|
29
|
+
if (chat_keypad && !chat_keypad_type) {
|
|
30
|
+
data.chat_keypad_type = models_1.ChatKeypadTypeEnum.New;
|
|
31
|
+
}
|
|
32
|
+
if (inline_keypad && chat_keypad_type) {
|
|
33
|
+
data.chat_keypad_type = models_1.ChatKeypadTypeEnum.None;
|
|
34
|
+
}
|
|
35
|
+
return await this.builder('sendFile', data);
|
|
36
|
+
}
|
|
37
|
+
exports.default = _sendFile;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import getFile from './getFile';
|
|
2
2
|
import requestSendFile from './requestSendFile';
|
|
3
|
+
import _sendFile from './_sendFile';
|
|
3
4
|
import uploadFile from './uploadFile';
|
|
4
|
-
export { getFile, requestSendFile, uploadFile };
|
|
5
|
+
export { getFile, requestSendFile, uploadFile, _sendFile };
|
|
@@ -3,10 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.uploadFile = exports.requestSendFile = exports.getFile = void 0;
|
|
6
|
+
exports._sendFile = exports.uploadFile = exports.requestSendFile = exports.getFile = void 0;
|
|
7
7
|
const getFile_1 = __importDefault(require("./getFile"));
|
|
8
8
|
exports.getFile = getFile_1.default;
|
|
9
9
|
const requestSendFile_1 = __importDefault(require("./requestSendFile"));
|
|
10
10
|
exports.requestSendFile = requestSendFile_1.default;
|
|
11
|
+
const _sendFile_1 = __importDefault(require("./_sendFile"));
|
|
12
|
+
exports._sendFile = _sendFile_1.default;
|
|
11
13
|
const uploadFile_1 = __importDefault(require("./uploadFile"));
|
|
12
14
|
exports.uploadFile = uploadFile_1.default;
|
|
@@ -6,27 +6,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const fs_1 = __importDefault(require("fs"));
|
|
7
7
|
const undici_1 = require("undici");
|
|
8
8
|
const form_data_1 = __importDefault(require("form-data"));
|
|
9
|
-
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
async function uploadFile(url, filePath) {
|
|
10
11
|
if (!fs_1.default.existsSync(filePath)) {
|
|
11
12
|
console.error('[ uploadFile ] File not found at:', filePath);
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
15
|
+
const stream = fs_1.default.createReadStream(filePath);
|
|
14
16
|
const form = new form_data_1.default();
|
|
15
|
-
form.append('file',
|
|
16
|
-
|
|
17
|
-
filename: fileName,
|
|
18
|
-
});
|
|
19
|
-
const res = await (0, undici_1.fetch)(url, {
|
|
17
|
+
form.append('file', stream, { filename: (0, path_1.basename)(filePath) });
|
|
18
|
+
const res = await (0, undici_1.request)(url, {
|
|
20
19
|
method: 'POST',
|
|
21
20
|
body: form,
|
|
22
21
|
headers: form.getHeaders(),
|
|
23
|
-
dispatcher: this.network.agent,
|
|
24
22
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
const response = await res.body.json();
|
|
24
|
+
if (res.statusCode !== 200 || response.status !== 'OK') {
|
|
25
|
+
const text = await res.body.text();
|
|
26
|
+
throw new Error(`HTTP ${res.statusCode}: ${text}`);
|
|
28
27
|
}
|
|
29
|
-
|
|
30
|
-
return data.data.file_id;
|
|
28
|
+
return response;
|
|
31
29
|
}
|
|
32
30
|
exports.default = uploadFile;
|
|
@@ -6,25 +6,32 @@ import * as Files from './files';
|
|
|
6
6
|
import * as Messages from './messages';
|
|
7
7
|
import * as Chat from './chat';
|
|
8
8
|
import * as Settings from './settings';
|
|
9
|
-
import
|
|
9
|
+
import * as Types from '../types/models';
|
|
10
10
|
export default class Methods {
|
|
11
11
|
builder(this: Bot, ...args: Parameters<typeof Advanced.builder>): Promise<any>;
|
|
12
|
-
getMe(this: Bot, ...args: Parameters<typeof BotMethods.getMe>): Promise<
|
|
12
|
+
getMe(this: Bot, ...args: Parameters<typeof BotMethods.getMe>): Promise<Types.Bot>;
|
|
13
13
|
getFile(this: Bot, ...args: Parameters<typeof Files.getFile>): Promise<any>;
|
|
14
14
|
requestSendFile(this: Bot, ...args: Parameters<typeof Files.requestSendFile>): Promise<{
|
|
15
15
|
upload_url: string;
|
|
16
16
|
}>;
|
|
17
|
-
uploadFile(this: Bot, ...args: Parameters<typeof Files.uploadFile>): Promise<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
uploadFile(this: Bot, ...args: Parameters<typeof Files.uploadFile>): Promise<Types.UploadFile>;
|
|
18
|
+
_sendFile(this: Bot, ...args: Parameters<typeof Files._sendFile>): Promise<Types.SendMessage>;
|
|
19
|
+
sendMessage(this: Bot, ...args: Parameters<typeof Messages.sendMessage>): Promise<Types.SendMessage>;
|
|
20
|
+
sendMusic(this: Bot, ...args: Parameters<typeof Messages.sendMusic>): Promise<Types.SendMessage>;
|
|
21
|
+
sendFile(this: Bot, ...args: Parameters<typeof Messages.sendFile>): Promise<Types.SendMessage>;
|
|
22
|
+
sendGif(this: Bot, ...args: Parameters<typeof Messages.sendGif>): Promise<Types.SendMessage>;
|
|
23
|
+
sendImage(this: Bot, ...args: Parameters<typeof Messages.sendImage>): Promise<Types.SendMessage>;
|
|
24
|
+
sendVideo(this: Bot, ...args: Parameters<typeof Messages.sendVideo>): Promise<Types.SendMessage>;
|
|
25
|
+
sendVoice(this: Bot, ...args: Parameters<typeof Messages.sendVoice>): Promise<Types.SendMessage>;
|
|
26
|
+
sendPoll(this: Bot, ...args: Parameters<typeof Messages.sendPoll>): Promise<Types.SendMessage>;
|
|
27
|
+
sendLocation(this: Bot, ...args: Parameters<typeof Messages.sendLocation>): Promise<Types.SendMessage>;
|
|
28
|
+
sendContact(this: Bot, ...args: Parameters<typeof Messages.sendContact>): Promise<Types.SendMessage>;
|
|
29
|
+
forwardMessage(this: Bot, ...args: Parameters<typeof Messages.forwardMessage>): Promise<Types.SendMessage>;
|
|
30
|
+
editMessageText(this: Bot, ...args: Parameters<typeof Messages.editMessageText>): Promise<Types.SendMessage>;
|
|
31
|
+
deleteMessage(this: Bot, ...args: Parameters<typeof Messages.deleteMessage>): Promise<Types.SendMessage>;
|
|
32
|
+
editMessageKeypad(this: Bot, ...args: Parameters<typeof Messages.editMessageKeypad>): Promise<Types.SendMessage>;
|
|
33
|
+
editChatKeypad(this: Bot, ...args: Parameters<typeof Messages.editChatKeypad>): Promise<Types.SendMessage>;
|
|
34
|
+
getChat(this: Bot, ...args: Parameters<typeof Chat.getChat>): Promise<Types.Chat>;
|
|
28
35
|
start(this: Bot, ...args: Parameters<typeof Utilities.start>): Promise<any>;
|
|
29
36
|
run(this: Bot, ...args: Parameters<typeof Utilities.run>): Promise<any>;
|
|
30
37
|
getUpdates(this: Bot, ...args: Parameters<typeof Utilities.getUpdates>): Promise<any>;
|
|
@@ -60,10 +60,31 @@ class Methods {
|
|
|
60
60
|
async uploadFile(...args) {
|
|
61
61
|
return Files.uploadFile.apply(this, args);
|
|
62
62
|
}
|
|
63
|
+
async _sendFile(...args) {
|
|
64
|
+
return Files._sendFile.apply(this, args);
|
|
65
|
+
}
|
|
63
66
|
// messages
|
|
64
67
|
async sendMessage(...args) {
|
|
65
68
|
return Messages.sendMessage.apply(this, args);
|
|
66
69
|
}
|
|
70
|
+
async sendMusic(...args) {
|
|
71
|
+
return Messages.sendMusic.apply(this, args);
|
|
72
|
+
}
|
|
73
|
+
async sendFile(...args) {
|
|
74
|
+
return Messages.sendFile.apply(this, args);
|
|
75
|
+
}
|
|
76
|
+
async sendGif(...args) {
|
|
77
|
+
return Messages.sendGif.apply(this, args);
|
|
78
|
+
}
|
|
79
|
+
async sendImage(...args) {
|
|
80
|
+
return Messages.sendImage.apply(this, args);
|
|
81
|
+
}
|
|
82
|
+
async sendVideo(...args) {
|
|
83
|
+
return Messages.sendVideo.apply(this, args);
|
|
84
|
+
}
|
|
85
|
+
async sendVoice(...args) {
|
|
86
|
+
return Messages.sendVoice.apply(this, args);
|
|
87
|
+
}
|
|
67
88
|
async sendPoll(...args) {
|
|
68
89
|
return Messages.sendPoll.apply(this, args);
|
|
69
90
|
}
|
|
@@ -4,7 +4,13 @@ import editMessageKeypad from './editMessageKeypad';
|
|
|
4
4
|
import editMessageText from './editMessageText';
|
|
5
5
|
import forwardMessage from './forwardMessage';
|
|
6
6
|
import sendContact from './sendContact';
|
|
7
|
+
import sendFile from './sendFile';
|
|
8
|
+
import sendGif from './sendGif';
|
|
9
|
+
import sendImage from './sendImage';
|
|
7
10
|
import sendLocation from './sendLocation';
|
|
8
11
|
import sendMessage from './sendMessage';
|
|
12
|
+
import sendMusic from './sendMusic';
|
|
9
13
|
import sendPoll from './sendPoll';
|
|
10
|
-
|
|
14
|
+
import sendVideo from './sendVideo';
|
|
15
|
+
import sendVoice from './sendVoice';
|
|
16
|
+
export { sendMessage, sendPoll, sendLocation, sendContact, forwardMessage, editMessageText, deleteMessage, editMessageKeypad, editChatKeypad, sendMusic, sendFile, sendGif, sendImage, sendVideo, sendVoice, };
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.editChatKeypad = exports.editMessageKeypad = exports.deleteMessage = exports.editMessageText = exports.forwardMessage = exports.sendContact = exports.sendLocation = exports.sendPoll = exports.sendMessage = void 0;
|
|
6
|
+
exports.sendVoice = exports.sendVideo = exports.sendImage = exports.sendGif = exports.sendFile = exports.sendMusic = exports.editChatKeypad = exports.editMessageKeypad = exports.deleteMessage = exports.editMessageText = exports.forwardMessage = exports.sendContact = exports.sendLocation = exports.sendPoll = exports.sendMessage = void 0;
|
|
7
7
|
const deleteMessage_1 = __importDefault(require("./deleteMessage"));
|
|
8
8
|
exports.deleteMessage = deleteMessage_1.default;
|
|
9
9
|
const editChatKeypad_1 = __importDefault(require("./editChatKeypad"));
|
|
@@ -16,9 +16,21 @@ const forwardMessage_1 = __importDefault(require("./forwardMessage"));
|
|
|
16
16
|
exports.forwardMessage = forwardMessage_1.default;
|
|
17
17
|
const sendContact_1 = __importDefault(require("./sendContact"));
|
|
18
18
|
exports.sendContact = sendContact_1.default;
|
|
19
|
+
const sendFile_1 = __importDefault(require("./sendFile"));
|
|
20
|
+
exports.sendFile = sendFile_1.default;
|
|
21
|
+
const sendGif_1 = __importDefault(require("./sendGif"));
|
|
22
|
+
exports.sendGif = sendGif_1.default;
|
|
23
|
+
const sendImage_1 = __importDefault(require("./sendImage"));
|
|
24
|
+
exports.sendImage = sendImage_1.default;
|
|
19
25
|
const sendLocation_1 = __importDefault(require("./sendLocation"));
|
|
20
26
|
exports.sendLocation = sendLocation_1.default;
|
|
21
27
|
const sendMessage_1 = __importDefault(require("./sendMessage"));
|
|
22
28
|
exports.sendMessage = sendMessage_1.default;
|
|
29
|
+
const sendMusic_1 = __importDefault(require("./sendMusic"));
|
|
30
|
+
exports.sendMusic = sendMusic_1.default;
|
|
23
31
|
const sendPoll_1 = __importDefault(require("./sendPoll"));
|
|
24
32
|
exports.sendPoll = sendPoll_1.default;
|
|
33
|
+
const sendVideo_1 = __importDefault(require("./sendVideo"));
|
|
34
|
+
exports.sendVideo = sendVideo_1.default;
|
|
35
|
+
const sendVoice_1 = __importDefault(require("./sendVoice"));
|
|
36
|
+
exports.sendVoice = sendVoice_1.default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import Bot from '../../bot';
|
|
2
2
|
import { ChatKeypadTypeEnum, Keypad } from '../../types/models';
|
|
3
|
-
declare function sendContact(this: Bot, chat_id: string, first_name: string, last_name: string, phone_number: string, chat_keypad
|
|
3
|
+
declare function sendContact(this: Bot, chat_id: string, first_name: string, last_name: string, phone_number: string, chat_keypad?: Keypad, inline_keypad?: Keypad, disable_notification?: boolean, reply_to_message_id?: string, chat_keypad_type?: ChatKeypadTypeEnum): Promise<any>;
|
|
4
4
|
export default sendContact;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import Bot from '../../bot';
|
|
2
|
+
import { ChatKeypadTypeEnum, InlineKeypad, Keypad } from '../../types/models';
|
|
3
|
+
declare function sendFile(this: Bot, chat_id: string, path_file: string, text?: string, chat_keypad?: Keypad, inline_keypad?: InlineKeypad, disable_notification?: boolean, reply_to_message_id?: string, chat_keypad_type?: ChatKeypadTypeEnum): Promise<import("../../types/models").SendMessage>;
|
|
4
|
+
export default sendFile;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const models_1 = require("../../types/models");
|
|
4
|
+
async function sendFile(chat_id, path_file, text, chat_keypad, inline_keypad, disable_notification = false, reply_to_message_id, chat_keypad_type) {
|
|
5
|
+
return await this._sendFile(chat_id, path_file, text, models_1.FileTypeEnum.File, chat_keypad, inline_keypad, disable_notification, reply_to_message_id, chat_keypad_type);
|
|
6
|
+
}
|
|
7
|
+
exports.default = sendFile;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import Bot from '../../bot';
|
|
2
|
+
import { ChatKeypadTypeEnum, InlineKeypad, Keypad } from '../../types/models';
|
|
3
|
+
declare function sendGif(this: Bot, chat_id: string, path_file: string, text?: string, chat_keypad?: Keypad, inline_keypad?: InlineKeypad, disable_notification?: boolean, reply_to_message_id?: string, chat_keypad_type?: ChatKeypadTypeEnum): Promise<import("../../types/models").SendMessage>;
|
|
4
|
+
export default sendGif;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const models_1 = require("../../types/models");
|
|
4
|
+
async function sendGif(chat_id, path_file, text, chat_keypad, inline_keypad, disable_notification = false, reply_to_message_id, chat_keypad_type) {
|
|
5
|
+
return await this._sendFile(chat_id, path_file, text, models_1.FileTypeEnum.Gif, chat_keypad, inline_keypad, disable_notification, reply_to_message_id, chat_keypad_type);
|
|
6
|
+
}
|
|
7
|
+
exports.default = sendGif;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import Bot from '../../bot';
|
|
2
|
+
import { ChatKeypadTypeEnum, InlineKeypad, Keypad } from '../../types/models';
|
|
3
|
+
declare function sendImage(this: Bot, chat_id: string, path_file: string, text?: string, chat_keypad?: Keypad, inline_keypad?: InlineKeypad, disable_notification?: boolean, reply_to_message_id?: string, chat_keypad_type?: ChatKeypadTypeEnum): Promise<import("../../types/models").SendMessage>;
|
|
4
|
+
export default sendImage;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const models_1 = require("../../types/models");
|
|
4
|
+
async function sendImage(chat_id, path_file, text, chat_keypad, inline_keypad, disable_notification = false, reply_to_message_id, chat_keypad_type) {
|
|
5
|
+
return await this._sendFile(chat_id, path_file, text, models_1.FileTypeEnum.Image, chat_keypad, inline_keypad, disable_notification, reply_to_message_id, chat_keypad_type);
|
|
6
|
+
}
|
|
7
|
+
exports.default = sendImage;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import Bot from '../../bot';
|
|
2
2
|
import { ChatKeypadTypeEnum, Keypad } from '../../types/models';
|
|
3
|
-
declare function sendLocation(this: Bot, chat_id: string, latitude: string, longitude: string, chat_keypad
|
|
3
|
+
declare function sendLocation(this: Bot, chat_id: string, latitude: string, longitude: string, chat_keypad?: Keypad, inline_keypad?: Keypad, disable_notification?: boolean, reply_to_message_id?: string, chat_keypad_type?: ChatKeypadTypeEnum): Promise<any>;
|
|
4
4
|
export default sendLocation;
|
|
@@ -4,13 +4,18 @@ const models_1 = require("../../types/models");
|
|
|
4
4
|
async function sendMessage(chat_id, text, chat_keypad, inline_keypad, disable_notification = false, reply_to_message_id, chat_keypad_type) {
|
|
5
5
|
const data = {
|
|
6
6
|
chat_id,
|
|
7
|
-
text,
|
|
8
|
-
chat_keypad,
|
|
9
|
-
inline_keypad,
|
|
10
7
|
disable_notification,
|
|
11
|
-
reply_to_message_id,
|
|
12
|
-
chat_keypad_type,
|
|
13
8
|
};
|
|
9
|
+
if (text)
|
|
10
|
+
data.text = text;
|
|
11
|
+
if (chat_keypad)
|
|
12
|
+
data.chat_keypad = chat_keypad;
|
|
13
|
+
if (inline_keypad)
|
|
14
|
+
data.inline_keypad = inline_keypad;
|
|
15
|
+
if (chat_keypad_type)
|
|
16
|
+
data.chat_keypad_type = chat_keypad_type;
|
|
17
|
+
if (reply_to_message_id)
|
|
18
|
+
data.reply_to_message_id = reply_to_message_id;
|
|
14
19
|
if (chat_keypad && !chat_keypad_type) {
|
|
15
20
|
data.chat_keypad_type = models_1.ChatKeypadTypeEnum.New;
|
|
16
21
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import Bot from '../../bot';
|
|
2
|
+
import { ChatKeypadTypeEnum, InlineKeypad, Keypad } from '../../types/models';
|
|
3
|
+
declare function sendMusic(this: Bot, chat_id: string, path_file: string, text?: string, chat_keypad?: Keypad, inline_keypad?: InlineKeypad, disable_notification?: boolean, reply_to_message_id?: string, chat_keypad_type?: ChatKeypadTypeEnum): Promise<import("../../types/models").SendMessage>;
|
|
4
|
+
export default sendMusic;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const models_1 = require("../../types/models");
|
|
4
|
+
async function sendMusic(chat_id, path_file, text, chat_keypad, inline_keypad, disable_notification = false, reply_to_message_id, chat_keypad_type) {
|
|
5
|
+
return await this._sendFile(chat_id, path_file, text, models_1.FileTypeEnum.Music, chat_keypad, inline_keypad, disable_notification, reply_to_message_id, chat_keypad_type);
|
|
6
|
+
}
|
|
7
|
+
exports.default = sendMusic;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import Bot from '../../bot';
|
|
2
|
+
import { ChatKeypadTypeEnum, InlineKeypad, Keypad } from '../../types/models';
|
|
3
|
+
declare function sendVideo(this: Bot, chat_id: string, path_file: string, text?: string, chat_keypad?: Keypad, inline_keypad?: InlineKeypad, disable_notification?: boolean, reply_to_message_id?: string, chat_keypad_type?: ChatKeypadTypeEnum): Promise<import("../../types/models").SendMessage>;
|
|
4
|
+
export default sendVideo;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const models_1 = require("../../types/models");
|
|
4
|
+
async function sendVideo(chat_id, path_file, text, chat_keypad, inline_keypad, disable_notification = false, reply_to_message_id, chat_keypad_type) {
|
|
5
|
+
return await this._sendFile(chat_id, path_file, text, models_1.FileTypeEnum.Video, chat_keypad, inline_keypad, disable_notification, reply_to_message_id, chat_keypad_type);
|
|
6
|
+
}
|
|
7
|
+
exports.default = sendVideo;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import Bot from '../../bot';
|
|
2
|
+
import { ChatKeypadTypeEnum, InlineKeypad, Keypad } from '../../types/models';
|
|
3
|
+
declare function sendVoice(this: Bot, chat_id: string, path_file: string, text?: string, chat_keypad?: Keypad, inline_keypad?: InlineKeypad, disable_notification?: boolean, reply_to_message_id?: string, chat_keypad_type?: ChatKeypadTypeEnum): Promise<import("../../types/models").SendMessage>;
|
|
4
|
+
export default sendVoice;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const models_1 = require("../../types/models");
|
|
4
|
+
async function sendVoice(chat_id, path_file, text, chat_keypad, inline_keypad, disable_notification = false, reply_to_message_id, chat_keypad_type) {
|
|
5
|
+
return await this._sendFile(chat_id, path_file, text, models_1.FileTypeEnum.Voice, chat_keypad, inline_keypad, disable_notification, reply_to_message_id, chat_keypad_type);
|
|
6
|
+
}
|
|
7
|
+
exports.default = sendVoice;
|
|
@@ -297,6 +297,13 @@ export interface InlineMessage {
|
|
|
297
297
|
export interface SendMessage {
|
|
298
298
|
message_id: string;
|
|
299
299
|
}
|
|
300
|
+
export interface UploadFile {
|
|
301
|
+
status: string;
|
|
302
|
+
status_det: string;
|
|
303
|
+
data: {
|
|
304
|
+
file_id: string;
|
|
305
|
+
};
|
|
306
|
+
}
|
|
300
307
|
export interface Commend {
|
|
301
308
|
command: string;
|
|
302
309
|
description: string;
|