Socket
Socket
Sign inDemoInstall

grammy

Package Overview
Dependencies
12
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.21.2 to 1.22.0

2

out/convenience/frameworks.js

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

end: () => reply.status(200).send(),
respond: (json) => reply.send(json),
respond: (json) => reply.headers({ "Content-Type": "application/json" }).send(json),
unauthorized: () => reply.code(401).send(WRONG_TOKEN_ERROR),

@@ -123,0 +123,0 @@ });

@@ -158,5 +158,5 @@ import { type MiddlewareFn } from "../composer.js";

* > persistent storage that is attached to it. As an example, your bot can send
* > a message to a chat and store the ID of that message in the corresponding
* > session. The next time your bot receives an update from that chat, the
* > session will still contain that ID.
* > a message to a chat and store the identifier of that message in the
* > corresponding session. The next time your bot receives an update from that
* > chat, the session will still contain that ID.
* >

@@ -163,0 +163,0 @@ * > Session data can be stored in a database, in a file, or simply in memory.

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

* > persistent storage that is attached to it. As an example, your bot can send
* > a message to a chat and store the ID of that message in the corresponding
* > session. The next time your bot receives an update from that chat, the
* > session will still contain that ID.
* > a message to a chat and store the identifier of that message in the
* > corresponding session. The next time your bot receives an update from that
* > chat, the session will still contain that ID.
* >

@@ -20,0 +20,0 @@ * > Session data can be stored in a database, in a file, or simply in memory.

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

import { type AliasProps, type Context } from "./context.js";
import { type Context } from "./context.js";
import { type Update } from "./types.js";

@@ -73,2 +73,3 @@ type FilterFunction<C extends Context, D extends C> = (ctx: C) => ctx is D;

readonly is_automatic_forward: {};
readonly business_connection_id: {};
readonly text: {};

@@ -189,2 +190,3 @@ readonly animation: {};

readonly is_automatic_forward: {};
readonly business_connection_id: {};
readonly text: {};

@@ -273,2 +275,3 @@ readonly animation: {};

readonly is_automatic_forward: {};
readonly business_connection_id: {};
readonly text: {};

@@ -357,2 +360,3 @@ readonly animation: {};

readonly is_automatic_forward: {};
readonly business_connection_id: {};
readonly text: {};

