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.1.2 to 0.2.0

18

dist/telegram/types/common.d.ts
import { Message, InlineQuery, User, Location } from '.';
export declare type AllowedUpdate = (Exclude<keyof Update, 'update_id'>);
export interface WebhookInfo {
export declare type AllowedUpdate = Exclude<keyof Update, 'update_id'>;
export declare type WebhookInfo = {
url: string;

@@ -11,4 +11,4 @@ has_custom_certificate: boolean;

allowed_updates?: AllowedUpdate[];
}
export interface Update {
};
export declare type Update = {
update_id: number;

@@ -22,4 +22,4 @@ message?: Message;

callback_query?: CallbackQuery;
}
export interface ChosenInlineResult {
};
export declare type ChosenInlineResult = {
result_id: string;

@@ -30,4 +30,4 @@ from: User;

query: string;
}
export interface CallbackQuery {
};
export declare type CallbackQuery = {
id: string;

@@ -40,2 +40,2 @@ from: User;

game_short_name?: string;
}
};

@@ -1,2 +0,1 @@

export * from './api';
export * from './common';

@@ -3,0 +2,0 @@ export * from './inline-query';

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

Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./api"), exports);
__exportStar(require("./common"), exports);

@@ -16,0 +15,0 @@ __exportStar(require("./inline-query"), exports);

@@ -1,11 +0,8 @@

