puregram
Advanced tools
Comparing version 1.1.4 to 1.1.5-rc.1
{ | ||
"name": "puregram", | ||
"version": "1.1.4", | ||
"version": "1.1.5-rc.1", | ||
"main": "src/index.js", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -43,1 +43,4 @@ # puregram | ||
Biggest thanks to [Negezor](https://github.com/negezor) for his [vk-io](https://github.com/negezor/vk-io) library that helped me with this package! | ||
### VK chat | ||
> https://vk.me/join/AJQ1d7n35xXnfBxIB21zACP3 |
@@ -632,2 +632,3 @@ let fetch = require('node-fetch'); | ||
let form = null; | ||
let isPath = fs.existsSync(value); | ||
@@ -642,3 +643,3 @@ if (value instanceof Readable) { | ||
form.append(key, value, { filename: key + this.chatId }); | ||
} else if (typeof value === 'string' && !value.startsWith('http')) { | ||
} else if (typeof value === 'string' && !value.startsWith('http') && isPath) { | ||
form = new FormData(); | ||
@@ -650,3 +651,3 @@ | ||
if (form && key in params) { | ||
if (form && key in params && !isPath) { | ||
let { [key]: _, ...tempParams } = params; | ||
@@ -653,0 +654,0 @@ |
@@ -23,255 +23,8 @@ import Params from "../../typings/params"; | ||
/** | ||
* 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: Params.ISendMessageParams): Promise<MessageContext>; | ||
/** | ||
* Use this method to send photos. | ||
* | ||
* On success, the sent `Message` is returned. | ||
*/ | ||
public sendPhoto(photo: Interfaces.IInputFile | 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: Interfaces.IInputFile | 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: Interfaces.IInputFile | 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: Interfaces.IInputFile | 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: Interfaces.IInputFile | 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: Interfaces.IInputFile | 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: Interfaces.IInputFile | 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>; | ||
public answerInlineQuery( | ||
results: Array<Interfaces.InlineQueryResult>, | ||
params: Params.IAnswerInlineQueryParams | ||
): Promise<true>; | ||
} | ||
export = InlineQuery; |
import API from './api'; | ||
import Updates from './updates'; | ||
import { ITelegramParams } from '../typings/params'; | ||
import Params from '../typings/params'; | ||
@@ -9,5 +9,5 @@ declare class Telegram { | ||
constructor(params: ITelegramParams); | ||
constructor(params: Params.ITelegramParams); | ||
} | ||
export = Telegram; |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
46
538253
15632
1