@@ -431,2 +435,239 @@ readonly animation: {};

};
readonly business_connection: {
readonly can_reply: {};
readonly is_enabled: {};
};
readonly business_message: {
readonly sender_boost_count: {};
readonly new_chat_members: {
readonly me: {};
readonly is_bot: {};
readonly is_premium: {};
readonly added_to_attachment_menu: {};
};
readonly left_chat_member: {
readonly me: {};
readonly is_bot: {};
readonly is_premium: {};
readonly added_to_attachment_menu: {};
};
readonly group_chat_created: {};
readonly supergroup_chat_created: {};
readonly migrate_to_chat_id: {};
readonly migrate_from_chat_id: {};
readonly successful_payment: {};
readonly boost_added: {};
readonly users_shared: {};
readonly chat_shared: {};
readonly connected_website: {};
readonly write_access_allowed: {};
readonly passport_data: {};
readonly forum_topic_created: {};
readonly forum_topic_edited: {
readonly name: {};
readonly icon_custom_emoji_id: {};
};
readonly forum_topic_closed: {};
readonly forum_topic_reopened: {};
readonly general_forum_topic_hidden: {};
readonly general_forum_topic_unhidden: {};
readonly forward_origin: {
readonly user: {};
readonly hidden_user: {};
readonly chat: {};
readonly channel: {};
};
readonly is_topic_message: {};
readonly is_automatic_forward: {};
readonly business_connection_id: {};
readonly text: {};
readonly animation: {};
readonly audio: {};
readonly document: {};
readonly photo: {};
readonly sticker: {
readonly is_video: {};
readonly is_animated: {};
readonly premium_animation: {};
};
readonly story: {};
readonly video: {};
readonly video_note: {};
readonly voice: {};
readonly contact: {};
readonly dice: {};
readonly game: {};
readonly poll: {};
readonly venue: {};
readonly location: {};
readonly entities: {
readonly mention: {};
readonly hashtag: {};
readonly cashtag: {};
readonly bot_command: {};
readonly url: {};
readonly email: {};
readonly phone_number: {};
readonly bold: {};
readonly italic: {};
readonly underline: {};
readonly strikethrough: {};
readonly spoiler: {};
readonly code: {};
readonly pre: {};
readonly text_link: {};
readonly text_mention: {};
readonly custom_emoji: {};
};
readonly caption_entities: {
readonly mention: {};
readonly hashtag: {};
readonly cashtag: {};
readonly bot_command: {};
readonly url: {};
readonly email: {};
readonly phone_number: {};
readonly bold: {};
readonly italic: {};
readonly underline: {};
readonly strikethrough: {};
readonly spoiler: {};
readonly code: {};
readonly pre: {};
readonly text_link: {};
readonly text_mention: {};
readonly custom_emoji: {};
};
readonly caption: {};
readonly has_media_spoiler: {};
readonly new_chat_title: {};
readonly new_chat_photo: {};
readonly delete_chat_photo: {};
readonly message_auto_delete_timer_changed: {};
readonly pinned_message: {};
readonly invoice: {};
readonly proximity_alert_triggered: {};
readonly video_chat_scheduled: {};
readonly video_chat_started: {};
readonly video_chat_ended: {};
readonly video_chat_participants_invited: {};
readonly web_app_data: {};
};
readonly edited_business_message: {
readonly sender_boost_count: {};
readonly new_chat_members: {
readonly me: {};
readonly is_bot: {};
readonly is_premium: {};
readonly added_to_attachment_menu: {};
};
readonly left_chat_member: {
readonly me: {};
readonly is_bot: {};
readonly is_premium: {};
readonly added_to_attachment_menu: {};
};
readonly group_chat_created: {};
readonly supergroup_chat_created: {};
readonly migrate_to_chat_id: {};
readonly migrate_from_chat_id: {};
readonly successful_payment: {};
readonly boost_added: {};
readonly users_shared: {};
readonly chat_shared: {};
readonly connected_website: {};
readonly write_access_allowed: {};
readonly passport_data: {};
readonly forum_topic_created: {};
readonly forum_topic_edited: {
readonly name: {};
readonly icon_custom_emoji_id: {};
};
readonly forum_topic_closed: {};
readonly forum_topic_reopened: {};
readonly general_forum_topic_hidden: {};
readonly general_forum_topic_unhidden: {};
readonly forward_origin: {
readonly user: {};
readonly hidden_user: {};
readonly chat: {};
readonly channel: {};
};
readonly is_topic_message: {};
readonly is_automatic_forward: {};
readonly business_connection_id: {};
readonly text: {};
readonly animation: {};
readonly audio: {};
readonly document: {};
readonly photo: {};
readonly sticker: {
readonly is_video: {};
readonly is_animated: {};
readonly premium_animation: {};
};
readonly story: {};
readonly video: {};
readonly video_note: {};
readonly voice: {};
readonly contact: {};
readonly dice: {};
readonly game: {};
readonly poll: {};
readonly venue: {};
readonly location: {};
readonly entities: {
readonly mention: {};
readonly hashtag: {};
readonly cashtag: {};
readonly bot_command: {};
readonly url: {};
readonly email: {};
readonly phone_number: {};
readonly bold: {};
readonly italic: {};
readonly underline: {};
readonly strikethrough: {};
readonly spoiler: {};
readonly code: {};
readonly pre: {};
readonly text_link: {};
readonly text_mention: {};
readonly custom_emoji: {};
};
readonly caption_entities: {
readonly mention: {};
readonly hashtag: {};
readonly cashtag: {};
readonly bot_command: {};
readonly url: {};
readonly email: {};
readonly phone_number: {};
readonly bold: {};
readonly italic: {};
readonly underline: {};
readonly strikethrough: {};
readonly spoiler: {};
readonly code: {};
readonly pre: {};
readonly text_link: {};
readonly text_mention: {};
readonly custom_emoji: {};
};
readonly caption: {};
readonly has_media_spoiler: {};
readonly new_chat_title: {};
readonly new_chat_photo: {};
readonly delete_chat_photo: {};
readonly message_auto_delete_timer_changed: {};
readonly pinned_message: {};
readonly invoice: {};
readonly proximity_alert_triggered: {};
readonly video_chat_scheduled: {};
readonly video_chat_started: {};
readonly video_chat_ended: {};
readonly video_chat_participants_invited: {};
readonly web_app_data: {};
};
readonly deleted_business_messages: {};
readonly inline_query: {};

@@ -475,2 +716,4 @@ readonly chosen_inline_result: {};

};
readonly chat_boost: {};
readonly removed_chat_boost: {};
};

