grammy-inline-menu
Advanced tools
Comparing version 7.0.1 to 7.0.2
@@ -1,2 +0,3 @@ | ||
import { InputFile, LabeledPrice, Location, ParseMode, Venue } from 'grammy/out/platform'; | ||
import { InputFile } from 'grammy'; | ||
import { LabeledPrice, Location, ParseMode, Venue } from '@grammyjs/types'; | ||
export declare type Body = string | TextBody | MediaBody | LocationBody | VenueBody | InvoiceBody; | ||
@@ -3,0 +4,0 @@ export declare type MediaType = 'animation' | 'audio' | 'document' | 'photo' | 'video'; |
@@ -1,2 +0,2 @@ | ||
import { InlineKeyboardButton as TelegramInlineKeyboardButton } from 'grammy/out/platform'; | ||
import { InlineKeyboardButton as TelegramInlineKeyboardButton } from '@grammyjs/types'; | ||
import { ConstOrContextPathFunc, ContextPathFunc } from './generic-types'; | ||
@@ -3,0 +3,0 @@ export interface CallbackButtonTemplate { |
import { Context as BaseContext } from 'grammy'; | ||
import { Message } from 'grammy/out/platform'; | ||
import { RegExpLike } from './generic-types'; | ||
@@ -28,3 +27,3 @@ import { MenuLike } from './menu-like'; | ||
*/ | ||
replyToContext(context: Context, path?: string | RegExpLike): Promise<Message>; | ||
replyToContext(context: Context, path?: string | RegExpLike): Promise<import("@grammyjs/types").Message.DocumentMessage | import("@grammyjs/types").Message.AudioMessage | import("@grammyjs/types").Message.PhotoMessage | import("@grammyjs/types").Message.VideoMessage | import("@grammyjs/types").Message.LocationMessage | import("@grammyjs/types").Message.InvoiceMessage | import("@grammyjs/types").Message.TextMessage>; | ||
/** | ||
@@ -31,0 +30,0 @@ * The tree structure can be shown for debugging purposes. |
import { Context as BaseContext, Api } from 'grammy'; | ||
import { Message } from 'grammy/out/platform'; | ||
import { Message } from '@grammyjs/types'; | ||
import { MenuLike } from './menu-like'; | ||
@@ -25,3 +25,3 @@ /** | ||
*/ | ||
export declare function replyMenuToContext<Context extends BaseContext>(menu: MenuLike<Context>, context: Context, path: string, other?: Readonly<Record<string, unknown>>): Promise<Message>; | ||
export declare function replyMenuToContext<Context extends BaseContext>(menu: MenuLike<Context>, context: Context, path: string, other?: Readonly<Record<string, unknown>>): Promise<Message.DocumentMessage | Message.AudioMessage | Message.PhotoMessage | Message.VideoMessage | Message.LocationMessage | Message.InvoiceMessage | Message.TextMessage>; | ||
/** | ||
@@ -34,3 +34,3 @@ * Edit the context into the menu. If thats not possible the current message is deleted and a new message is replied | ||
*/ | ||
export declare function editMenuOnContext<Context extends BaseContext>(menu: MenuLike<Context>, context: Context, path: string, other?: Readonly<Record<string, unknown>>): Promise<Message | boolean>; | ||
export declare function editMenuOnContext<Context extends BaseContext>(menu: MenuLike<Context>, context: Context, path: string, other?: Readonly<Record<string, unknown>>): Promise<boolean | Message.DocumentMessage | Message.AudioMessage | Message.PhotoMessage | Message.VideoMessage | Message.LocationMessage | Message.InvoiceMessage | Message.TextMessage>; | ||
/** | ||
@@ -49,3 +49,3 @@ * Delete the message on the context. | ||
*/ | ||
export declare function resendMenuToContext<Context extends BaseContext>(menu: MenuLike<Context>, context: Context, path: string, other?: Readonly<Record<string, unknown>>): Promise<Message>; | ||
export declare function resendMenuToContext<Context extends BaseContext>(menu: MenuLike<Context>, context: Context, path: string, other?: Readonly<Record<string, unknown>>): Promise<Message.DocumentMessage | Message.AudioMessage | Message.PhotoMessage | Message.VideoMessage | Message.LocationMessage | Message.InvoiceMessage | Message.TextMessage>; | ||
/** | ||
@@ -52,0 +52,0 @@ * Generate a function to send the menu towards a chat from external events |
@@ -38,3 +38,3 @@ "use strict"; | ||
if ('animation' in message || 'audio' in message || 'document' in message || 'photo' in message || 'video' in message) { | ||
const media = { | ||
return context.editMessageMedia({ | ||
type: body.type, | ||
@@ -44,4 +44,3 @@ media: body.media, | ||
parse_mode: body.parse_mode, | ||
}; | ||
return context.editMessageMedia(media, createGenericOther(keyboard, other)) | ||
}, createGenericOther(keyboard, other)) | ||
// eslint-disable-next-line promise/prefer-await-to-then | ||
@@ -202,3 +201,3 @@ .catch(catchMessageNotModified); | ||
if ((0, body_1.isMediaBody)(body)) { | ||
const media = { | ||
return telegram.editMessageMedia(chatId, messageId, { | ||
type: body.type, | ||
@@ -208,4 +207,3 @@ media: body.media, | ||
parse_mode: body.parse_mode, | ||
}; | ||
return telegram.editMessageMedia(chatId, messageId, media, createGenericOther(keyboard, other)); | ||
}, createGenericOther(keyboard, other)); | ||
} | ||
@@ -212,0 +210,0 @@ if ((0, body_1.isLocationBody)(body)) { |
{ | ||
"name": "grammy-inline-menu", | ||
"version": "7.0.1", | ||
"version": "7.0.2", | ||
"description": "Inline Menus for Telegram made simple. Successor of telegraf-inline-menu.", | ||
@@ -31,3 +31,3 @@ "keywords": [ | ||
"preexample-js": "npm run build", | ||
"example-js": "node examples/main-javascript.js", | ||
"example-js": "node examples/main-javascript.mjs", | ||
"start": "ts-node examples/main-typescript.ts", | ||
@@ -40,2 +40,5 @@ "test": "tsc --sourceMap && xo && nyc ava" | ||
}, | ||
"dependencies": { | ||
"@grammyjs/types": "^2.2.6" | ||
}, | ||
"peerDependencies": { | ||
@@ -52,4 +55,4 @@ "grammy": "^1.3.0" | ||
"ts-node": "^10.0.0", | ||
"typescript": "^4.2.0", | ||
"xo": "^0.44.0" | ||
"typescript": "^4.4.4", | ||
"xo": "^0.45.0" | ||
}, | ||
@@ -76,2 +79,3 @@ "files": [ | ||
"rules": { | ||
"@typescript-eslint/naming-convention": "off", | ||
"@typescript-eslint/prefer-readonly-parameter-types": "error", | ||
@@ -78,0 +82,0 @@ "ava/no-ignored-test-files": "off", |
@@ -47,3 +47,3 @@ # grammY Inline Menu | ||
Look at the code here: [TypeScript](examples/main-typescript.ts) / [JavaScript (consider using TypeScript)](examples/main-javascript.js) | ||
Look at the code here: [TypeScript](examples/main-typescript.ts) / [JavaScript (consider using TypeScript)](examples/main-javascript.mjs) | ||
@@ -50,0 +50,0 @@ # Migrate from version 4 to 5 |
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
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
273409
3571
2
+ Added@grammyjs/types@^2.2.6
+ Added@grammyjs/types@2.12.1(transitive)