@apidog/multibot-sdk-ts
Advanced tools
Comparing version 0.5.4 to 0.5.5
@@ -39,3 +39,3 @@ "use strict"; | ||
const timeout = apiMethod === 'getUpdates' ? 30000 : 5000; | ||
const request = yield node_fetch_1.default(url, { | ||
const request = yield (0, node_fetch_1.default)(url, { | ||
method: 'POST', | ||
@@ -61,11 +61,11 @@ body: form, | ||
this.getMe = () => __awaiter(this, void 0, void 0, function* () { return this.request('getMe'); }); | ||
this.sendMessage = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('sendMessage', utils_1.sanitizeMarkdownV2Props(props)); }); | ||
this.copyMessage = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('copyMessage', utils_1.sanitizeMarkdownV2Props(props, 'caption')); }); | ||
this.sendMessage = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('sendMessage', (0, utils_1.sanitizeMarkdownV2Props)(props)); }); | ||
this.copyMessage = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('copyMessage', (0, utils_1.sanitizeMarkdownV2Props)(props, 'caption')); }); | ||
this.forwardMessage = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('forwardMessage', props); }); | ||
this.sendPhoto = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('sendPhoto', utils_1.sanitizeMarkdownV2Props(props, 'caption')); }); | ||
this.sendAudio = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('sendAudio', utils_1.sanitizeMarkdownV2Props(props, 'caption')); }); | ||
this.sendDocument = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('sendDocument', utils_1.sanitizeMarkdownV2Props(props, 'caption')); }); | ||
this.sendVideo = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('sendVideo', utils_1.sanitizeMarkdownV2Props(props, 'caption')); }); | ||
this.sendAnimation = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('sendAnimation', utils_1.sanitizeMarkdownV2Props(props, 'caption')); }); | ||
this.sendVoice = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('sendVoice', utils_1.sanitizeMarkdownV2Props(props, 'caption')); }); | ||
this.sendPhoto = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('sendPhoto', (0, utils_1.sanitizeMarkdownV2Props)(props, 'caption')); }); | ||
this.sendAudio = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('sendAudio', (0, utils_1.sanitizeMarkdownV2Props)(props, 'caption')); }); | ||
this.sendDocument = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('sendDocument', (0, utils_1.sanitizeMarkdownV2Props)(props, 'caption')); }); | ||
this.sendVideo = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('sendVideo', (0, utils_1.sanitizeMarkdownV2Props)(props, 'caption')); }); | ||
this.sendAnimation = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('sendAnimation', (0, utils_1.sanitizeMarkdownV2Props)(props, 'caption')); }); | ||
this.sendVoice = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('sendVoice', (0, utils_1.sanitizeMarkdownV2Props)(props, 'caption')); }); | ||
this.sendVideoNote = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('sendVideoNote', props); }); | ||
@@ -108,3 +108,3 @@ this.sendMediaGroup = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('sendMediaGroup', props); }); | ||
this.editMessageText = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('editMessageText', props); }); | ||
this.editMessageCaption = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('editMessageCaption', utils_1.sanitizeMarkdownV2Props(props, 'caption')); }); | ||
this.editMessageCaption = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('editMessageCaption', (0, utils_1.sanitizeMarkdownV2Props)(props, 'caption')); }); | ||
this.editMessageMedia = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('editMessageMedia', props); }); | ||
@@ -111,0 +111,0 @@ this.editMessageReplyMarkup = (props) => __awaiter(this, void 0, void 0, function* () { return this.request('editMessageReplyMarkup', props); }); |
@@ -58,3 +58,3 @@ "use strict"; | ||
const testCommand = update => { | ||
if (!exports.testMessage(update)) { | ||
if (!(0, exports.testMessage)(update)) { | ||
return false; | ||
@@ -67,3 +67,3 @@ } | ||
const handleCommand = ({ message }) => { | ||
const entities = utils_1.extractEntites(message); | ||
const entities = (0, utils_1.extractEntites)(message); | ||
if (!message.entities.length) { | ||
@@ -92,4 +92,4 @@ return false; | ||
const media = (field) => ({ | ||
test: update => exports.testMessage(update) && field in update.message, | ||
handle: (update, bot) => (Object.assign(Object.assign({}, exports.handleMessage(update)), { getFileUrl: () => bot.request('getFile', { | ||
test: update => (0, exports.testMessage)(update) && field in update.message, | ||
handle: (update, bot) => (Object.assign(Object.assign({}, (0, exports.handleMessage)(update)), { getFileUrl: () => bot.request('getFile', { | ||
file_id: ['photo', 'new_chat_photo'].includes(field) | ||
@@ -101,6 +101,6 @@ ? update.message.photo[0].file_id | ||
const mediaTypes = ['photo', 'video', 'audio', 'document', 'animation', 'voice', 'sticker', 'location', 'venue', 'contact', 'poll', 'game']; | ||
const testMedia = update => mediaTypes.some(key => exports.testMessage(update) && key in update.message); | ||
const testMedia = update => mediaTypes.some(key => (0, exports.testMessage)(update) && key in update.message); | ||
const handleMedia = update => { | ||
const type = mediaTypes.find(type => type in update.message); | ||
return Object.assign(Object.assign({}, exports.handleMessage(update)), { media: { | ||
return Object.assign(Object.assign({}, (0, exports.handleMessage)(update)), { media: { | ||
type, | ||
@@ -107,0 +107,0 @@ object: update.message[type], |
@@ -52,3 +52,3 @@ "use strict"; | ||
const endpoint = this.getApiEndpoint(apiMethod); | ||
const request = yield node_fetch_1.default(endpoint, { | ||
const request = yield (0, node_fetch_1.default)(endpoint, { | ||
method: 'POST', | ||
@@ -91,3 +91,3 @@ body: form, | ||
this.waitForResponseLongPoll = () => __awaiter(this, void 0, void 0, function* () { | ||
const request = yield node_fetch_1.default(this.getLongPollUrl()); | ||
const request = yield (0, node_fetch_1.default)(this.getLongPollUrl()); | ||
return request.json(); | ||
@@ -94,0 +94,0 @@ }); |
@@ -15,3 +15,3 @@ "use strict"; | ||
const utils_1 = require("./utils"); | ||
const fetcherUser = (message, bot) => (fields) => __awaiter(void 0, void 0, void 0, function* () { return utils_1.getSender(bot, message, fields); }); | ||
const fetcherUser = (message, bot) => (fields) => __awaiter(void 0, void 0, void 0, function* () { return (0, utils_1.getSender)(bot, message, fields); }); | ||
const testMessage = update => update.type === 'message_new'; | ||
@@ -44,3 +44,3 @@ exports.testMessage = testMessage; | ||
event: update.object, | ||
getUser: () => utils_1.getUser(bot, update.object.user_id), | ||
getUser: () => (0, utils_1.getUser)(bot, update.object.user_id), | ||
}); | ||
@@ -52,3 +52,3 @@ exports.handleMessageAllow = handleMessageAllow; | ||
event: update.object, | ||
getUser: () => utils_1.getUser(bot, update.object.user_id), | ||
getUser: () => (0, utils_1.getUser)(bot, update.object.user_id), | ||
}); | ||
@@ -55,0 +55,0 @@ exports.handleMessageDeny = handleMessageDeny; |
@@ -21,4 +21,4 @@ "use strict"; | ||
exports.getUser = getUser; | ||
const getSender = (bot, message, fields) => __awaiter(void 0, void 0, void 0, function* () { return exports.getUser(bot, message.from_id, fields); }); | ||
const getSender = (bot, message, fields) => __awaiter(void 0, void 0, void 0, function* () { return (0, exports.getUser)(bot, message.from_id, fields); }); | ||
exports.getSender = getSender; | ||
//# sourceMappingURL=user.js.map |
{ | ||
"name": "@apidog/multibot-sdk-ts", | ||
"version": "0.5.4", | ||
"version": "0.5.5", | ||
"description": "Telegram and VK bot SDK for TypeScript", | ||
@@ -27,19 +27,19 @@ "main": "dist/index.js", | ||
"form-data": "4.0.0", | ||
"node-fetch": "2.6.1" | ||
"node-fetch": "2.6.7" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "26.0.23", | ||
"@types/node": "15.12.5", | ||
"@types/jest": "27.4.0", | ||
"@types/node": "17.0.15", | ||
"@types/node-fetch": "2.5.10", | ||
"@typescript-eslint/eslint-plugin": "4.28.1", | ||
"@typescript-eslint/parser": "4.28.1", | ||
"@typescript-eslint/eslint-plugin": "5.10.2", | ||
"@typescript-eslint/parser": "5.10.2", | ||
"airbnb-style": "2.0.0", | ||
"dotenv": "10.0.0", | ||
"eslint": "7.29.0", | ||
"eslint-config-airbnb": "18.2.1", | ||
"eslint-config-airbnb-typescript": "12.3.1", | ||
"eslint-plugin-import": "2.23.4", | ||
"jest": "27.0.6", | ||
"ts-jest": "27.0.3", | ||
"typescript": "4.3.4" | ||
"dotenv": "16.0.0", | ||
"eslint": "8.8.0", | ||
"eslint-config-airbnb": "19.0.4", | ||
"eslint-config-airbnb-typescript": "16.1.0", | ||
"eslint-plugin-import": "2.25.4", | ||
"jest": "27.5.0", | ||
"ts-jest": "27.1.3", | ||
"typescript": "4.5.5" | ||
}, | ||
@@ -46,0 +46,0 @@ "bugs": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
167486
+ Addednode-fetch@2.6.7(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
- Removednode-fetch@2.6.1(transitive)
Updatednode-fetch@2.6.7