import { Keyboard, ChatActions, ContentTypes, IAnswerCallbackQueryOptions, IForwardMessageOptions, ICopyMessageOptions, IStopMessageLiveLocationOptions, IMessage, IUpdate, IFile, IUserProfilePhotos, IMessageId, IChatPermissions, IPromoteChatPermissions, ICreateChatInviteLinkOptions, IChatInviteLink, Photo, IChat, ChatMember, IBotCommand, BotCommandScope, IChatAdministratorRights, IEditTextOptions, EditContentTypes, SendOptions, IStopPollOptions, IPoll } from '../..'; import { MessageCreator } from '../Message'; import { Api } from '../Api'; import { BotMenuButton } from '../../types/menu-button.types'; import { Handler } from '../Launch/Handler'; export declare class Answer { private readonly token; private readonly update; private readonly handler?; private readonly scopeController; readonly api: Api; constructor(token: string, update: IUpdate, handler?: Handler); /** * Enter scope * @param scopeId Scope id in which you want to enter user * @return true on success * */ scope(scopeId: string): Promise; /** * Leave scope * @return true on success * */ unscope(): Promise; /** * Enter view * @param viewId View id in which you want to enter user * @return true on success * */ view(viewId: string): Promise; /** * Sends a message to the chat where got update * @param content Message data that you want to send, some media (e.g. Photo class) or string for text message * @param keyboard Pass Keyboard class if you want to add keyboard to the message * @param moreOptions More options {@link SendOptions} * @see https://core.telegram.org/bots/api#sendmessage * */ send(content: MessageCreator | ContentTypes, keyboard?: Keyboard | null, moreOptions?: SendOptions): Promise; /** * Edit a message * @param content Content you want to edit (string or class-marks) * @param keyboard Optional. Pass Keyboard class if you want to add keyboard to the message * @param moreOptions Optional. More options {@link IEditTextOptions} * @param msgId Optional. Message ID you want to edit. Current message id by default * @see https://core.telegram.org/bots/api#editmessagemedia * */ edit(content: EditContentTypes, keyboard?: Keyboard, moreOptions?: IEditTextOptions, msgId?: number): Promise; /** * Delete a message * @param msgId Optional. Message ID you want to delete. Current message id by default * @param chatId Optional. Chat ID in which message you want to delete is located. Current chat id by default * @see https://core.telegram.org/bots/api#deletemessage * @return true on success * */ delete(msgId?: number | null, chatId?: number | string | null): Promise; /** * Stop a poll * @param keyboard Keyboard you want to edit * @param msgId Optional. Message ID of the poll you want to stop. Current message id by default * @param chatId Optional. Chat ID in which poll you want to stop is located. Current chat id by default * @param moreOptions More options {@link IStopPollOptions} * @see https://core.telegram.org/bots/api#stoppoll * */ stopPoll(keyboard?: Keyboard, msgId?: number | null, chatId?: number | string | null, moreOptions?: IStopPollOptions): Promise; /** * Setups chat action * @param action Action type {@link ChatActions} * @see https://core.telegram.org/bots/api#sendchataction * */ chatAction(action: ChatActions): Promise; /** * @param limit Limit of user profile photos * @param offset Skip user profile photos * @see https://core.telegram.org/bots/api#getuserprofilephotos * @return User profile photos * */ getUserProfilePhotos(limit?: number, offset?: number): Promise; /** * Stops message live location * @param keyboard Pass Keyboard class if you want to add keyboard to the message * @param moreOptions More options {@link IStopMessageLiveLocationOptions} * @see https://core.telegram.org/bots/api#editmessagelivelocation * */ stopLiveLocation(keyboard?: Keyboard | null, moreOptions?: IStopMessageLiveLocationOptions): Promise; /** * Alert * @param text Alert text * @param moreOptions More options {@link IAnswerCallbackQueryOptions} * @see https://core.telegram.org/bots/api#answercallbackquery * */ alert(text: string, moreOptions?: IAnswerCallbackQueryOptions): Promise; /** * Toast * @param text Toast text * @param moreOptions More options {@link IAnswerCallbackQueryOptions} * @see https://core.telegram.org/bots/api#answercallbackquery * */ toast(text: string, moreOptions?: IAnswerCallbackQueryOptions): Promise; /** * Returns info about the file * @param fileId File id that you want to get * @return {@link IFile} * @see https://core.telegram.org/bots/api#getfile * */ getFile(fileId: string): Promise; /** * Forwards got message * @param toChatId Chat id you want to forward to * @param moreOptions More options {@link IForwardMessageOptions} * @see https://core.telegram.org/bots/api#forwardmessage * */ forward(toChatId: number | string, moreOptions?: IForwardMessageOptions): Promise; /** * Copies got message * @param toChatId Chat id you want to copy to * @param keyboard Pass Keyboard class if you want to add keyboard to the message * @param moreOptions More options {@link ICopyMessageOptions} * @see https://core.telegram.org/bots/api#copymessage * */ copy(toChatId: number | string, keyboard?: Keyboard | null, moreOptions?: ICopyMessageOptions): Promise; /** * Ban chat member * @param untilDate Ban end date * @param revokeMessages Remove all messages by this user * @param userId User id you want to ban * @see https://core.telegram.org/bots/api#banchatmember * @return true on success * */ ban(untilDate?: number, revokeMessages?: boolean, userId?: number): Promise; /** * Unban chat member * @param onlyIfBanned Do nothing if the user is not banned * @param userId User id you want to ban * @see https://core.telegram.org/bots/api#unbanchatmember * @return true on success * */ unban(onlyIfBanned?: boolean, userId?: number): Promise; /** * Restrict chat member * @param permissions Permissions you grant to the user * @param userId User id you want to promote * @param chatId Chat id in which user you want to restrict is located * @param untilDate Ban end date * @see https://core.telegram.org/bots/api#restrictchatmember * @return true on success * */ restrict(permissions: IChatPermissions, userId?: number | null, chatId?: string | number | null, untilDate?: number): Promise; /** * Promote chat member * @param permissions Permissions you grant to the user * @param userId User id you want to promote * @see https://core.telegram.org/bots/api#promotechatmember * @return true on success * */ promote(permissions: IPromoteChatPermissions, userId?: number): Promise; /** * Export chat invite link * @param chatId Optional. ID of the chat you want to export invite link. Current chat id by default * @see https://core.telegram.org/bots/api#exportchatinvitelink * @return string Invite link on success * */ exportInviteLink(chatId?: number | string): Promise; /** * Creates chat invite link * @param moreOptions Message options {@link ICreateChatInviteLinkOptions} * @param chatId Optional. Chat ID where you want to create invite link. It can be id of group/channel or ID of the user. Current chat id by default * @see https://core.telegram.org/bots/api#createchatinvitelink * @return Chat invite link info {@link IChatInviteLink} * */ createInviteLink(moreOptions?: ICreateChatInviteLinkOptions, chatId?: number | string): Promise; /** * Revokes chat invite link * @param inviteLink Invite link you want to revoke * @param chatId Optional. Chat ID where you want to revoke invite link. It can be id of group/channel or ID of the user. Current chat id by default * @see https://core.telegram.org/bots/api#revokechatinvitelink * @return Chat invite link info {@link IChatInviteLink} * */ revokeInviteLink(inviteLink: string, chatId?: number | string): Promise; /** * Set chat photo * @param photo Photo you want to set (you can create it using Photo class) * @param chatId Optional. Chat ID where you want to set chat photo. It can be id of group/channel or ID of the user. Current chat id by default * @see https://core.telegram.org/bots/api#setchatphoto * @return true on success * */ setChatPhoto(photo: Photo, chatId?: number | string): Promise; /** * Deletes chat photo * @param chatId Optional. Chat ID where you want to delete chat photo. It can be id of group/channel or ID of the user. Current chat id by default * @see https://core.telegram.org/bots/api#deletechatphoto * @return true on success * */ deleteChatPhoto(chatId?: number | string): Promise; /** * Set chat title * @param title Title you want to set for the chat * @param chatId Optional. Chat ID where you want to set chat title. It can be id of group/channel or ID of the user. Current chat id by default * @see https://core.telegram.org/bots/api#setchattitle * @return true on success * */ setChatTitle(title: string, chatId?: number | string): Promise; /** * Set chat description * @param description Description you want to set for the chat * @param chatId Optional. Chat ID where you want to set chat description. It can be id of group/channel or ID of the user. Current chat id by default * @see https://core.telegram.org/bots/api#setchatdescription * @return true on success * */ setChatDescription(description: string, chatId?: number | string): Promise; /** * Pin chat message * @param msgId Optional. Message ID you want to pin. Current message id by default * @param chatId Optional. Chat ID where you want to pin message. It can be id of group/channel or ID of the user. Current chat id by default * @param disableNotification Optional. Disable notification for all chat users that you have pinned a message * @see https://core.telegram.org/bots/api#pinchatmessage * @return true on success * */ pin(msgId?: number | null, chatId?: number | string | null, disableNotification?: boolean): Promise; /** * Unpin chat message * @param msgId Message ID you want to unpin. Or pass 'all' to unpin all messages * @param chatId Optional. Chat ID where you want to unpin message. It can be id of group/channel or ID of the user. Current chat id by default * @see https://core.telegram.org/bots/api#unpinchatmessage * @return true on success * */ unpin(msgId?: number | 'all', chatId?: number | string): Promise; /** * Leaves chat * @param chatId Optional. Chat ID you want to leave. Current chat id by default * @see https://core.telegram.org/bots/api#leavechat * @return true on success * */ leave(chatId?: number | string): Promise; /** * Get chat * @param chatId Optional. Chat ID you want to get. Current chat id by default * @see https://core.telegram.org/bots/api#getchat * @return Chat info on success {@link IChat} * */ getChat(chatId?: number | string): Promise; /** * Get chat administrators * @param chatId Optional. Chat ID in which you want to get administrators. Current chat id by default * @see https://core.telegram.org/bots/api#getchatadministrators * @return Array of {@link ChatMember} * */ getChatAdmins(chatId?: number | string): Promise; /** * Get chat member count * @param chatId Optional. Chat ID in which you want to get member count. Current chat id by default * @see https://core.telegram.org/bots/api#getchatmembercount * @return {number} * */ getChatMemberCount(chatId?: number | string): Promise; /** * Get chat member * @param userId Optional. User id you want to get chat member info. Current user id by default * @param chatId Optional. Chat ID in which you want to get member info. Current chat id by default * @see https://core.telegram.org/bots/api#getchatmember * @return {@link ChatMember} * */ getChatMember(userId?: number, chatId?: number | string): Promise; /** * Set chat sticker set * @param stickerSetName Sticker set name you want to set * @param chatId Optional. Chat ID you want to set sticker set. Current chat id by default * @see https://core.telegram.org/bots/api#setchatstickerset * @return {true} on success * */ setChatStickerSet(stickerSetName: string, chatId?: number | string): Promise; /** * Delete chat sticker set * @param chatId Optional. Chat ID you want to delete sticker set. Current chat id by default * @see https://core.telegram.org/bots/api#deletechatstickerset * @return {true} on success * */ deleteChatStickerSet(chatId?: number | string): Promise; /** * Set my commands * @param commands Commands you want to set (Array of {@link IBotCommand}) * @param scope Optional. Scope for which you want to set commands. {@link BotCommandScope} * @param languageCode Optional. A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands * @see https://core.telegram.org/bots/api#setmycommands * @see https://core.telegram.org/bots#commands * @return {true} on success * */ setMyCommands(commands: IBotCommand[], scope?: BotCommandScope, languageCode?: string): Promise; /** * Delete my commands * @param scope Optional. Scope for which you want to delete commands. {@link BotCommandScope} * @param languageCode Optional. A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands * @see https://core.telegram.org/bots/api#deletemycommands * @return {true} on success * */ deleteMyCommands(scope?: BotCommandScope, languageCode?: string): Promise; /** * Get my commands * @param scope Optional. Scope for which you want to get commands. {@link BotCommandScope} * @param languageCode Optional. A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands * @see https://core.telegram.org/bots/api#getmycommands * @return Array of {@link IBotCommand} on success * */ getMyCommands(scope?: BotCommandScope, languageCode?: string): Promise; /** * Set chat menu button * @param menuButton Optional. Menu button you want to set ({@link BotMenuButton}) * @param chatId Optional. Chat ID in which you want to set menu button. It can be id of group/channel or ID of the user. Or pass '_current' to set chat menu button for current chat * @see https://core.telegram.org/bots/api#setchatmenubutton * @return {true} on success * */ setMenuButton(menuButton?: BotMenuButton, chatId?: number | string | '_current'): Promise; /** * Get chat menu button * @param chatId Optional. Chat ID in which you want to get menu button. It can be id of group/channel or ID of the user. Or pass '_current' to get chat menu button from current chat * @see https://core.telegram.org/bots/api#getchatmenubutton * @return {@link BotMenuButton} on success * */ getMenuButton(chatId?: number | string | '_current'): Promise; /** * Set my default administrator rights * @param rights Optional. Rights you want to set as default * @param forChannels Optional. Pass true to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be changed * @see https://core.telegram.org/bots/api#setmydefaultadministratorrights * @return {true} on success * */ setMyDefaultAdminRights(rights?: IChatAdministratorRights, forChannels?: boolean): Promise; /** * Get my default administrator rights * @param forChannels Optional. Pass true to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned * @see https://core.telegram.org/bots/api#getmydefaultadministratorrights * @return {@link IChatAdministratorRights} on success * */ getMyDefaultAdminRights(forChannels?: boolean): Promise; /** * Approves chat join request * @param userId User ID you want to approve join request * @param chatId Optional. Chat ID where you want to approve join request. It can be id of group/channel or ID of the user. Current chat id by default * @see https://core.telegram.org/bots/api#approvechatjoinrequest * @return true on success * */ approveJoinRequest(userId: number, chatId?: number | string): Promise; /** * Declines chat join request * @param userId User ID you want to decline join request * @param chatId Optional. Chat ID where you want to decline join request. It can be id of group/channel or ID of the user. Current chat id by default * @see https://core.telegram.org/bots/api#declinechatjoinrequest * @return true on success * */ declineJoinRequest(userId: number, chatId?: number | string): Promise; /** * Set chat permissions * @param permissions Chat permissions you want to set {@link IChatPermissions} * @see https://core.telegram.org/bots/api#setchatpermissions * @return true on success * */ setChatPermissions(permissions: IChatPermissions): Promise; /** * Set admin custom title * @param title Admin custom title (status, post, job title. 0-16 characters, emoji are not allowed) * @param userId User id you want to set a custom title for * @see https://core.telegram.org/bots/api#setchatadministratorcustomtitle * @return true on success * */ adminTitle(title: string, userId?: number): Promise; /** * Ban chat sender chat * @param senderChatId Optional. Chat id you want to ban * @see https://core.telegram.org/bots/api#banchatsenderchat * @return true on success * */ banChat(senderChatId?: number): Promise; /** * Unban chat sender chat * @param senderChatId Optional. Chat id you want to ban * @see https://core.telegram.org/bots/api#unbanchatsenderchat * @return true on success * */ unbanChat(senderChatId?: number): Promise; /** * Checks user subscription for channels/groups * @param channelIds Id of the channels/groups you want to check subscription * @return true if user subscribed for every channels * */ checkSubscription(...channelIds: (string | number)[]): Promise; /** * Saves user profile photo * @param path Path where you want to save the image * @param index Index of the user profile photo you want to save (0 by default) * @return true if saved success * */ saveProfilePhoto(path: string, index?: number): Promise; /** * Saves any media was sent * @param path Path where you want to save the media file * @param fileId Id of the file you want to download * @return true if saved success * */ saveFile(path: string, fileId?: string): Promise; }