import { QuizType } from "./media";
export interface Markup {
}
export interface KeyboardButton {
text: string;
}
import { QuizType } from './media';
export declare type Markup = ReplyKeyboard | KeyboardRemoveMarkup | InlineKeyboard | ForceReplyMarkup;
export declare type KeyboardButton = ReplyKeyboardButton | InlineKeyboardButton;
/**
* Reply keyboard
*/
export interface ReplyKeyboard extends Markup {
export declare type ReplyKeyboard = {
keyboard: ReplyKeyboardButton[][];

@@ -15,12 +12,13 @@ resize_keyboard?: boolean;

selective?: boolean;
}
export interface ReplyKeyboardButton extends KeyboardButton {
};
export declare type ReplyKeyboardButton = {
text: string;
request_contact?: boolean;
request_location?: boolean;
request_poll?: KeyboardButtonPollType;
}
export interface KeyboardRemoveMarkup extends Markup {
};
export declare type KeyboardRemoveMarkup = {
remove_keyboard: boolean;
selective?: boolean;
}
};
export declare type KeyboardButtonPollType = {

@@ -32,6 +30,7 @@ type?: QuizType;

*/
export interface InlineKeyboard extends Markup {
export declare type InlineKeyboard = {
inline_keyboard: InlineKeyboardButton[][];
}
export interface InlineKeyboardButton extends KeyboardButton {
};
export declare type InlineKeyboardButton = {
text: string;
url?: string;

@@ -43,4 +42,4 @@ login_url?: LoginUrl;

callback_game?: CallbackGame;
}
export interface LoginUrl {
};
export declare type LoginUrl = {
url: string;

@@ -50,7 +49,7 @@ forward_text?: string;

request_write_acces?: boolean;
}
};
export declare type CallbackGame = object;
export interface ForceReplyMarkup extends Markup {
export declare type ForceReplyMarkup = {
force_reply: boolean;
selective?: boolean;
}
};
import { User, Chat, Markup, PhotoSize, Video, Audio, Document, Animation, Voice, Sticker, Location, Venue, Contact, Poll, Game, Dice, ProximityAlertTriggered } from '.';
export interface Message {
export declare type Message = {
message_id: number;

@@ -45,4 +45,4 @@ from: User;

connected_website?: string;
}
export interface MessageEntity {
};
export declare type MessageEntity = {
type: MessageEntityType;

@@ -54,3 +54,3 @@ offset: number;

language?: string;
}
};
export interface MessageEntityWithText extends MessageEntity {

@@ -57,0 +57,0 @@ text: string;

@@ -10,7 +10,7 @@ import { Markup } from '.';

};
export interface SendExtraOptions {
export declare type SendExtraOptions = {
disable_notification?: boolean;
reply_to_message_id?: number;
reply_markup?: Markup;
}
};
export interface SendMessageOptions extends SendExtraOptions {

@@ -20,11 +20,2 @@ parse_mode?: ParseMode;

}
export interface SendMediaOptions extends SendMessageOptions {
caption?: string;
}
export interface SendAudioOptions extends SendMediaOptions {
duration?: number;
performer?: string;
title?: string;
}
export declare type SendDocumentOptions = SendMediaOptions;
export declare type ChatAction = 'typing' | 'upload_photo' | 'record_video' | 'upload_video' | 'record_audio' | 'upload_audio' | 'upload_document' | 'find_location' | 'record_video_note' | 'upload_video_note';

@@ -31,0 +22,0 @@ export declare type BotCommand = {

import { PhotoSize, Message } from '.';
import { Location } from './media';
export interface User {
export declare type User = {
id: number;

@@ -13,4 +13,4 @@ is_bot: boolean;

supports_inline_queries?: boolean;
}
export interface Chat {
};
export declare type Chat = {
id: number;

@@ -33,3 +33,3 @@ type: ChatType;

location?: ChatLocation;
}
};
export declare type ChatType = 'private' | 'group' | 'supergroup' | 'channel';

@@ -36,0 +36,0 @@ export declare type ChatPhoto = {

@@ -1,5 +0,4 @@

import * as markup from './markup';
export * from './markup';
export * from './text-entites';
export * from './reply';
export * from './md-v2';
export { markup };

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.markup = void 0;
const markup = require("./markup");
exports.markup = markup;
__exportStar(require("./markup"), exports);
__exportStar(require("./text-entites"), exports);

@@ -18,0 +16,0 @@ __exportStar(require("./reply"), exports);

@@ -1,31 +0,27 @@

import { Markup } from '../../types';
export declare abstract class KeyboardButton<Props> {
protected text: string;
protected props: Props;
constructor(text: string, props?: Props);
build: () => {
text: string;
} & Props;
import type { IKeyboardBuilder, IKeyboardButton, IKeyboardRow } from '.';
import type { KeyboardButton, Markup } from '../../types';
export declare abstract class AbstractButton<Props extends KeyboardButton> implements IKeyboardButton {
protected readonly props: Props;
constructor(text: string, props?: Omit<Props, 'text'>);
build(): KeyboardButton;
}
export declare class KeyboardRow<Button extends KeyboardButton<Props>, Props> {
protected buttons: Button[];
length: () => number;
addButton: (button: Button) => void;
build: () => ({
text: string;
} & Props)[];
export declare class KeyboardRow<Button extends AbstractButton<KeyboardButton>> implements IKeyboardRow {
protected readonly buttons: Button[];
length(): number;
addButton(button: Button): this;
build(): KeyboardButton[];
}
export declare abstract class MarkupBuilder<Props extends Markup> {
protected props: Props;
constructor(props?: Props);
abstract build(): Props;
export declare abstract class MarkupBuilder<Params extends Markup, SkipParams extends string = never> implements IKeyboardBuilder {
protected readonly props: Omit<Params, SkipParams>;
constructor(props?: Omit<Params, SkipParams>);
abstract build(): Markup;
}
export declare abstract class KeyboardBuilder<Type extends Markup, Button extends KeyboardButton<PropsButton>, PropsButton, ExcludeKey extends string> extends MarkupBuilder<Type> {
protected rows: KeyboardRow<Button, PropsButton>[];
constructor(props?: Omit<Type, ExcludeKey>);
size: () => number;
length: () => number;
addRow: (row?: KeyboardRow<Button, PropsButton>) => KeyboardRow<Button, PropsButton>;
getRow: (index: number) => KeyboardRow<Button, PropsButton>;
removeRow: (index: number) => this;
export declare abstract class KeyboardBuilder<Type extends Markup, Button extends AbstractButton<KeyboardButton>, SkipParams extends string = never> extends MarkupBuilder<Type, SkipParams> {
protected readonly rows: KeyboardRow<Button>[];
constructor(props?: Omit<Type, SkipParams>);
get buttonsCount(): number;
get rowsCount(): number;
addRow(row?: KeyboardRow<Button>): KeyboardRow<Button>;
getRow(index: number): KeyboardRow<Button>;
removeRow(index: number): this;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.KeyboardBuilder = exports.MarkupBuilder = exports.KeyboardRow = exports.KeyboardButton = void 0;
class KeyboardButton {
exports.KeyboardBuilder = exports.MarkupBuilder = exports.KeyboardRow = exports.AbstractButton = void 0;
class AbstractButton {
constructor(text, props = {}) {
this.text = text;
this.build = () => (Object.assign({ text: this.text }, this.props));
this.props = props;
this.props = Object.assign(Object.assign({}, props), { text });
}
build() {
return this.props;
}
}
exports.KeyboardButton = KeyboardButton;
exports.AbstractButton = AbstractButton;
class KeyboardRow {
constructor() {
this.buttons = [];
this.length = () => this.buttons.length;
this.addButton = (button) => {
this.buttons.push(button);
};
this.build = () => this.buttons.map(col => col.build());
}
length() {
return this.buttons.length;
}
addButton(button) {
this.buttons.push(button);
return this;
}
build() {
return this.buttons.map(col => col.build());
}
}

@@ -33,16 +39,22 @@ exports.KeyboardRow = KeyboardRow;

this.rows = [];
this.size = () => this.rows.reduce((acc, row) => acc + row.length(), 0);
this.length = () => this.rows.length;
this.addRow = (row = new KeyboardRow()) => {
this.rows.push(row);
return row;
};
this.getRow = (index) => this.rows[index];
this.removeRow = (index) => {
this.rows.splice(index, 1);
return this;
};
}
get buttonsCount() {
return this.rows.reduce((acc, row) => acc + row.length(), 0);
}
get rowsCount() {
return this.rows.length;
}
addRow(row = new KeyboardRow()) {
this.rows.push(row);
return row;
}
getRow(index) {
return this.rows[index];
}
removeRow(index) {
this.rows.splice(index, 1);
return this;
}
}
exports.KeyboardBuilder = KeyboardBuilder;
//# sourceMappingURL=abstract.js.map
import { MarkupBuilder } from './abstract';
declare type ForceReplyProps = {
selective?: boolean;
};
export declare class Builder extends MarkupBuilder<ForceReplyProps> {
build: () => {
selective?: boolean;
force_reply: boolean;
};
import type { ForceReplyMarkup } from '../../types';
export declare class ForceReplyKeyboardBuilder extends MarkupBuilder<ForceReplyMarkup> {
build(): ForceReplyMarkup;
}
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Builder = void 0;
exports.ForceReplyKeyboardBuilder = void 0;
const abstract_1 = require("./abstract");
// ForceReplyMarkup
class Builder extends abstract_1.MarkupBuilder {
constructor() {
super(...arguments);
this.build = () => (Object.assign({ force_reply: true }, this.props));
class ForceReplyKeyboardBuilder extends abstract_1.MarkupBuilder {
build() {
var _a;
return {
force_reply: (_a = this.props.force_reply) !== null && _a !== void 0 ? _a : true,
selective: this.props.selective,
};
}
}
exports.Builder = Builder;
exports.ForceReplyKeyboardBuilder = ForceReplyKeyboardBuilder;
//# sourceMappingURL=force.js.map

@@ -1,5 +0,15 @@

import * as reply from './reply';
import * as inline from './inline';
import * as force from './force';
import * as remove from './remove';
export { reply, inline, force, remove, };
import type { KeyboardButton, Markup } from '../../types/keyboard';
export * from './reply';
export * from './inline';
export * from './force';
export * from './remove';
export * from './abstract';
export declare type IKeyboardBuilder = {
build(): Markup;
};
export declare type IKeyboardRow = {
build(): KeyboardButton[];
};
export declare type IKeyboardButton = {
build(): KeyboardButton;
};
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.remove = exports.force = exports.inline = exports.reply = void 0;
const reply = require("./reply");
exports.reply = reply;
const inline = require("./inline");
exports.inline = inline;
const force = require("./force");
exports.force = force;
const remove = require("./remove");
exports.remove = remove;
__exportStar(require("./reply"), exports);
__exportStar(require("./inline"), exports);
__exportStar(require("./force"), exports);
__exportStar(require("./remove"), exports);
__exportStar(require("./abstract"), exports);
//# sourceMappingURL=index.js.map

@@ -1,18 +0,8 @@

import { KeyboardButton, KeyboardBuilder } from './abstract';
import { InlineKeyboard, CallbackGame } from '../../types';
declare type InlineKeyboardButtonProps = {
callback_data?: string;
url?: string;
login_url?: string;
switch_inline_query?: string;
callback_game?: CallbackGame;
};
export declare class Builder extends KeyboardBuilder<InlineKeyboard, Button, InlineKeyboardButtonProps, 'inline_keyboard'> {
build: () => {
inline_keyboard: import("../../types").InlineKeyboardButton[][];
};
import { AbstractButton, KeyboardBuilder } from './abstract';
import type { InlineKeyboard, InlineKeyboardButton } from '../../types';
export declare class InlineKeyboardBuilder extends KeyboardBuilder<InlineKeyboard, InlineButton, 'inline_keyboard'> {
build(): InlineKeyboard;
}
export declare class Button extends KeyboardButton<InlineKeyboardButtonProps> {
constructor(text: string, props?: InlineKeyboardButtonProps);
export declare class InlineButton extends AbstractButton<InlineKeyboardButton> {
constructor(text: string, props?: Omit<InlineKeyboardButton, 'text'>);
}
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Button = exports.Builder = void 0;
exports.InlineButton = exports.InlineKeyboardBuilder = void 0;
const abstract_1 = require("./abstract");
class Builder extends abstract_1.KeyboardBuilder {
constructor() {
super(...arguments);
this.build = () => (Object.assign({ inline_keyboard: this.rows.map(row => row.build()) }, this.props));
class InlineKeyboardBuilder extends abstract_1.KeyboardBuilder {
build() {
return Object.assign({ inline_keyboard: this.rows.map(row => row.build()) }, this.props);
}
}
exports.Builder = Builder;
class Button extends abstract_1.KeyboardButton {
exports.InlineKeyboardBuilder = InlineKeyboardBuilder;
class InlineButton extends abstract_1.AbstractButton {
constructor(text, props = {}) {

@@ -22,3 +21,2 @@ super(text, props);

}
// const type = fields[0];
if ('callback_data' in props && props.callback_data.length > 64) {

@@ -29,3 +27,3 @@ throw new Error('callback_data must be least than 64 symbols');

}
exports.Button = Button;
exports.InlineButton = InlineButton;
//# sourceMappingURL=inline.js.map
import { MarkupBuilder } from './abstract';
declare type KeyboardRemoveProps = {
selective?: boolean;
};
export declare class Builder extends MarkupBuilder<KeyboardRemoveProps> {
build: () => {
selective?: boolean;
remove_keyboard: boolean;
};
import type { KeyboardRemoveMarkup } from '../../types';
export declare class RemoveKeyboardBuilder extends MarkupBuilder<KeyboardRemoveMarkup, 'remove_keyboard'> {
build(): KeyboardRemoveMarkup;
}
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Builder = void 0;
exports.RemoveKeyboardBuilder = void 0;
const abstract_1 = require("./abstract");
// KeyboardRemoveMarkup
class Builder extends abstract_1.MarkupBuilder {
constructor() {
super(...arguments);
this.build = () => (Object.assign({ remove_keyboard: true }, this.props));
class RemoveKeyboardBuilder extends abstract_1.MarkupBuilder {
build() {
return Object.assign({ remove_keyboard: true }, this.props);
}
}
exports.Builder = Builder;
exports.RemoveKeyboardBuilder = RemoveKeyboardBuilder;
//# sourceMappingURL=remove.js.map

@@ -1,21 +0,8 @@

import { KeyboardBuilder, KeyboardButton } from './abstract';
import { ReplyKeyboard, QuizType } from '../../types';
declare type ReplyKeyboardButtonProps = {
request_contact?: boolean;
request_location?: boolean;
request_poll?: KeyboardButtonPollType;
};
declare type KeyboardButtonPollType = {
type: QuizType;
};
export declare class Builder extends KeyboardBuilder<ReplyKeyboard, Button, ReplyKeyboardButtonProps, 'keyboard'> {
build: () => {
keyboard: import("../../types").ReplyKeyboardButton[][];
resize_keyboard?: boolean;
one_time_keyboard?: boolean;
selective?: boolean;
};
import { KeyboardBuilder, AbstractButton } from './abstract';
import type { Markup, ReplyKeyboard } from '../../types/keyboard';
import type { ReplyKeyboardButton } from '../../types/keyboard';
export declare class ReplyKeyboardBuilder extends KeyboardBuilder<ReplyKeyboard, ReplyButton, 'keyboard'> {
build(): Markup;
}
export declare class Button extends KeyboardButton<ReplyKeyboardButtonProps> {
export declare class ReplyButton extends AbstractButton<ReplyKeyboardButton> {
}
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Button = exports.Builder = void 0;
exports.ReplyButton = exports.ReplyKeyboardBuilder = void 0;
const abstract_1 = require("./abstract");
class Builder extends abstract_1.KeyboardBuilder {
constructor() {
super(...arguments);
this.build = () => (Object.assign({ keyboard: this.rows.map(row => row.build()) }, this.props));
class ReplyKeyboardBuilder extends abstract_1.KeyboardBuilder {
build() {
return Object.assign({ keyboard: this.rows.map(row => row.build()) }, this.props);
}
}
exports.Builder = Builder;
class Button extends abstract_1.KeyboardButton {
exports.ReplyKeyboardBuilder = ReplyKeyboardBuilder;
class ReplyButton extends abstract_1.AbstractButton {
}
exports.Button = Button;
exports.ReplyButton = ReplyButton;
//# sourceMappingURL=reply.js.map

@@ -5,4 +5,5 @@ "use strict";

const extractEntites = ({ text, caption, entities, caption_entities }) => {
const items = entities || caption_entities || [];
const str = text || caption || '';
var _a, _b;
const items = (_a = entities !== null && entities !== void 0 ? entities : caption_entities) !== null && _a !== void 0 ? _a : [];
const str = (_b = text !== null && text !== void 0 ? text : caption) !== null && _b !== void 0 ? _b : '';
return items.map(entry => (Object.assign(Object.assign({}, entry), { text: str.substr(entry.offset, entry.length) })));

@@ -9,0 +10,0 @@ };

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

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -34,2 +34,3 @@ # Multibot SDK

* ForceReply;
* RemoveKeyboard.

@@ -42,3 +43,3 @@ #### Example:

const row = kb.addRow(); // add row
row.addButton(new Telegram.ReplyKeyboardButton('Click me!'));
row.addButton(new Telegram.ReplyButton('Click me!'));

@@ -45,0 +46,0 @@ bot.request('sendMessage', {

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

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