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

@grammyjs/parse-mode

Package Overview
Dependencies
Maintainers
2
Versions
14
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.7.1 to 1.8.0

dist/utils.d.ts

15

dist/format.d.ts

@@ -102,3 +102,6 @@ import type { MessageEntity } from "./deps.node.js";

* in further `fmt` tagged templates.
* @param rawStringParts An array of `string` parts found in the tagged template
*
* Can also be called like regular function and passed an array of `Stringable`s.
*
* @param rawStringParts An array of `string` parts found in the tagged template (can also be `Stringable`s)
* @param stringLikes An array of `Stringable`s found in the tagged template

@@ -113,5 +116,13 @@ *

* await ctx.replyFmt(final);
*
* // Using regular function form
* const cart = fmt([
* "Your shopping cart:\n",
* ...items.map((item) => fmt`- ${bold(item.name)} (${item.price})\n`),
* ]);
* // Using result in editMessageText
* await ctx.editMessageText(cart.text, { entities: cart.entities });
* ```
*/
declare const fmt: (rawStringParts: TemplateStringsArray | string[], ...stringLikes: Stringable[]) => FormattedString;
declare const fmt: (rawStringParts: TemplateStringsArray | Stringable[], ...stringLikes: Stringable[]) => FormattedString;
export { bold, code, fmt, FormattedString, italic, link, linkMessage, mentionUser, pre, spoiler, strikethrough, underline, };

35

dist/format.js

@@ -145,3 +145,6 @@ "use strict";

* in further `fmt` tagged templates.
* @param rawStringParts An array of `string` parts found in the tagged template
*
* Can also be called like regular function and passed an array of `Stringable`s.
*
* @param rawStringParts An array of `string` parts found in the tagged template (can also be `Stringable`s)
* @param stringLikes An array of `Stringable`s found in the tagged template

@@ -156,17 +159,27 @@ *

* await ctx.replyFmt(final);
*
* // Using regular function form
* const cart = fmt([
* "Your shopping cart:\n",
* ...items.map((item) => fmt`- ${bold(item.name)} (${item.price})\n`),
* ]);
* // Using result in editMessageText
* await ctx.editMessageText(cart.text, { entities: cart.entities });
* ```
*/
const fmt = (rawStringParts, ...stringLikes) => {
let text = rawStringParts[0];
let text = "";
const entities = [];
for (let i = 0; i < stringLikes.length; i++) {
const stringLike = stringLikes[i];
if (stringLike instanceof FormattedString) {
entities.push(...stringLike.entities.map((e) => ({
...e,
offset: e.offset + text.length,
})));
const length = Math.max(rawStringParts.length, stringLikes.length);
for (let i = 0; i < length; i++) {
for (const stringLike of [rawStringParts[i], stringLikes[i]]) {
if (stringLike instanceof FormattedString) {
entities.push(...stringLike.entities.map((e) => ({
...e,
offset: e.offset + text.length,
})));
}
if (stringLike != null)
text += stringLike.toString();
}
text += stringLike.toString();
text += rawStringParts[i + 1];
}

@@ -173,0 +186,0 @@ return new FormattedString(text, entities);

{
"name": "@grammyjs/parse-mode",
"version": "1.7.1",
"version": "1.8.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