tgsnake
Version:
Telegram MTProto framework for nodejs.
200 lines (199 loc) • 8.67 kB
TypeScript
import { TLObject } from '../TL.js';
import { Raw, Buffer, type Entities, type Readable, type Files } from '../../platform.node.js';
import * as Advanceds from '../Advanced/index.js';
import * as Medias from './Medias/index.js';
import * as ReplyMarkup from './ReplyMarkup.js';
import type { Snake } from '../../Client/index.js';
import type { sendMessageParams, sendDocumentParams, sendVideoParams, sendVideoNoteParams, sendAnimationParams, sendStickerParams } from '../../Methods/Messages/index.js';
export interface TypeMessage {
id: number;
outgoing?: boolean;
date?: Date;
chat?: Advanceds.Chat;
from?: Advanceds.User;
threadId?: number;
senderChat?: Advanceds.Chat;
forwardFrom?: Advanceds.User;
forwardFromChat?: Advanceds.Chat;
forwardFromMessageId?: number;
forwardSignature?: string;
forwardSenderName?: string;
forwardDate?: Date;
isTopicMessage?: boolean;
isAutomaticForward?: boolean;
replyToMessage?: Message;
replyToMessageId?: number;
replyToTopMessageId?: number;
mentioned?: boolean;
empty?: boolean;
viaBot?: Advanceds.User;
hasProtectedContent?: boolean;
mediaGroupId?: bigint;
authorSignatrure?: string;
text?: string;
entities?: Array<Entities>;
animation?: Medias.Animation;
audio?: Medias.Audio;
document?: Medias.Document;
photo?: Medias.Photo;
sticker?: Medias.Sticker;
video?: Medias.Video;
videoNote?: Medias.VideoNote;
voice?: Medias.Voice;
webpage?: Medias.WebPage;
caption?: string;
captionEntities?: Array<Entities>;
hasSpoilerMode?: boolean;
contact?: Medias.Contact;
dice?: Medias.Dice;
game?: Medias.Game;
poll?: Medias.Poll;
venue?: Medias.Venue;
location?: Medias.Location;
newChatMembers?: Array<Advanceds.User>;
leftChatMember?: Advanceds.User;
newChatTitle?: string;
newChatPhoto?: Medias.Photo;
deleteChatPhoto?: boolean;
groupChatCreated?: boolean;
channelChatCreated?: boolean;
messageAutoDeleteTimeChanged?: boolean;
migrateToChatId?: bigint;
migrateFromChatId?: bigint;
pinnedMessage?: Message;
invoice?: any;
successfulPayment?: any;
userShared?: any;
chatShared?: any;
connectedWebsite?: string;
writeAccessAllowed?: any;
passportData?: any;
forumTopicCreated?: Raw.MessageActionTopicCreate;
forumTopicEdited?: Raw.MessageActionTopicEdit;
videoChatScheduled?: Date;
videoChatEnded?: number;
videoChatStarted?: boolean;
videoChatParticipantInvalid?: any;
videoChatInvited?: Array<Advanceds.User>;
webAppData?: Advanceds.WebAppData;
replyMarkup?: ReplyMarkup.TypeReplyMarkup;
giftPremium?: Raw.MessageActionGiftPremium;
chatThemeChanged?: Raw.MessageActionSetChatTheme;
screenshot?: boolean;
ttl?: number;
replyToStoryId?: number;
repliedStoryFrom?: Advanceds.Chat;
linkPreviewOptions?: Medias.LinkPreviewOptions;
}
export declare class Message extends TLObject {
id: number;
outgoing?: boolean;
date?: Date;
chat?: Advanceds.Chat;
from?: Advanceds.User;
threadId?: number;
senderChat?: Advanceds.Chat;
forwardFrom?: Advanceds.User;
forwardFromChat?: Advanceds.Chat;
forwardFromMessageId?: number;
forwardSignature?: string;
forwardSenderName?: string;
forwardDate?: Date;
isTopicMessage?: boolean;
isAutomaticForward?: boolean;
replyToMessage?: Message;
replyToMessageId?: number;
replyToTopMessageId?: number;
mentioned?: boolean;
empty?: boolean;
viaBot?: Advanceds.User;
hasProtectedContent?: boolean;
mediaGroupId?: bigint;
authorSignatrure?: string;
text?: string;
entities?: Array<Entities>;
animation?: Medias.Animation;
audio?: Medias.Audio;
document?: Medias.Document;
photo?: Medias.Photo;
sticker?: Medias.Sticker;
video?: Medias.Video;
videoNote?: Medias.VideoNote;
voice?: Medias.Voice;
caption?: string;
captionEntities?: Array<Entities>;
hasSpoilerMode?: boolean;
contact?: Medias.Contact;
dice?: Medias.Dice;
game?: Medias.Game;
poll?: Medias.Poll;
venue?: Medias.Venue;
location?: Medias.Location;
webpage?: Medias.WebPage;
newChatMembers?: Array<Advanceds.User>;
leftChatMember?: Advanceds.User;
newChatTitle?: string;
newChatPhoto?: Medias.Photo;
deleteChatPhoto?: boolean;
groupChatCreated?: boolean;
channelChatCreated?: boolean;
messageAutoDeleteTimeChanged?: boolean;
migrateToChatId?: bigint;
migrateFromChatId?: bigint;
pinnedMessage?: Message;
invoice?: any;
successfulPayment?: any;
userShared?: any;
chatShared?: any;
connectedWebsite?: string;
writeAccessAllowed?: any;
passportData?: any;
forumTopicCreated?: Raw.MessageActionTopicCreate;
forumTopicEdited?: Raw.MessageActionTopicEdit;
videoChatScheduled?: Date;
videoChatEnded?: number;
videoChatStarted?: boolean;
videoChatParticipantInvalid?: any;
videoChatInvited?: Array<Advanceds.User>;
webAppData?: Advanceds.WebAppData;
replyMarkup?: ReplyMarkup.TypeReplyMarkup;
giftPremium?: Raw.MessageActionGiftPremium;
chatThemeChanged?: Raw.MessageActionSetChatTheme;
screenshot?: boolean;
ttl?: number;
replyToStoryId?: number;
repliedStoryFrom?: Advanceds.Chat;
linkPreviewOptions?: Medias.LinkPreviewOptions;
constructor({ id, outgoing, date, chat, from, threadId, senderChat, forwardFrom, forwardFromChat, forwardFromMessageId, forwardSignature, forwardSenderName, forwardDate, isTopicMessage, isAutomaticForward, replyToMessage, replyToMessageId, replyToTopMessageId, mentioned, empty, viaBot, hasProtectedContent, mediaGroupId, authorSignatrure, text, entities, animation, audio, document, photo, sticker, video, videoNote, voice, webpage, caption, captionEntities, hasSpoilerMode, contact, dice, game, poll, venue, location, newChatMembers, leftChatMember, newChatTitle, newChatPhoto, deleteChatPhoto, groupChatCreated, channelChatCreated, messageAutoDeleteTimeChanged, migrateToChatId, migrateFromChatId, pinnedMessage, invoice, successfulPayment, userShared, chatShared, connectedWebsite, writeAccessAllowed, passportData, forumTopicCreated, forumTopicEdited, videoChatScheduled, videoChatEnded, videoChatStarted, videoChatParticipantInvalid, videoChatInvited, webAppData, replyMarkup, giftPremium, chatThemeChanged, screenshot, ttl, replyToStoryId, repliedStoryFrom, linkPreviewOptions, }: TypeMessage, client: Snake);
static parse(client: Snake, message: Raw.TypeMessage, chats: Array<Raw.TypeChat>, users: Array<Raw.TypeUser>, replies?: number): Promise<Message>;
reply(text: string, more?: sendMessageParams): Promise<Message> | undefined;
respond(text: string, more?: sendMessageParams): Promise<Message> | undefined;
replyWithDoc(file: string | Buffer | Readable | Files.File, more?: sendDocumentParams): Promise<Message>;
rwd(file: string | Buffer | Readable | Files.File, more?: sendDocumentParams): Promise<Message>;
replyWithVideo(file: string | Buffer | Readable | Files.File, more?: sendVideoParams): Promise<Message>;
rwv(file: string | Buffer | Readable | Files.File, more?: sendVideoParams): Promise<Message>;
replyWithVideoNote(file: string | Buffer | Readable | Files.File, more?: sendVideoNoteParams): Promise<Message>;
rwvn(file: string | Buffer | Readable | Files.File, more?: sendVideoNoteParams): Promise<Message>;
replyWithAnimation(file: string | Buffer | Readable | Files.File, more?: sendAnimationParams): Promise<Message>;
rwa(file: string | Buffer | Readable | Files.File, more?: sendAnimationParams): Promise<Message>;
replyWithSticker(sticker: string | Buffer | Readable | Files.File, more?: sendStickerParams): Promise<Message>;
rws(sticker: string | Buffer | Readable | Files.File, more?: sendStickerParams): Promise<Message>;
click({ row, col, text, filter, callbackData, password, }: ClickButtonFn): Promise<Raw.TypeUpdates | Raw.messages.BotCallbackAnswer | undefined>;
}
export interface ClickButtonFn {
row?: number;
col?: number;
text?: string | {
(text: string, row: number, col: number): boolean | Promise<boolean>;
};
filter?: {
(keyboard: ReplyMarkup.replyKeyboardButton | ReplyMarkup.inlineKeyboardButton | string, row: number, col: number): boolean | Promise<boolean>;
};
callbackData?: string;
sharePhone?: boolean | string | Medias.Contact;
shareGeo?: {
latitude: number;
longitude: number;
} | Medias.Location;
password?: string;
}