@@ -487,3 +730,3 @@ type KeyOf<T> = string & keyof T;

type CollapseL2<Q extends string, L extends L2Shortcuts = Exclude<L2Shortcuts, "">> = Q | (L extends string ? Q extends typeof L2_SHORTCUTS[L][number] ? L : never : never);
type ComputeFilterQueryList = InjectShortcuts | "chat_boost" | "removed_chat_boost";
type ComputeFilterQueryList = InjectShortcuts;
/**

@@ -540,8 +783,32 @@ * Represents a filter query that can be passed to `bot.on`. There are three

type FilteredContext<C extends Context, U extends Update> = C & FilteredContextCore<U>;
type FilteredContextCore<U extends Update> = Record<"update", U> & AliasProps<Omit<U, "update_id">> & Shortcuts<U>;
type FilteredContextCore<U extends Update> = Record<"update", U> & Shortcuts<U>;
interface Shortcuts<U extends Update> {
msg: [U["callback_query"]] extends [object] ? U["callback_query"]["message"] : [U["message"]] extends [object] ? U["message"] : [U["edited_message"]] extends [object] ? U["edited_message"] : [U["channel_post"]] extends [object] ? U["channel_post"] : [U["edited_channel_post"]] extends [object] ? U["edited_channel_post"] : undefined;
chat: [U["callback_query"]] extends [object] ? NonNullable<U["callback_query"]["message"]>["chat"] | undefined : [Shortcuts<U>["msg"]] extends [object] ? Shortcuts<U>["msg"]["chat"] : [U["my_chat_member"]] extends [object] ? U["my_chat_member"]["chat"] : [U["chat_member"]] extends [object] ? U["chat_member"]["chat"] : [U["chat_join_request"]] extends [object] ? U["chat_join_request"]["chat"] : undefined;
message: [U["message"]] extends [object] ? U["message"] : undefined;
edited_message: [U["edited_message"]] extends [object] ? U["edited_message"] : undefined;
channelPost: [U["channel_post"]] extends [object] ? U["channel_post"] : undefined;
editedChannelPost: [U["edited_channel_post"]] extends [object] ? U["edited_channel_post"] : undefined;
businessConnection: [U["business_connection"]] extends [object] ? U["business_connection"] : undefined;
businessMessage: [U["business_message"]] extends [object] ? U["business_message"] : undefined;
editedBusinessMessage: [U["edited_business_message"]] extends [object] ? U["edited_business_message"] : undefined;
deletedBusinessMessages: [U["deleted_business_messages"]] extends [object] ? U["deleted_business_messages"] : undefined;
messageReaction: [U["message_reaction"]] extends [object] ? U["message_reaction"] : undefined;
messageReactionCount: [U["message_reaction_count"]] extends [object] ? U["message_reaction_count"] : undefined;
inlineQuery: [U["inline_query"]] extends [object] ? U["inline_query"] : undefined;
chosenInlineResult: [U["chosen_inline_result"]] extends [object] ? U["chosen_inline_result"] : undefined;
callbackQuery: [U["callback_query"]] extends [object] ? U["callback_query"] : undefined;
shippingQuery: [U["shipping_query"]] extends [object] ? U["shipping_query"] : undefined;
preCheckoutQuery: [U["pre_checkout_query"]] extends [object] ? U["pre_checkout_query"] : undefined;
poll: [U["poll"]] extends [object] ? U["poll"] : undefined;
pollAnswer: [U["poll_answer"]] extends [object] ? U["poll_answer"] : undefined;
myChatMember: [U["my_chat_member"]] extends [object] ? U["my_chat_member"] : undefined;
chatMember: [U["chat_member"]] extends [object] ? U["chat_member"] : undefined;
chatJoinRequest: [U["chat_join_request"]] extends [object] ? U["chat_join_request"] : undefined;
chatBoost: [U["chat_boost"]] extends [object] ? U["chat_boost"] : undefined;
removedChatBoost: [U["removed_chat_boost"]] extends [object] ? U["removed_chat_boost"] : undefined;
msg: [U["message"]] extends [object] ? U["message"] : [U["edited_message"]] extends [object] ? U["edited_message"] : [U["channel_post"]] extends [object] ? U["channel_post"] : [U["edited_channel_post"]] extends [object] ? U["edited_channel_post"] : [U["business_message"]] extends [object] ? U["business_message"] : [U["edited_business_message"]] extends [object] ? U["edited_business_message"] : [U["callback_query"]] extends [object] ? U["callback_query"]["message"] : undefined;
chat: [Shortcuts<U>["msg"]] extends [object] ? Shortcuts<U>["msg"]["chat"] : [U["deleted_business_messages"]] extends [object] ? U["deleted_business_messages"]["chat"] : [U["message_reaction"]] extends [object] ? U["message_reaction"]["chat"] : [U["message_reaction_count"]] extends [object] ? U["message_reaction_count"]["chat"] : [U["my_chat_member"]] extends [object] ? U["my_chat_member"]["chat"] : [U["chat_member"]] extends [object] ? U["chat_member"]["chat"] : [U["chat_join_request"]] extends [object] ? U["chat_join_request"]["chat"] : [U["chat_boost"]] extends [object] ? U["chat_boost"]["chat"] : [U["removed_chat_boost"]] extends [object] ? U["removed_chat_boost"]["chat"] : undefined;
senderChat: [Shortcuts<U>["msg"]] extends [object] ? Shortcuts<U>["msg"]["sender_chat"] : undefined;
from: [U["callback_query"]] extends [object] ? U["callback_query"]["from"] : [U["inline_query"]] extends [object] ? U["inline_query"]["from"] : [U["shipping_query"]] extends [object] ? U["shipping_query"]["from"] : [U["pre_checkout_query"]] extends [object] ? U["pre_checkout_query"]["from"] : [U["chosen_inline_result"]] extends [object] ? U["chosen_inline_result"]["from"] : [U["message"]] extends [object] ? NonNullable<U["message"]["from"]> : [U["edited_message"]] extends [object] ? NonNullable<U["edited_message"]["from"]> : [U["my_chat_member"]] extends [object] ? U["my_chat_member"]["from"] : [U["chat_member"]] extends [object] ? U["chat_member"]["from"] : [U["chat_join_request"]] extends [object] ? U["chat_join_request"]["from"] : undefined;
from: [U["business_connection"]] extends [object] ? U["business_connection"]["user"] : [U["message_reaction"]] extends [object] ? U["message_reaction"]["user"] : [U["chat_boost"]] extends [object] ? U["chat_boost"]["boost"]["source"]["user"] : [U["removed_chat_boost"]] extends [object] ? U["removed_chat_boost"]["source"]["user"] : [Shortcuts<U>["msg"]] extends [object] ? Shortcuts<U>["msg"]["from"] : [U["inline_query"]] extends [object] ? U["inline_query"]["from"] : [U["chosen_inline_result"]] extends [object] ? U["chosen_inline_result"]["from"] : [U["callback_query"]] extends [object] ? U["callback_query"]["from"] : [U["shipping_query"]] extends [object] ? U["shipping_query"]["from"] : [U["pre_checkout_query"]] extends [object] ? U["pre_checkout_query"]["from"] : [U["my_chat_member"]] extends [object] ? U["my_chat_member"]["from"] : [U["chat_member"]] extends [object] ? U["chat_member"]["from"] : [U["chat_join_request"]] extends [object] ? U["chat_join_request"]["from"] : undefined;
msgId: [Shortcuts<U>["msg"]] extends [object] ? number : U["message_reaction"] extends [object] ? number : U["message_reaction_count"] extends [object] ? number : undefined;
businessConnectionId: [Shortcuts<U>["msg"]] extends [object] ? string | undefined : [U["business_connection"]] extends [object] ? [U["business_connection"]["id"]] : [U["deleted_business_messages"]] extends [object] ? [U["deleted_business_messages"]["business_connection_id"]] : undefined;
}

@@ -560,3 +827,3 @@ declare const L1_SHORTCUTS: {

type L2Shortcuts = KeyOf<typeof L2_SHORTCUTS>;
type ExpandShortcuts<Q extends string> = Exclude<Q extends `${infer L1}:${infer L2}:${infer L3}` ? `${ExpandL1<L1>}:${ExpandL2<L2>}:${L3}` : Q extends `${infer L1}:${infer L2}` ? `${ExpandL1<L1>}:${ExpandL2<L2>}` : ExpandL1<Q>, "chat_boost" | "removed_chat_boost">;
type ExpandShortcuts<Q extends string> = Q extends `${infer L1}:${infer L2}:${infer L3}` ? `${ExpandL1<L1>}:${ExpandL2<L2>}:${L3}` : Q extends `${infer L1}:${infer L2}` ? `${ExpandL1<L1>}:${ExpandL2<L2>}` : ExpandL1<Q>;
type ExpandL1<S extends string> = S extends L1Shortcuts ? typeof L1_SHORTCUTS[S][number] : S;

@@ -571,2 +838,4 @@ type ExpandL2<S extends string> = S extends L2Shortcuts ? typeof L2_SHORTCUTS[S][number] : S;

edited_channel_post: "sender_chat" | "edit_date";
business_message: "from";
edited_business_message: "from" | "edit_date";
};

@@ -579,2 +848,4 @@ type TwinsFromL2<L1 extends string, L2 extends string> = L1 extends KeyOf<L2Equivalents> ? L2 extends KeyOf<L2Equivalents[L1]> ? L2Equivalents[L1][L2] : L2 : L2;

edited_channel_post: MessageEquivalents;
business_message: MessageEquivalents;
edited_business_message: MessageEquivalents;
};

@@ -581,0 +852,0 @@ type MessageEquivalents = {

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

return "Empty filter query given";
if (!(l1 in UPDATE_KEYS ||
l1 === "chat_boost" || l1 === "removed_chat_boost") // TODO: remove
) {
if (!(l1 in UPDATE_KEYS)) {
const permitted = Object.keys(UPDATE_KEYS);

@@ -252,2 +250,3 @@ return `Invalid L1 filter '${l1}' given in '${filter.join(":")}'. \

is_automatic_forward: {},
business_connection_id: {},
text: {},

@@ -313,5 +312,7 @@ animation: {},

};
const CALLBACK_QUERY_KEYS = { data: {}, game_short_name: {} };
const CHAT_MEMBER_UPDATED_KEYS = { from: USER_KEYS };
const MESSAGE_REACTION_UPDATED_KEYS = {
const BUSINESS_CONNECTION_KEYS = {
can_reply: {},
is_enabled: {},
};
const MESSAGE_REACTION_KEYS = {
old_reaction: REACTION_KEYS,

@@ -323,2 +324,4 @@ new_reaction: REACTION_KEYS,

};
const CALLBACK_QUERY_KEYS = { data: {}, game_short_name: {} };
const CHAT_MEMBER_UPDATED_KEYS = { from: USER_KEYS };
// L1

@@ -330,2 +333,6 @@ const UPDATE_KEYS = {

edited_channel_post: CHANNEL_POST_KEYS,
business_connection: BUSINESS_CONNECTION_KEYS,
business_message: MESSAGE_KEYS,
edited_business_message: MESSAGE_KEYS,
deleted_business_messages: {},
inline_query: {},

@@ -341,6 +348,6 @@ chosen_inline_result: {},

chat_join_request: {},
message_reaction: MESSAGE_REACTION_UPDATED_KEYS,
message_reaction: MESSAGE_REACTION_KEYS,
message_reaction_count: MESSAGE_REACTION_COUNT_UPDATED_KEYS,
// chat_boost: {},
// removed_chat_boost: {},
chat_boost: {},
removed_chat_boost: {},
};

@@ -347,0 +354,0 @@ // === Define some helpers for handling shortcuts, e.g. in 'edit:photo'

{
"name": "grammy",
"description": "The Telegram Bot Framework.",
"version": "1.21.2",
"version": "1.22.0",
"author": "KnorpelSenf",

@@ -20,3 +20,3 @@ "license": "MIT",

"dependencies": {
"@grammyjs/types": "3.5.2",
"@grammyjs/types": "3.6.1",
"abort-controller": "^3.0.0",

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

@@ -13,3 +13,3 @@ <div align="center"><a href="https://grammy.dev"><img src="https://raw.githubusercontent.com/grammyjs/website/main/logos/grammY.png" alt="grammY"></a></h1></div>

[![Bot API](https://img.shields.io/badge/Bot%20API-7.1-blue?logo=telegram&style=flat&labelColor=000&color=3b82f6)](https://core.telegram.org/bots/api)
[![Bot API](https://img.shields.io/badge/Bot%20API-7.2-blue?logo=telegram&style=flat&labelColor=000&color=3b82f6)](https://core.telegram.org/bots/api)
[![Deno](https://shield.deno.dev/x/grammy)](https://deno.land/x/grammy)

@@ -16,0 +16,0 @@ [![npm](https://img.shields.io/npm/v/grammy?logo=npm&style=flat&labelColor=000&color=3b82f6)](https://www.npmjs.org/package/grammy)

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

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

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

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc