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

telegraf

Package Overview
Dependencies
Maintainers
3
Versions
241
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

telegraf - npm Package Compare versions

Comparing version 4.13.1 to 4.14.0

12

lib/core/helpers/compact.js

@@ -8,7 +8,11 @@ "use strict";

}
const keys = Object.keys(options);
const compactKeys = keys.filter((key) => options[key] !== undefined);
const compactEntries = compactKeys.map((key) => [key, options[key]]);
return Object.fromEntries(compactEntries);
const compacted = {};
for (const key in options)
if (
// todo(mkr): replace with Object.hasOwn in v5 (Node 16+)
Object.prototype.hasOwnProperty.call(options, key) &&
options[key] !== undefined)
compacted[key] = options[key];
return compacted;
}
exports.compactOptions = compactOptions;

@@ -53,2 +53,8 @@ "use strict";

}
persistent(value = true) {
return new Markup({
...this.reply_markup,
is_persistent: value,
});
}
}

@@ -55,0 +61,0 @@ exports.Markup = Markup;

@@ -120,9 +120,8 @@ "use strict";

exports.session = session;
async function defaultGetSessionKey(ctx) {
function defaultGetSessionKey(ctx) {
var _a, _b;
const fromId = (_a = ctx.from) === null || _a === void 0 ? void 0 : _a.id;
const chatId = (_b = ctx.chat) === null || _b === void 0 ? void 0 : _b.id;
if (fromId == null || chatId == null) {
if (fromId == null || chatId == null)
return undefined;
}
return `${fromId}:${chatId}`;

@@ -129,0 +128,0 @@ }

{
"name": "telegraf",
"version": "4.13.1",
"version": "4.14.0",
"description": "Modern Telegram Bot Framework",
"license": "MIT",
"author": "Vitaly Domnikov <oss@vitaly.codes>",
"author": "The Telegraf Contributors",
"homepage": "https://telegraf.js.org",

@@ -83,3 +83,3 @@ "repository": {

"dependencies": {
"@telegraf/types": "^6.8.1",
"@telegraf/types": "^6.9.0",
"abort-controller": "^3.0.0",

@@ -86,0 +86,0 @@ "debug": "^4.3.4",

@@ -10,3 +10,3 @@ <header>

<a href="https://core.telegram.org/bots/api">
<img src="https://img.shields.io/badge/Bot%20API-v6.8-f36caf.svg?style=flat-square" alt="Bot API Version" />
<img src="https://img.shields.io/badge/Bot%20API-v6.9-f36caf.svg?style=flat-square" alt="Bot API Version" />
</a>

@@ -41,3 +41,3 @@ <a href="https://packagephobia.com/result?p=telegraf,node-telegram-bot-api">

- Full [Telegram Bot API 6.8](https://core.telegram.org/bots/api) support
- Full [Telegram Bot API 6.9](https://core.telegram.org/bots/api) support
- [Excellent TypeScript typings](https://github.com/telegraf/telegraf/releases/tag/v4.0.0)

@@ -44,0 +44,0 @@ - [Lightweight](https://packagephobia.com/result?p=telegraf,node-telegram-bot-api)

@@ -8,6 +8,12 @@ export function compactOptions<T extends { [key: string]: unknown }>(

const keys = Object.keys(options) as Array<keyof T>
const compactKeys = keys.filter((key) => options[key] !== undefined)
const compactEntries = compactKeys.map((key) => [key, options[key]])
return Object.fromEntries(compactEntries)
const compacted: Partial<T> = {}
for (const key in options)
if (
// todo(mkr): replace with Object.hasOwn in v5 (Node 16+)
Object.prototype.hasOwnProperty.call(options, key) &&
options[key] !== undefined
)
compacted[key] = options[key]
return compacted as T | undefined
}

@@ -54,2 +54,9 @@ import {

}
persistent(this: Markup<ReplyKeyboardMarkup>, value = true) {
return new Markup<ReplyKeyboardMarkup>({
...this.reply_markup,
is_persistent: value,
})
}
}

@@ -56,0 +63,0 @@

@@ -153,8 +153,6 @@ import { Context } from './context'

async function defaultGetSessionKey(ctx: Context): Promise<string | undefined> {
function defaultGetSessionKey(ctx: Context): string | undefined {
const fromId = ctx.from?.id
const chatId = ctx.chat?.id
if (fromId == null || chatId == null) {
return undefined
}
if (fromId == null || chatId == null) return undefined
return `${fromId}:${chatId}`

@@ -161,0 +159,0 @@ }

@@ -14,2 +14,3 @@ import { ForceReply, InlineKeyboardButton, InlineKeyboardMarkup, KeyboardButton, ReplyKeyboardMarkup, ReplyKeyboardRemove } from './core/types/typegram';

oneTime(this: Markup<ReplyKeyboardMarkup>, value?: boolean): Markup<ReplyKeyboardMarkup>;
persistent(this: Markup<ReplyKeyboardMarkup>, value?: boolean): Markup<ReplyKeyboardMarkup>;
}

@@ -16,0 +17,0 @@ export * as button from './button';

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