grammy-edit-or-reply
Version:
Exports utilities for grammy to edit a message or reply to a message based on the context
25 lines (24 loc) • 1.28 kB
TypeScript
import { Api } from 'grammy';
import { InputMedia } from 'grammy/types';
import { EditOrReplyResult, MessageData, MessageDataMedia, OldMessageInfo, OldMessageInfoChat, OldMessageInfoChatMessage, SendMediaResult, TelegramOther } from './types';
/**
* Creates the `other` parameter with the specified keys.
*/
export declare function makeOther<T extends (keyof TelegramOther)[]>(messageData: MessageData, keys: T): Pick<TelegramOther, T[number]>;
/**
* Creates the input media, adding available properties
*/
export declare function makeInputMedia(messageData: MessageDataMedia): InputMedia;
/**
* Sends a media to the specified chat in a new message
*/
export declare function sendMedia(api: Api, messageData: MessageDataMedia, oldMessageInfo: OldMessageInfoChat | OldMessageInfoChatMessage): Promise<SendMediaResult>;
/**
* Tries deleting the specified message, does **not** throw an error on failure
*/
export declare function deleteStaleMessage(api: Api, oldMessageInfo: OldMessageInfoChatMessage): void;
/**
* Use this when context is not available but you still have data regarding the
* message that needs to be edited (if any).
*/
export declare function editOrReply(api: Api, messageData: MessageData, oldMessageInfo: OldMessageInfo): Promise<EditOrReplyResult>;