Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@apidog/multibot-sdk-ts

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apidog/multibot-sdk-ts - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

3

dist/abstract-bot.js

@@ -13,3 +13,4 @@ "use strict";

this.emit = (event, arg) => {
this.listeners[event]?.forEach(listener => listener(arg));
var _a;
(_a = this.listeners[event]) === null || _a === void 0 ? void 0 : _a.forEach(listener => listener(arg));
};

@@ -16,0 +17,0 @@ }

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
function __export(m) {

@@ -40,3 +49,3 @@ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];

// eslint-disable-next-line @typescript-eslint/no-explicit-any
this.request = async (apiMethod, params = {}) => {
this.request = (apiMethod, params = {}) => __awaiter(this, void 0, void 0, function* () {
if (apiMethod in this.handleMethodsForFiles) {

@@ -52,6 +61,4 @@ this.handleParamsForFiles(params, this.handleMethodsForFiles[apiMethod]);

const endpoint = this.getApiEndpoint(apiMethod);
const { data, status, statusText } = await axios_1.default.post(endpoint, form, {
headers: {
...(form.getHeaders())
}
const { data, status, statusText } = yield axios_1.default.post(endpoint, form, {
headers: Object.assign({}, (form.getHeaders()))
});

@@ -62,3 +69,3 @@ if (status !== 200) {

return data.result;
};
});
/**

@@ -94,7 +101,7 @@ *

this.isPollingActive = true;
(async () => {
(() => __awaiter(this, void 0, void 0, function* () {
while (this.isPollingActive) {
await this.poll();
yield this.poll();
}
})();
}))();
};

@@ -104,11 +111,13 @@ this.stopPolling = () => {

};
this.poll = async () => new Promise(resolve => {
this.request('getUpdates', {
offset: this.pollingOffset
}).then(response => {
if (response.length) {
this.pollingOffset = response[response.length - 1].update_id + 1;
}
resolve();
response.forEach(this.handleUpdate);
this.poll = () => __awaiter(this, void 0, void 0, function* () {
return new Promise(resolve => {
this.request('getUpdates', {
offset: this.pollingOffset
}).then(response => {
if (response.length) {
this.pollingOffset = response[response.length - 1].update_id + 1;
}
resolve();
response.forEach(this.handleUpdate);
});
});

@@ -119,3 +128,3 @@ });

}
this.config = { ...TelegramBot.defaultConfig, ...config };
this.config = Object.assign(Object.assign({}, TelegramBot.defaultConfig), config);
}

@@ -122,0 +131,0 @@ }

@@ -44,6 +44,3 @@ "use strict";

this.params = params;
this.json = () => ({
keyboard: this.rows.map(row => row.json),
...this.params,
});
this.json = () => (Object.assign({ keyboard: this.rows.map(row => row.json) }, this.params));
}

@@ -56,6 +53,3 @@ }

this.params = params;
this.json = () => ({
text: this.text,
...this.params,
});
this.json = () => (Object.assign({ text: this.text }, this.params));
}

@@ -97,6 +91,3 @@ }

this.params = params;
this.json = () => ({
text: this.text,
...this.params,
});
this.json = () => (Object.assign({ text: this.text }, this.params));
if (!Object.keys(params).length) {

@@ -115,3 +106,3 @@ throw new Error('Text buttons are unallowed in the inline keyboard. Specify one of: callback_data, url, login_url, switch_inline_query, or callback_game');

this.params = params;
this.json = () => ({ force_reply: true, ...this.params });
this.json = () => (Object.assign({ force_reply: true }, this.params));
}

@@ -118,0 +109,0 @@ }

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.reply = async (bot, message, text, options = {}) => bot.request('sendMessage', {
chat_id: message.chat.id,
text,
...options
exports.reply = (bot, message, text, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
return bot.request('sendMessage', Object.assign({ chat_id: message.chat.id, text }, options));
});
//# sourceMappingURL=reply.js.map

@@ -6,7 +6,4 @@ "use strict";

const str = text || caption || '';
return items.map(entry => ({
...entry,
text: str.substr(entry.offset, entry.length),
}));
return items.map(entry => (Object.assign(Object.assign({}, entry), { text: str.substr(entry.offset, entry.length) })));
};
//# sourceMappingURL=text-entites.js.map

@@ -21,19 +21,11 @@ "use strict";

it('bot command', () => {
const entites = _1.extractEntites({
...basicMessage,
text: 's /command q',
entities: [
const entites = _1.extractEntites(Object.assign(Object.assign({}, basicMessage), { text: 's /command q', entities: [
{ offset: 2, length: 8, type: 'bot_command' }
]
});
] }));
expect(entites[0].text).toEqual('/command');
});
it('user mention', () => {
const entites = _1.extractEntites({
...basicMessage,
text: 's (@vladislav805) q',
entities: [
const entites = _1.extractEntites(Object.assign(Object.assign({}, basicMessage), { text: 's (@vladislav805) q', entities: [
{ offset: 3, length: 13, type: 'mention' }
]
});
] }));
expect(entites[0].text).toEqual('@vladislav805');

@@ -40,0 +32,0 @@ });

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.delay = async (ms) => new Promise(resolve => setTimeout(resolve, ms));
exports.delay = (ms) => __awaiter(void 0, void 0, void 0, function* () { return new Promise(resolve => setTimeout(resolve, ms)); });
//# sourceMappingURL=delay.js.map
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -12,3 +21,3 @@ const abstract_bot_1 = require("../abstract-bot");

// eslint-disable-next-line @typescript-eslint/no-explicit-any
this.request = async (apiMethod, params = {}) => {
this.request = (apiMethod, params = {}) => __awaiter(this, void 0, void 0, function* () {
const form = Object.keys(params).reduce((form, key) => {

@@ -23,6 +32,4 @@ if (params[key] !== undefined) {

const endpoint = this.getApiEndpoint(apiMethod);
const { data, status, statusText } = await axios_1.default.post(endpoint, form, {
headers: {
...(form.getHeaders())
}
const { data, status, statusText } = yield axios_1.default.post(endpoint, form, {
headers: Object.assign({}, (form.getHeaders()))
});

@@ -33,3 +40,3 @@ if (status !== 200) {

return data.response;
};
});
/**

@@ -39,6 +46,6 @@ * Polling

this.isPollingActive = false;
this.getLongPollServer = async () => {
this.getLongPollServer = () => __awaiter(this, void 0, void 0, function* () {
return this.request('groups.getLongPollServer', { group_id: this.config.groupId });
};
this.startPolling = async () => {
});
this.startPolling = () => __awaiter(this, void 0, void 0, function* () {
if (this.isPollingActive) {

@@ -48,10 +55,10 @@ return;

this.isPollingActive = true;
this.server = await this.getLongPollServer();
this.server = yield this.getLongPollServer();
console.log('poll', this.server);
(async () => {
(() => __awaiter(this, void 0, void 0, function* () {
while (this.isPollingActive) {
await this.poll();
yield this.poll();
}
})();
};
}))();
});
this.getLongPollUrl = () => {

@@ -61,10 +68,12 @@ const { server, key, ts } = this.server;

};
this.waitForResponseLongPoll = async () => {
return (await axios_1.default.get(this.getLongPollUrl())).data;
};
this.poll = async () => new Promise(resolve => {
this.waitForResponseLongPoll().then(response => {
this.server.ts = response.ts;
resolve();
response.updates.forEach(this.handleUpdate);
this.waitForResponseLongPoll = () => __awaiter(this, void 0, void 0, function* () {
return (yield axios_1.default.get(this.getLongPollUrl())).data;
});
this.poll = () => __awaiter(this, void 0, void 0, function* () {
return new Promise(resolve => {
this.waitForResponseLongPoll().then(response => {
this.server.ts = response.ts;
resolve();
response.updates.forEach(this.handleUpdate);
});
});

@@ -92,3 +101,3 @@ });

}
this.config = { ...VkBot.defaultConfig, ...config };
this.config = Object.assign(Object.assign({}, VkBot.defaultConfig), config);
}

@@ -95,0 +104,0 @@ }

{
"name": "@apidog/multibot-sdk-ts",
"version": "0.0.5",
"version": "0.0.6",
"description": "Telegram and VK bot SDK for TypeScript",

@@ -48,14 +48,3 @@ "main": "dist/index.js",

"access": "public"
},
"babel": {
"presets": [
"@babel/preset-env"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-syntax-typescript",
"@babel/transform-runtime"
]
}
}

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc