New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@grammyjs/parse-mode

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@grammyjs/parse-mode - npm Package Compare versions

Comparing version 1.9.0 to 1.10.0

4

dist/deps.node.d.ts
import type { Context, NextFunction, Transformer } from "grammy";
export type { Context, NextFunction, Transformer, };
import type { InputMedia, InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo } from "grammy/types";
export type { Context, NextFunction, Transformer };
export type { InputMedia, InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo, };
export type MessageEntity = NonNullable<NonNullable<Parameters<Context["reply"]>[1]>["entities"]>[number];
export type ParseMode = NonNullable<NonNullable<Parameters<Context["reply"]>[1]>["parse_mode"]>;
import type { Context, NextFunction } from "./deps.node.js";
import { type Stringable } from "./format.js";
type Tail<T extends Array<any>> = T extends [head: infer E1, ...tail: infer E2] ? E2 : [];
type Tail<T extends Array<unknown>> = T extends [
head: infer E1,
...tail: infer E2
] ? E2 : [];
/**

@@ -14,2 +17,12 @@ * Context flavor for `Context` that will be hydrated with

replyWithMarkdownV2: C["reply"];
replyFmtWithPhoto: (photo: Parameters<C["replyWithPhoto"]>[0], other?: Omit<Exclude<Parameters<C["replyWithPhoto"]>[1], undefined>, "caption"> & {
caption?: Stringable;
}, ...args: Tail<Tail<Parameters<C["replyWithPhoto"]>>>) => ReturnType<C["replyWithPhoto"]>;
replyFmtWithMediaGroup: (media: (Omit<Parameters<C["replyWithMediaGroup"]>[0][number], "caption"> & {
caption?: Stringable;
})[], other?: Parameters<C["replyWithMediaGroup"]>[1], ...args: Tail<Tail<Parameters<C["replyWithMediaGroup"]>>>) => ReturnType<C["replyWithMediaGroup"]>;
editFmtMessageMedia: (media: Omit<Parameters<C["editMessageMedia"]>[0], "caption"> & {
caption?: Stringable;
}, other?: Omit<Parameters<C["editMessageMedia"]>[1], "caption">, ...args: Tail<Tail<Parameters<C["editMessageMedia"]>>>) => ReturnType<C["editMessageMedia"]>;
editFmtMessageText: (text: Stringable, other?: Parameters<C["editMessageText"]>[1], ...args: Tail<Tail<Parameters<C["editMessageText"]>>>) => ReturnType<C["editMessageText"]>;
};

@@ -25,3 +38,3 @@ /**

*/
declare const middleware: <C extends Context>(ctx: ParseModeFlavor<C>, next: NextFunction) => Promise<void>;
export { middleware as hydrateReply, type ParseModeContext, type ParseModeFlavor, };
declare const hydrateReply: <C extends Context>(ctx: ParseModeFlavor<C>, next: NextFunction) => Promise<void>;
export { hydrateReply, type ParseModeContext, type ParseModeFlavor };

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

*/
const middleware = async (ctx, next) => {
const hydrateReply = async (ctx, next) => {
ctx.replyFmt = (stringLike, ...args) => {

@@ -29,4 +29,49 @@ const [payload, ...rest] = args;

ctx.replyWithMarkdownV2 = buildReplyWithParseMode("MarkdownV2", ctx);
ctx.replyFmtWithPhoto = (photo, other, ...args) => {
const caption = other?.caption?.toString();
const caption_entities = other?.caption instanceof format_js_1.FormattedString
? other.caption.entities
: other?.caption_entities;
return ctx.replyWithPhoto(photo, {
...other,
caption,
caption_entities,
}, ...args);
};
ctx.replyFmtWithMediaGroup = (media, other, ...args) => {
const inputMedia = media.map((item) => {
const caption = item.caption?.toString();
const caption_entities = item.caption instanceof format_js_1.FormattedString
? item.caption.entities
: item.caption_entities;
return {
...item,
caption,
caption_entities,
};
});
return ctx.replyWithMediaGroup(inputMedia, other, ...args);
};
ctx.editFmtMessageMedia = (media, other, ...args) => {
const caption = media.caption?.toString();
const caption_entities = media.caption instanceof format_js_1.FormattedString
? media.caption.entities
: media?.caption_entities;
return ctx.editMessageMedia({
...media,
caption,
caption_entities,
}, other, ...args);
};
ctx.editFmtMessageText = (text, other, ...args) => {
const entities = text instanceof format_js_1.FormattedString
? text.entities
: other?.entities;
return ctx.editMessageText(text.toString(), {
...other,
entities,
}, ...args);
};
await next();
};
exports.hydrateReply = middleware;
exports.hydrateReply = hydrateReply;
{
"name": "@grammyjs/parse-mode",
"version": "1.9.0",
"version": "1.10.0",
"description": "Plugin for hydrating ctx with familiar reply variants and for setting default parse_mode",

@@ -5,0 +5,0 @@ "author": "KnightNiwrem",

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