Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

puregram

Package Overview
Dependencies
Maintainers
1
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

puregram - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

src/contexts/callback-query.d.ts

2

package.json
{
"name": "puregram",
"version": "1.1.2",
"version": "1.1.3",
"main": "src/index.js",

@@ -5,0 +5,0 @@ "repository": {

@@ -77,3 +77,3 @@ let { inspect } = require('util');

async reply(text, params = {}) {
return this.send(text = '',{
return this.send(text, {
reply_to_message_id: this.message.id,

@@ -232,2 +232,14 @@ ...params,

async stopMessageLiveLocation(params = {}) {
let response = await this.telegram.api.stopMessageLiveLocation({
chat_id: this.chatId,
message_id: this.id,
...params,
});
return response === true
? true
: new MessageContext(this.telegram, response);
}
async sendVenue(venue, params = {}) {

@@ -277,2 +289,9 @@ let response = await this.telegram.api.sendVenue({

replyWithPoll(poll, params = {}) {
return this.sendPoll(poll, {
reply_to_message_id: this.id,
...params,
});
}
async stopPoll(id, params = {}) {

@@ -279,0 +298,0 @@ let response = await this.telegram.api.stopPoll({

@@ -67,3 +67,3 @@ let { inspect } = require('util');

async reply(text, params = {}) {
return this.send(text = '',{
return this.send(text, {
reply_to_message_id: this.id,

@@ -222,2 +222,14 @@ ...params,

async stopMessageLiveLocation(params = {}) {
let response = await this.telegram.api.stopMessageLiveLocation({
chat_id: this.chatId,
message_id: this.id,
...params,
});
return response === true
? true
: new MessageContext(this.telegram, response);
}
async sendVenue(venue, params = {}) {

@@ -267,2 +279,9 @@ let response = await this.telegram.api.sendVenue({

replyWithPoll(poll, params = {}) {
return this.sendPoll(poll, {
reply_to_message_id: this.id,
...params,
});
}
async stopPoll(id, params = {}) {

@@ -269,0 +288,0 @@ let response = await this.telegram.api.stopPoll({

@@ -51,3 +51,3 @@ let { inspect } = require('util');

get isOutbox() {
return this.from
return this.from;
}

@@ -376,3 +376,3 @@

async reply(text, params = {}) {
return this.send(text = '',{
return this.send(text, {
reply_to_message_id: this.id,

@@ -531,2 +531,14 @@ ...params,

async stopMessageLiveLocation(params = {}) {
let response = await this.telegram.api.stopMessageLiveLocation({
chat_id: this.chatId,
message_id: this.id,
...params,
});
return response === true
? true
: new MessageContext(this.telegram, response);
}
async sendVenue(venue, params = {}) {

@@ -576,2 +588,9 @@ let response = await this.telegram.api.sendVenue({

replyWithPoll(poll, params = {}) {
return this.sendPoll(poll, {
reply_to_message_id: this.id,
...params,
});
}
replyWithContact(poll, params = {}) {

@@ -578,0 +597,0 @@ return this.sendPoll(poll, {

@@ -65,3 +65,3 @@ let { inspect } = require('util');

async reply(text, params = {}) {
return this.send(text = '',{
return this.send(text, {
reply_to_message_id: this.id,

@@ -220,2 +220,14 @@ ...params,

async stopMessageLiveLocation(params = {}) {
let response = await this.telegram.api.stopMessageLiveLocation({
chat_id: this.chatId,
message_id: this.id,
...params,
});
return response === true
? true
: new MessageContext(this.telegram, response);
}
async sendVenue(venue, params = {}) {

@@ -265,2 +277,9 @@ let response = await this.telegram.api.sendVenue({

replyWithPoll(poll, params = {}) {
return this.sendPoll(poll, {
reply_to_message_id: this.id,
...params,
});
}
async stopPoll(id, params = {}) {

@@ -267,0 +286,0 @@ let response = await this.telegram.api.stopPoll({

@@ -375,3 +375,3 @@ let { inspect } = require('util');

async reply(text, params = {}) {
return this.send(text = '',{
return this.send(text, {
reply_to_message_id: this.id,

@@ -530,2 +530,14 @@ ...params,

async stopMessageLiveLocation(params = {}) {
let response = await this.telegram.api.stopMessageLiveLocation({
chat_id: this.chatId,
message_id: this.id,
...params,
});
return response === true
? true
: new MessageContext(this.telegram, response);
}
async sendVenue(venue, params = {}) {

@@ -575,2 +587,9 @@ let response = await this.telegram.api.sendVenue({

replyWithPoll(poll, params = {}) {
return this.sendPoll(poll, {
reply_to_message_id: this.id,
...params,
});
}
replyWithContact(poll, params = {}) {

@@ -577,0 +596,0 @@ return this.sendPoll(poll, {

@@ -375,3 +375,3 @@ let { inspect } = require('util');

async reply(text, params = {}) {
return this.send(text = '',{
return this.send(text, {
reply_to_message_id: this.id,

@@ -530,2 +530,14 @@ ...params,

async stopMessageLiveLocation(params = {}) {
let response = await this.telegram.api.stopMessageLiveLocation({
chat_id: this.chatId,
message_id: this.id,
...params,
});
return response === true
? true
: new MessageContext(this.telegram, response);
}
async sendVenue(venue, params = {}) {

@@ -575,2 +587,9 @@ let response = await this.telegram.api.sendVenue({

replyWithPoll(poll, params = {}) {
return this.sendPoll(poll, {
reply_to_message_id: this.id,
...params,
});
}
replyWithContact(poll, params = {}) {

@@ -577,0 +596,0 @@ return this.sendPoll(poll, {

@@ -65,3 +65,3 @@ let { inspect } = require('util');

async reply(text, params = {}) {
return this.send(text = '',{
return this.send(text, {
reply_to_message_id: this.id,

@@ -220,2 +220,14 @@ ...params,

async stopMessageLiveLocation(params = {}) {
let response = await this.telegram.api.stopMessageLiveLocation({
chat_id: this.chatId,
message_id: this.id,
...params,
});
return response === true
? true
: new MessageContext(this.telegram, response);
}
async sendVenue(venue, params = {}) {

@@ -265,2 +277,9 @@ let response = await this.telegram.api.sendVenue({

replyWithPoll(poll, params = {}) {
return this.sendPoll(poll, {
reply_to_message_id: this.id,
...params,
});
}
async stopPoll(id, params = {}) {

@@ -267,0 +286,0 @@ let response = await this.telegram.api.stopPoll({

@@ -54,3 +54,3 @@ let { inspect } = require('util');

async send(text = '',params = {}) {
async send(text = '', params = {}) {
let response = await this.telegram.api.sendMessage({

@@ -66,3 +66,3 @@ chat_id: this.chatId || this.senderId,

async reply(text, params = {}) {
return this.send(text = '',{
return this.send(text, {
reply_to_message_id: this.id,

@@ -221,2 +221,14 @@ ...params,

async stopMessageLiveLocation(params = {}) {
let response = await this.telegram.api.stopMessageLiveLocation({
chat_id: this.chatId,
message_id: this.id,
...params,
});
return response === true
? true
: new MessageContext(this.telegram, response);
}
async sendVenue(venue, params = {}) {

@@ -266,2 +278,9 @@ let response = await this.telegram.api.sendVenue({

replyWithPoll(poll, params = {}) {
return this.sendPoll(poll, {
reply_to_message_id: this.id,
...params,
});
}
async stopPoll(id, params = {}) {

@@ -268,0 +287,0 @@ let response = await this.telegram.api.stopPoll({

@@ -1,167 +0,645 @@

import { ITelegramParams, ISendMessageParams } from '../../typings/params';
import { ChatTypes, AttachmentTypes } from '../../typings/types';
import Params from '../../typings/params';
import Types from '../../typings/types';
import Interfaces from '../../typings/interfaces';
import Context from './context';
import ReplyMessageContext from './reply-message';
import User from '../structures/user';
import Chat from '../structures/chat';
import Audio from '../structures/audio';
import Document from '../structures/document';
import Animation from '../structures/animation';
import Game from '../structures/game';
import MessageEntity from '../structures/message-entity';
import PhotoSize from '../structures/photo-size';
import Sticker from '../structures/sticker';
import Video from '../structures/video';
import Voice from '../structures/voice';
import VideoNote from '../structures/video-note';
import Contact from '../structures/contact';
import Location from '../structures/location';
import Venue from '../structures/venue';
import Poll from '../structures/poll';
import Invoice from '../structures/invoice';
import SuccessfulPayment from '../structures/successful-payment';
type Attachment =
| Audio | Document | Animation
| Game | PhotoSize | Sticker
| Video | Voice | VideoNote
| Contact | Location | Venue
| Poll;
| Interfaces.IAudio
| Interfaces.IDocument
| Interfaces.IAnimation
| Interfaces.IGame
| Interfaces.IPhotoSize
| Interfaces.ISticker
| Interfaces.IVideo
| Interfaces.IVoice
| Interfaces.IVideoNote
| Interfaces.IContact
| Interfaces.ILocation
| Interfaces.IVenue
| Interfaces.IPoll;
type MessageOrTrue = MessageContext | true;
declare class MessageContext extends Context {
public constructor(telegram: ITelegramParams, update: object);
public constructor(telegram: Params.ITelegramParams, update: object);
/**
* Unique message identifier inside this chat
*/
public id: number;
/**
* Sender, empty for messages sent to channels
*/
public from: User;
/**
* Sender's unique id
*/
public senderId: number;
/**
* Is message sent by bot?
*/
public isOutbox: boolean;
/**
* Date the message was sent in Unix time
*/
public date: number;
public chat: Chat;
/**
* Conversation the message belongs to
*/
public chat: Interfaces.IChat;
/**
* Chat's id
*/
public chatId: number;
public chatType: ChatTypes;
/**
* Chat's type
*/
public chatType: Types.ChatTypes;
public forwardFrom?: User;
/**
* For forwarded messages, sender of the original message
*/
public forwardFrom?: Interfaces.IUser;
public forwardFromChat?: User;
/**
* For messages forwarded from channels, information about the original channel
*/
public forwardFromChat?: Interfaces.IUser;
/**
* For messages forwarded from channels, identifier of the original message in the channel
*/
public forwardFromMessageId?: number;
/**
* For messages forwarded from channels, signature of the post author if present
*/
public forwardSignature?: string;
/**
* Sender's name for messages forwarded from users
* who disallow adding a link to their account in forwarded messages
*/
public forwardSenderName?: string;
/**
* For forwarded messages, date the original message was sent in Unix time
*/
public forwardDate?: number;
/**
* Is message a forwarded one?
*/
public isForward: boolean;
public replyMessage?: ReplyMessageContext;
/**
* For replies, the original message.
* Note that the Message object in this field will not contain further
* `reply_to_message` fields even if it itself is a reply.
*/
public replyMessage?: Interfaces.IMessage;
/**
* Date the message was last edited in Unix time
*/
public editDate?: number;
/**
* The unique identifier of a media message group this message belongs to
*/
public mediaGroupId?: string;
/**
* Signature of the post author for messages in channels
*/
public authorSignature?: string;
/**
* For text messages, the actual UTF-8 text of the message, 0-4096 characters
*/
public text?: string;
public entities?: Array<MessageEntity>;
/**
* For text messages, special entities like usernames,
* URLs, bot commands, etc. that appear in the text
*/
public entities?: Array<Interfaces.IMessageEntity>;
/**
* Does message have any entities?
*/
public hasEntities: boolean;
public captionEntities?: Array<MessageEntity>;
/**
* For messages with a caption, special entities like usernames,
* URLs, bot commands, etc. that appear in the caption
*/
public captionEntities?: Array<Interfaces.IMessageEntity>;
public audio?: Audio;
/**
* Message is an audio file, information about the file
*/
public audio?: Interfaces.IAudio;
public document?: Document;
/**
* Message is a general file, information about the file
*/
public document?: Interfaces.IDocument;
public animation?: Animation;
/**
* Message is an animation, information about the animation.
* For backward compatibility, when this field is set, the `document` field will also be set
*/
public animation?: Interfaces.IAnimation;
public game?: Game;
/**
* Message is a game, information about the game
*/
public game?: Interfaces.IGame;
public audio?: Audio;
/**
* Message is a photo, available sizes of the photo
*/
public photo?: Array<Interfaces.IPhotoSize>;
public photo?: Array<PhotoSize>;
/**
* Message is a sticker, information about the sticker
*/
public sticker?: Interfaces.ISticker;
public sticker?: Sticker;
/**
* Message is a video, information about the video
*/
public video?: Interfaces.IVideo;
public video?: Video;
/**
* Message is a voice message, information about the file
*/
public voice?: Interfaces.IVoice;
public voice?: Voice;
/**
* Message is a video note, information about the video message
*/
public videoNote?: Interfaces.IVideoNote;
public videoNote?: VideoNote;
/**
* Caption for the animation, audio, document, photo, video or voice, 0-1024 characters
*/
public caption?: string;
public contact?: Contact;
/**
* Message is a shared contact, information about the contact
*/
public contact?: Interfaces.IContact;
public location?: Location;
/**
* Message is a shared location, information about the location
*/
public location?: Interfaces.ILocation;
public venue?: Venue;
/**
* Message is a venue, information about the venue
*/
public venue?: Interfaces.IVenue;
public poll?: Poll;
/**
* Message is a native poll, information about the poll
*/
public poll?: Interfaces.IPoll;
/**
* Message is a dice with random value from `1` to `6`
*/
public dice?: Interfaces.IDice;
/**
*
*/
public attachments: Array<Attachment>;
public hasAttachments(type?: AttachmentTypes): boolean;
/**
* Checks for the presence of attachments
*/
public hasAttachments(type?: Types.AttachmentTypes): boolean;
public getAttachments(type?: AttachmentTypes): boolean;
/**
* Returns the attachments
*/
public getAttachments(type: 'audio'): Array<Interfaces.IAudio>;
public newChatMembers?: Array<User>;
public getAttachments(type: 'document'): Array<Interfaces.IDocument>;
public leftChatMember?: User;
public getAttachments(type: 'animation'): Array<Interfaces.IAnimation>;
public getAttachments(type: 'game'): Array<Interfaces.IGame>;
public getAttachments(type: 'photo'): Array<Array<Interfaces.IPhotoSize>>;
public getAttachments(type: 'sticker'): Array<Interfaces.ISticker>;
public getAttachments(type: 'video'): Array<Interfaces.IVideo>;
public getAttachments(type: 'voice'): Array<Interfaces.IVoice>;
public getAttachments(type: 'video_note' | 'videoNote'): Array<Interfaces.IVideoNote>;
public getAttachments(type: 'contact'): Array<Interfaces.IContact>;
public getAttachments(type: 'location'): Array<Interfaces.ILocation>;
public getAttachments(type: 'venue'): Array<Interfaces.IVenue>;
public getAttachments(type: 'poll'): Array<Interfaces.IPoll>;
public getAttachments(type?: Types.AttachmentTypes): boolean;
/**
* New members that were added to the group or supergroup
* and information about them (the bot itself may be one of these members)
*/
public newChatMembers?: Array<Interfaces.IUser>;
/**
* A member was removed from the group,
* information about them (this member may be the bot itself)
*/
public leftChatMember?: Interfaces.IUser;
/**
* A chat title was changed to this value
*/
public newChatTitle?: string;
public newChatPhoto?: Array<PhotoSize>;
/**
* A chat photo was change to this value
*/
public newChatPhoto?: Array<Interfaces.IPhotoSize>;
/**
* Service message: the chat photo was deleted
*/
public deleteChatPhoto?: true;
/**
* Service message: the group has been created
*/
public groupChatCreated?: true;
/**
* Service message: the supergroup has been created.
* This field can‘t be received in a message coming through updates,
* because bot can’t be a member of a supergroup when it is created.
* It can only be found in `reply_to_message` if someone replies to
* a very first message in a directly created supergroup.
*/
public supergroupChatCreated?: true;
/**
* Service message: the channel has been created.
* This field can‘t be received in a message coming through updates,
* because bot can’t be a member of a channel when it is created.
* It can only be found in `reply_to_message` if someone replies to
* a very first message in a channel.
*/
public channelChatCreated?: true;
/**
* The group has been migrated to a supergroup with the specified identifier.
* This number may be greater than 32 bits and some programming languages
* may have difficulty/silent defects in interpreting it.
* But it is smaller than 52 bits,
* so a signed 64 bit integer or double-precision float type are
* safe for storing this identifier.
*/
public migrateToChatId?: number;
/**
* The supergroup has been migrated from a group with the specified identifier.
* This number may be greater than 32 bits and some programming languages
* may have difficulty/silent defects in interpreting it.
* But it is smaller than 52 bits, so a signed 64 bit integer or
* double-precision float type are safe for storing this identifier.
*/
public migrateFromChatId?: number;
public pinnedMessage?: MessageContext;
/**
* Specified message was pinned.
* Note that the `Message` object in this field will not contain further
* `reply_to_message` fields even if it is itself a reply.
*/
public pinnedMessage?: Interfaces.IMessage;
public invoice?: Invoice;
/**
* Message is an invoice for a payment, information about the invoice
*/
public invoice?: Interfaces.IInvoice;
public successfulPayment?: SuccessfulPayment;
/**
* Message is a service message about a successful payment,
* information about the payment
*/
public successfulPayment?: Interfaces.ISuccessfulPayment;
/**
* The domain name of the website on which the user has logged in
*/
public connectedWebsite?: string;
public passportData?: PassportData;
/**
* Telegram Passport data
*/
public passportData?: Interfaces.IPassportData;
public replyMarkup?: InlineKeyboardMarkup;
/**
* Inline keyboard attached to the message.
* `login_url` buttons are represented as ordinary `url` buttons.
*/
public replyMarkup?: Interfaces.IInlineKeyboardMarkup;
/**
* Is this an event?
*/
public isEvent: boolean;
/**
* Event type
*/
public eventType?: string;
/**
* Does the message have text?
*/
public hasText: boolean;
/**
* Does the message have forward messages?
*/
public hasForward: boolean;
/**
* Is this message sent to the private messages?
*/
public isPM: boolean;
public send(text: string, params: ISendMessageParams): Promise<MessageContext>;
/**
* Use this method to send text messages.
*
* On success, the sent `Message` is returned.
*/
public send(text: string, params: Params.ISendMessageParams): Promise<MessageContext>;
public reply(text: string, params: ISendMessageParams): Promise<MessageContext>;
public reply(text: string, params: Params.ISendMessageParams): Promise<MessageContext>;
public sendPhoto(text: string, params: ISendMessageParams): Promise<MessageContext>;
/**
* Use this method to send photos.
*
* On success, the sent `Message` is returned.
*/
public sendPhoto(photo: string, params: Params.ISendPhotoParams): Promise<MessageContext>;
public replyWithPhoto(photo: string, params: Params.ISendPhotoParams): Promise<MessageContext>;
/**
* Use this method to send audio files,
* if you want Telegram clients to display them in the music player.
* Your audio must be in the .MP3 or .M4A format.
*
* On success, the sent `Message` is returned.
*
* Bots can currently send audio files of up to 50 MB in size,
* this limit may be changed in the future.
*
* For sending voice messages, use the `sendVoice` method instead.
*/
public sendAudio(audio: string, params: Params.ISendAudioParams): Promise<MessageContext>;
public replyWithAudio(audio: string, params: Params.ISendAudioParams): Promise<MessageContext>;
/**
* Use this method to send video files,
* Telegram clients support mp4 videos
* (other formats may be sent as `Document`).
*
* On success, the sent `Message` is returned.
*
* Bots can currently send video files of up to 50 MB in size,
* this limit may be changed in the future.
*/
public sendVideo(video: string, params: Params.ISendVideoParams): Promise<MessageContext>;
public replyWithVideo(video: string, params: Params.ISendVideoParams): Promise<MessageContext>;
/**
* Use this method to send animation files
* (GIF or H.264/MPEG-4 AVC video without sound).
*
* On success, the sent `Message` is returned.
*
* Bots can currently send animation files of up to 50 MB in size,
* this limit may be changed in the future.
*/
public sendAnimation(animation: string, params: Params.ISendAnimationParams): Promise<MessageContext>;
public replyWithAnimation(animation: string, params: Params.ISendAnimationParams): Promise<MessageContext>;
/**
* As of v.4.0, Telegram clients support rounded square mp4 videos
* of up to 1 minute long.
* Use this method to send video messages.
*
* On success, the sent `Message` is returned.
*/
public sendVideoNote(videoNote: string, params: Params.ISendVideoNoteParams): Promise<MessageContext>;
public replyWithVideoNote(videoNote: string, params: Params.ISendVideoNoteParams): Promise<MessageContext>;
/**
* Use this method to send audio files,
* if you want Telegram clients to display the file as a playable voice message.
* For this to work, your audio must be in an .OGG file encoded with OPUS
* (other formats may be sent as `Audio` or `Document`).
*
* On success, the sent `Message` is returned.
*
* Bots can currently send voice messages of up to 50 MB in size,
* this limit may be changed in the future.
*/
public sendVoice(voice: string, params: Params.ISendVoiceParams): Promise<MessageContext>;
public replyWithVoice(voice: string, params: Params.ISendVoiceParams): Promise<MessageContext>;
/**
* Use this method to send a group of photos or videos as an album.
*
* On success, an `Array<Message>` is returned.
*/
public sendMediaGroup(mediaGroup: string, params: Params.ISendMediaGroupParams): Promise<MessageContext>;
public replyWithMediaGroup(mediaGroup: string, params: Params.ISendMediaGroupParams): Promise<MessageContext>;
/**
* Use this method to send point on the map.
*
* On success, the sent `Message` is returned.
*/
public sendLocation(location: string, params: Params.ISendLocationParams): Promise<MessageContext>;
public replyWithLocation(location: string, params: Params.ISendLocationParams): Promise<MessageContext>;
/**
* Use this method to send information about a venue.
*
* On success, the sent `Message` is returned.
*/
public sendVenue(venue: string, params: Params.ISendVenueParams): Promise<MessageContext>;
public replyWithVenue(venue: string, params: Params.ISendVenueParams): Promise<MessageContext>;
/**
* Use this method to send phone contacts.
*
* On success, the sent `Message` is returned.
*/
public sendContact(contact: string, params: Params.ISendContactParams): Promise<MessageContext>;
public replyWithContact(contact: string, params: Params.ISendContactParams): Promise<MessageContext>;
/**
* Use this method to send a native poll.
*
* On success, the sent `Message` is returned.
*/
public sendPoll(poll: string, params: Params.ISendPollParams): Promise<MessageContext>;
public replyWithPoll(poll: string, params: Params.ISendPollParams): Promise<MessageContext>;
/**
* Use this method to stop a poll which was sent by the bot.
*
* On success, the stopped `Poll` with the final results is returned.
*/
public stopPoll(id: string, params: Params.IStopPollParams): Promise<MessageContext>;
/**
* Use this method when you need to tell the user that
* something is happening on the bot's side.
* The status is set for 5 seconds or less
* (when a message arrives from your bot,
* Telegram clients clear its typing status).
*
* Returns `True` on success.
*/
public sendChatAction(action: Types.ChatActions, params: Params.ISendChatActionParams): Promise<true>;
/**
* Use this method to edit text and game messages.
*
* On success, if edited message is sent by the bot,
* the edited `Message` is returned,
* otherwise `True` is returned.
*/
public editMessageText(text: string, params: Params.IEditMessageTextParams): Promise<MessageOrTrue>;
/**
* Use this method to edit captions of messages.
*
* On success, if edited message is sent by the bot,
* the edited `Message` is returned,
* otherwise `True` is returned.
*/
public editMessageCaption(caption: string, params: Params.IEditMessageCaptionParams): Promise<MessageOrTrue>;
/**
* Use this method to edit animation, audio, document,
* photo, or video messages.
* If a message is a part of a message album,
* then it can be edited only to a photo or a video.
* Otherwise, message type can be changed arbitrarily.
* When inline message is edited, new file can't be uploaded.
* Use previously uploaded file via its `file_id` or specify a `URL`.
*
* On success, if the edited message was sent by the bot,
* the edited `Message` is returned,
* otherwise `True` is returned.
*/
public editMessageMedia(media: string, params: Params.IEditMessageMediaParams): Promise<MessageOrTrue>;
/**
* Use this method to edit only the reply markup of messages.
*
* On success, if edited message is sent by the bot,
* the edited `Message` is returned,
* otherwise `True` is returned.
*/
public editMessageReplyMarkup(replymarkup: string, params: Params.IEditMessageReplyMarkupParams): Promise<MessageOrTrue>;
/**
* Use this method to delete a message, including service messages, with the following limitations:
* - A message can only be deleted if it was sent less than 48 hours ago.
* - Bots can delete outgoing messages in private chats, groups, and supergroups.
* - Bots can delete incoming messages in private chats.
* - Bots granted can_post_messages permissions can delete outgoing messages in channels.
* - If the bot is an administrator of a group, it can delete any message there.
* - If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.
*
* Returns `True` on success.
*/
public deleteMessage(params: Params.IDeleteMessageParams): Promise<true>;
/**
* Use this method to send static .WEBP or animated .TGS stickers.
*
* On success, the sent `Message` is returned.
*/
public sendSticker(sticker: Interfaces.IInputFile | string, params: Params.ISendStickerParams): Promise<MessageContext>;
/**
* Use this method to send a dice, which will have a random value from `1` to `6`.
*
* On success, the sent `Message` is returned.
*/
public sendDice(params: Params.ISendDiceParams): Promise<MessageContext>;
/**
* Use this method to get the current list of the bot's commands.
*
* Returns `Array<BotCommand>` on success.
*/
public getMyCommands(): Promise<Array<Interfaces.IBotCommand>>;
/**
* Use this method to change the list of the bot's commands.
*
* Returns `True` on success.
*/
public setMyCommands(commands: Array<Interfaces.IBotCommand>): Promise<true>;
/**
* Use this method to edit live location messages.
* A location can be edited until its live_period expires
* or editing is explicitly disabled by a call to `stopMessageLiveLocation`.
*
* On success, if the edited message was sent by the bot,
* the edited `Message` is returned, otherwise `True` is returned.
*/
public editMessageLiveLocation(params: Params.IEditMessageLiveLocationParams): Promise<MessageOrTrue>;
/**
* Use this method to stop updating a live location message
* before live_period expires.
*
* On success, if the message was sent by the bot,
* the sent `Message` is returned, otherwise `True` is returned.
*/
public stopMessageLiveLocation(params: Params.IStopMessageLiveLocationParams): Promise<MessageOrTrue>;
}
export = MessageContext;

@@ -388,3 +388,3 @@ let { inspect } = require('util');

reply(text, params = {}) {
return this.send(text = '',{
return this.send(text, {
reply_to_message_id: this.id,

@@ -538,7 +538,19 @@ ...params,

return response !== true
? new MessageContext(this.telegram, response)
: true;
return response === true
? true
: new MessageContext(this.telegram, response);
}
async stopMessageLiveLocation(params = {}) {
let response = await this.telegram.api.stopMessageLiveLocation({
chat_id: this.chatId,
message_id: this.id,
...params,
});
return response === true
? true
: new MessageContext(this.telegram, response);
}
async sendVenue(venue, params = {}) {

@@ -588,2 +600,9 @@ let response = await this.telegram.api.sendVenue({

replyWithPoll(poll, params = {}) {
return this.sendPoll(poll, {
reply_to_message_id: this.id,
...params,
});
}
async stopPoll(id, params = {}) {

@@ -599,9 +618,2 @@ let response = await this.telegram.api.stopPoll({

replyWithContact(poll, params = {}) {
return this.sendPoll(poll, {
reply_to_message_id: this.id,
...params,
});
}
async sendChatAction(action, params = {}) {

@@ -623,5 +635,5 @@ return this.telegram.api.sendChatAction({

return response !== true
? new MessageContext(this.telegram, response)
: true;
return response === true
? true
: new MessageContext(this.telegram, response);
}

@@ -637,5 +649,5 @@

return response !== true
? new MessageContext(this.telegram, response)
: true;
return response === true
? true
: new MessageContext(this.telegram, response);
}

@@ -651,5 +663,5 @@

return response !== true
? new MessageContext(this.telegram, response)
: true;
return response === true
? true
: new MessageContext(this.telegram, response);
}

@@ -665,5 +677,5 @@

return response !== true
? new MessageContext(this.telegram, response)
: true;
return response === true
? true
: new MessageContext(this.telegram, response);
}

@@ -670,0 +682,0 @@

@@ -67,3 +67,3 @@ let { inspect } = require('util');

async reply(text, params = {}) {
return this.send(text = '',{
return this.send(text, {
reply_to_message_id: this.id,

@@ -222,2 +222,14 @@ ...params,

async stopMessageLiveLocation(params = {}) {
let response = await this.telegram.api.stopMessageLiveLocation({
chat_id: this.chatId,
message_id: this.id,
...params,
});
return response === true
? true
: new MessageContext(this.telegram, response);
}
async sendVenue(venue, params = {}) {

@@ -267,2 +279,9 @@ let response = await this.telegram.api.sendVenue({

replyWithPoll(poll, params = {}) {
return this.sendPoll(poll, {
reply_to_message_id: this.id,
...params,
});
}
async stopPoll(id, params = {}) {

@@ -269,0 +288,0 @@ let response = await this.telegram.api.stopPoll({

@@ -51,2 +51,8 @@ let { inspect } = require('util');

get eventPhoto() {
return this.update.new_chat_photo.map(
member => new PhotoSize(member),
);
}
async send(text = '',params = {}) {

@@ -63,3 +69,3 @@ let response = await this.telegram.api.sendMessage({

async reply(text, params = {}) {
return this.send(text = '',{
return this.send(text, {
reply_to_message_id: this.id,

@@ -218,2 +224,14 @@ ...params,

async stopMessageLiveLocation(params = {}) {
let response = await this.telegram.api.stopMessageLiveLocation({
chat_id: this.chatId,
message_id: this.id,
...params,
});
return response === true
? true
: new MessageContext(this.telegram, response);
}
async sendVenue(venue, params = {}) {

@@ -263,2 +281,9 @@ let response = await this.telegram.api.sendVenue({

replyWithPoll(poll, params = {}) {
return this.sendPoll(poll, {
reply_to_message_id: this.id,
...params,
});
}
async stopPoll(id, params = {}) {

@@ -265,0 +290,0 @@ let response = await this.telegram.api.stopPoll({

@@ -65,3 +65,3 @@ let { inspect } = require('util');

async reply(text, params = {}) {
return this.send(text = '',{
return this.send(text, {
reply_to_message_id: this.id,

@@ -220,2 +220,14 @@ ...params,

async stopMessageLiveLocation(params = {}) {
let response = await this.telegram.api.stopMessageLiveLocation({
chat_id: this.chatId,
message_id: this.id,
...params,
});
return response === true
? true
: new MessageContext(this.telegram, response);
}
async sendVenue(venue, params = {}) {

@@ -265,2 +277,9 @@ let response = await this.telegram.api.sendVenue({

replyWithPoll(poll, params = {}) {
return this.sendPoll(poll, {
reply_to_message_id: this.id,
...params,
});
}
async stopPoll(id, params = {}) {

@@ -267,0 +286,0 @@ let response = await this.telegram.api.stopPoll({

@@ -69,3 +69,3 @@ let { inspect } = require('util');

async reply(text, params = {}) {
return this.send(text = '',{
return this.send(text, {
reply_to_message_id: this.id,

@@ -224,2 +224,14 @@ ...params,

async stopMessageLiveLocation(params = {}) {
let response = await this.telegram.api.stopMessageLiveLocation({
chat_id: this.chatId,
message_id: this.id,
...params,
});
return response === true
? true
: new MessageContext(this.telegram, response);
}
async sendVenue(venue, params = {}) {

@@ -269,2 +281,9 @@ let response = await this.telegram.api.sendVenue({

replyWithPoll(poll, params = {}) {
return this.sendPoll(poll, {
reply_to_message_id: this.id,
...params,
});
}
async stopPoll(id, params = {}) {

@@ -271,0 +290,0 @@ let response = await this.telegram.api.stopPoll({

let { inspect } = require('util');
let Context = require('./context');
let MessageContext = require('./message');

@@ -6,0 +5,0 @@ let User = require('../structures/user');

let { inspect } = require('util');
let Context = require('./context');
let MessageContext = require('./message');

@@ -25,2 +24,6 @@ class Poll extends Context {

get totalVoterCount() {
return this.update.total_voter_count;
}
get isClosed() {

@@ -30,2 +33,18 @@ return this.update.is_closed;

get isAnonymous() {
return this.update.is_anonymous;
}
get type() {
return this.update.type;
}
get allowsMultipleAnswers() {
return this.update.allows_multiple_answers;
}
get correctOptionId() {
return this.update.correct_option_id || null;
}
[inspect.custom](depth, options) {

@@ -38,3 +57,8 @@ let { name } = this.constructor;

options: this.options,
totalVoterCount: this.totalVoterCount,
isClosed: this.isClosed,
isAnonymous: this.isAnonymous,
type: this.type,
allowsMultipleAnswers: this.allowsMultipleAnswers,
correctOptionId: this.correctOptionId
};

@@ -41,0 +65,0 @@

@@ -66,3 +66,3 @@ let { inspect } = require('util');

async reply(text, params = {}) {
return this.send(text = '',{
return this.send(text, {
reply_to_message_id: this.id,

@@ -221,2 +221,14 @@ ...params,

async stopMessageLiveLocation(params = {}) {
let response = await this.telegram.api.stopMessageLiveLocation({
chat_id: this.chatId,
message_id: this.id,
...params,
});
return response === true
? true
: new MessageContext(this.telegram, response);
}
async sendVenue(venue, params = {}) {

@@ -266,2 +278,9 @@ let response = await this.telegram.api.sendVenue({

replyWithPoll(poll, params = {}) {
return this.sendPoll(poll, {
reply_to_message_id: this.id,
...params,
});
}
async stopPoll(id, params = {}) {

@@ -268,0 +287,0 @@ let response = await this.telegram.api.stopPoll({

@@ -65,3 +65,3 @@ let { inspect } = require('util');

async reply(text, params = {}) {
return this.send(text = '',{
return this.send(text, {
reply_to_message_id: this.id,

@@ -220,2 +220,14 @@ ...params,

async stopMessageLiveLocation(params = {}) {
let response = await this.telegram.api.stopMessageLiveLocation({
chat_id: this.chatId,
message_id: this.id,
...params,
});
return response === true
? true
: new MessageContext(this.telegram, response);
}
async sendVenue(venue, params = {}) {

@@ -265,2 +277,9 @@ let response = await this.telegram.api.sendVenue({

replyWithPoll(poll, params = {}) {
return this.sendPoll(poll, {
reply_to_message_id: this.id,
...params,
});
}
async stopPoll(id, params = {}) {

@@ -267,0 +286,0 @@ let response = await this.telegram.api.stopPoll({

@@ -55,2 +55,4 @@ let { inspect } = require('util');

}
}
}
module.exports = VideoNoteAttachment;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc