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

puregram

Package Overview
Dependencies
Maintainers
1
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

puregram - npm Package Compare versions

Comparing version 2.0.7 to 2.0.8-rc.1

2

lib/api-methods.js

@@ -7,3 +7,3 @@ "use strict";

/// Based on Bot API v5.2.0, 26.04.2021
/// Generation date: 11.05.2021 22:39:32 MSK
/// Generation date: 12.05.2021 14:43:32 MSK
Object.defineProperty(exports, "__esModule", { value: true });
import { Context } from './context';
import { Telegram } from '../telegram';
import { Message } from '../updates/';
import { AttachmentType as AttachmentTypeEnum, EntityType as EntityTypeEnum } from '../enums';
import { AttachmentType as AttachmentTypeEnum, EntityType } from '../enums';
import { TelegramInputMedia, TelegramInlineKeyboardMarkup, TelegramMessage, TelegramChat, InputFile, TelegramUpdate } from '../telegram-interfaces';

@@ -45,7 +45,7 @@ import { AttachmentType, MessageEventName, Optional, UpdateName } from '../types';

/** Checks if there are any entities (with specified type) */
hasEntities(type?: EntityTypeEnum | MessageEntity['type']): boolean;
hasEntities(type?: EntityType | MessageEntity['type']): boolean;
/** Checks if the message has `caption` property */
get hasCaption(): boolean;
/** Checks if there are any caption entities (with specified type) */
hasCaptionEntities(type?: EntityTypeEnum | MessageEntity['type']): boolean;
hasCaptionEntities(type?: EntityType | MessageEntity['type']): boolean;
/** Message attachments */

@@ -52,0 +52,0 @@ get attachments(): Attachment[];

@@ -8,3 +8,3 @@ import { MessageContext } from './message';

import { Context } from './context';
interface DeleteChatPhotoContextOptions {
interface VoiceChatParticipantsInvitedContextOptions {
telegram: Telegram;

@@ -17,3 +17,3 @@ update: TelegramUpdate;

payload: TelegramMessage;
constructor(options: DeleteChatPhotoContextOptions);
constructor(options: VoiceChatParticipantsInvitedContextOptions);
/** Unique message identifier inside this chat */

@@ -20,0 +20,0 @@ get id(): number;

@@ -8,3 +8,3 @@ import { BotCommand, Chat, Poll, User, VoiceChatScheduled } from '../common/structures';

import { MessageContext } from './message';
interface DeleteChatPhotoContextOptions {
interface VoiceChatScheduledContextOptions {
telegram: Telegram;

@@ -17,3 +17,3 @@ update: TelegramUpdate;

payload: TelegramMessage;
constructor(options: DeleteChatPhotoContextOptions);
constructor(options: VoiceChatScheduledContextOptions);
/** Unique message identifier inside this chat */

@@ -20,0 +20,0 @@ get id(): number;

@@ -8,3 +8,3 @@ import { MessageContext } from './message';

import { Context } from './context';
interface DeleteChatPhotoContextOptions {
interface VoiceChatStartedContextOptions {
telegram: Telegram;

@@ -17,3 +17,3 @@ update: TelegramUpdate;

payload: TelegramMessage;
constructor(options: DeleteChatPhotoContextOptions);
constructor(options: VoiceChatStartedContextOptions);
/** Unique message identifier inside this chat */

@@ -20,0 +20,0 @@ get id(): number;

@@ -7,3 +7,3 @@ "use strict";

/// Based on Bot API v5.2.0, 26.04.2021
/// Generation date: 11.05.2021 22:39:32 MSK
/// Generation date: 12.05.2021 14:43:32 MSK
Object.defineProperty(exports, "__esModule", { value: true });

@@ -7,3 +7,3 @@ "use strict";

/// Based on Bot API v5.2.0, 26.04.2021
/// Generation date: 11.05.2021 22:39:32 MSK
/// Generation date: 12.05.2021 14:43:32 MSK
Object.defineProperty(exports, "__esModule", { value: true });

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

debug(e);
/// TODO: request is invalid, what to do?
}

@@ -183,2 +184,5 @@ debug(`[${method}] <- HTTP ${(_a = response === null || response === void 0 ? void 0 : response.status) !== null && _a !== void 0 ? _a : '[not set]'}`);

const key = keys[0];
if (values.length === 0 || values === undefined) {
throw new Error('Expected `uploadMedia` to contain at least one value');
}
if (method === 'sendMediaGroup' || method === 'editMessageMedia') {

@@ -213,8 +217,10 @@ let mediaValue = keys.map((key, index) => {

for (let [dataKey, dataValue] of Object.entries(contextData)) {
if (Array.isArray(dataValue))
dataValue = dataValue.join(','); // [1, 2, 3] -> '1,2,3'
if (typeof dataValue === 'boolean')
dataValue = String(dataValue);
if (dataValue.toJSON)
dataValue = JSON.stringify(dataValue.toJSON());
dataValue = String(dataValue); // true -> 'true'
if ('toJSON' in dataValue)
dataValue = JSON.stringify(dataValue.toJSON()); // SomeClass { test: true } -> '{"test":true}'
if (helpers_1.isPlainObject(dataValue))
dataValue = JSON.stringify(dataValue);
dataValue = JSON.stringify(dataValue); // { foo: 'bar' } -> '{"foo":"bar"}'
form.append(dataKey, dataValue);

@@ -221,0 +227,0 @@ }

@@ -10,7 +10,20 @@ import { TelegramUpdate } from './telegram-interfaces';

export declare type ApiMethod = keyof ApiMethods;
export declare type KnownKeys<T> = {
[K in keyof T]: string extends K ? never : number extends K ? never : T[K];
} extends {
[_ in keyof T]: infer U;
} ? U : never;
export declare type Optional<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>> & Partial<Pick<T, K>>;
/** Removes `[key: string]: any;` from interface */
export declare type Known<T> = {
[K in keyof T as (string extends K ? never : number extends K ? never : K)]: T[K];
};
/** Might be used to reveal actual object's type */
export declare type Id<T> = T extends infer O ? {
[K in keyof O]: O[K];
} : never;
export declare type Optional<T, K extends keyof Known<T>> =
/** We pick every field but `K` and leave them as is */
Pick<Known<T>, Exclude<keyof Known<T>, K>>
/** Then, we take our `K` fields and mark them as optional */
& {
[P in K]?: Known<T>[P];
}
/** Lastly, we add `[key: string]: any;` */
& {
[key: string]: any;
};
{
"name": "puregram",
"version": "2.0.7",
"version": "2.0.8-rc.1",
"description": "Powerful Node.js package written on TypeScript that allows you to work with Telegram API",

@@ -41,3 +41,4 @@ "main": "lib/index",

"ts-jest": "^26.1.4",
"ts-node": "github:TypeStrong/ts-node#master"
"ts-node": "github:TypeStrong/ts-node#master",
"typescript": "^4.3.2"
},

@@ -44,0 +45,0 @@ "directories": {

Sorry, the diff of this file is too big to display

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