grammy-inline-menu
Advanced tools
Comparing version 9.1.0 to 9.2.0
@@ -0,1 +1,2 @@ | ||
import type { CopyTextButton } from 'grammy/types'; | ||
import type { ActionFunc } from '../action-hive.js'; | ||
@@ -16,2 +17,5 @@ import type { ConstOrContextPathFunc, ContextPathFunc } from '../generic-types.js'; | ||
export type ManualButtonOptions<Context> = BasicOptions<Context> & JoinLastRowOption; | ||
export interface CopyTextButtonOptions<Context> extends SingleButtonOptions<Context> { | ||
readonly copy_text: ConstOrContextPathFunc<Context, Readonly<CopyTextButton>>; | ||
} | ||
export interface UrlButtonOptions<Context> extends SingleButtonOptions<Context> { | ||
@@ -18,0 +22,0 @@ /** Url where this button should be heading */ |
import { type ActionFunc, type ButtonAction } from './action-hive.js'; | ||
import type { Body } from './body.js'; | ||
import type { InteractionOptions, ManualButtonOptions, SingleButtonOptions, SwitchToChatOptions, UrlButtonOptions } from './buttons/basic.js'; | ||
import type { CopyTextButtonOptions, InteractionOptions, ManualButtonOptions, SingleButtonOptions, SwitchToChatOptions, UrlButtonOptions } from './buttons/basic.js'; | ||
import type { ChooseOptions } from './buttons/choose.js'; | ||
@@ -56,2 +56,10 @@ import { type PaginationOptions } from './buttons/pagination.js'; | ||
manualAction(trigger: RegExpLike, action: ActionFunc<Context>): void; | ||
/** Add a copy_text button to the keyboard | ||
* @example | ||
* menuTemplate.copyText({ | ||
* text: 'Copy this', | ||
* copy_text: { text: 'content' }, | ||
* }); | ||
*/ | ||
copyText(options: CopyTextButtonOptions<Context>): void; | ||
/** Add an url button to the keyboard | ||
@@ -58,0 +66,0 @@ * @example |
@@ -84,2 +84,18 @@ import { ActionHive, } from './action-hive.js'; | ||
} | ||
/** Add a copy_text button to the keyboard | ||
* @example | ||
* menuTemplate.copyText({ | ||
* text: 'Copy this', | ||
* copy_text: { text: 'content' }, | ||
* }); | ||
*/ | ||
copyText(options) { | ||
const { text, copy_text } = options; | ||
this.manual(async (context, path) => ({ | ||
text: typeof text === 'function' ? await text(context, path) : text, | ||
copy_text: typeof copy_text === 'function' | ||
? await copy_text(context, path) | ||
: copy_text, | ||
}), options); | ||
} | ||
/** Add an url button to the keyboard | ||
@@ -86,0 +102,0 @@ * @example |
@@ -33,6 +33,7 @@ import { getBodyText, isInvoiceBody, isLocationBody, isMediaBody, isTextBody, isVenueBody, } from './body.js'; | ||
if ('animation' in message | ||
|| 'document' in message | ||
|| 'audio' in message | ||
|| 'document' in message | ||
|| 'photo' in message | ||
|| 'video' in message) { | ||
|| 'video' in message | ||
|| 'text' in message) { | ||
return context.editMessageMedia({ | ||
@@ -39,0 +40,0 @@ type: body.type, |
{ | ||
"name": "grammy-inline-menu", | ||
"version": "9.1.0", | ||
"version": "9.2.0", | ||
"description": "Inline Menus for Telegram made simple. Successor of telegraf-inline-menu.", | ||
@@ -46,3 +46,3 @@ "keywords": [ | ||
"peerDependencies": { | ||
"grammy": "^1.19.2" | ||
"grammy": "^1.31.0" | ||
}, | ||
@@ -54,3 +54,3 @@ "devDependencies": { | ||
"del-cli": "^6.0.0", | ||
"grammy": "^1.19.2", | ||
"grammy": "^1.31.0", | ||
"typescript": "^5.5.2", | ||
@@ -57,0 +57,0 @@ "xo": "^0.59.3" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
167280
2156