Comparing version 1.1.9-rc.4 to 1.1.9-rc.7
{ | ||
"name": "puregram", | ||
"version": "1.1.9-rc.4", | ||
"version": "1.1.9-rc.7", | ||
"main": "src/index.js", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -45,5 +45,6 @@ # puregram | ||
* [Magnit X](https://t.me/magnitxbot) - saves your money on payments in [Magnit](https://magnit.ru) shop | ||
* [Telegram Anonym Chat](https://t.me/ruanon_bot) - anonymous chat with other people in Telegram | ||
* [Telegram Anonym Chat](https://t.me/RuAnon_bot) - anonymous chat with other people in Telegram | ||
* [Get My ID](https://t.me/receive_my_id_bot) - bot from [example (get-id-bot.js)](https://github.com/nitreojs/puregram/blob/master/docs/examples/get-id-bot.js) | ||
* [Brawl Stars](https://t.me/BrawlStarsInlineBot) - bot to get user's or club's statistics in Brawl Stars | ||
* [Message Payload Bot](https://t.me/MessagePayloadBot) - bot to get all message's payload | ||
@@ -50,0 +51,0 @@ If you want to see your bot here — PM [me](https://t.me/nitrojs) _(I will add up to 10 bots here)_ |
@@ -403,3 +403,3 @@ import Params from '../typings/params'; | ||
*/ | ||
answerCallbackQuery(params?: Params.IAnswerCallbackQueryParams): Promise<true>; | ||
answerCallbackQuery(text: string, params?: Params.IAnswerCallbackQueryParams): Promise<true>; | ||
@@ -406,0 +406,0 @@ /** |
@@ -71,9 +71,15 @@ let fetch = require('node-fetch'); | ||
let response = await fetch(url, { | ||
method: 'POST', | ||
headers: body instanceof FormData ? null : headers, | ||
body, | ||
agent: this.agent | ||
}); | ||
let response = null; | ||
try { | ||
response = await fetch(url, { | ||
method: 'POST', | ||
headers: body instanceof FormData ? null : headers, | ||
body, | ||
agent: this.agent | ||
}); | ||
} catch (e) { | ||
throw e; | ||
} | ||
let json = await response.json(); | ||
@@ -646,3 +652,3 @@ | ||
if (form && key in params && !isPath) { | ||
if (form && key in params) { | ||
// eslint-disable-next-line no-unused-vars | ||
@@ -656,3 +662,14 @@ let { [key]: _, ...tempParams } = params; | ||
for (let [fKey, fValue] of Object.entries(params)) { | ||
form.append(fKey, fValue); | ||
let afValue = fValue; | ||
if (typeof fValue === 'boolean') { | ||
afValue = JSON.stringify(fValue); | ||
} | ||
// Is keyboard | ||
if (fValue.toJSON) { | ||
afValue = fValue.toJSON(); | ||
} | ||
form.append(fKey, afValue); | ||
} | ||
@@ -659,0 +676,0 @@ |
@@ -53,3 +53,3 @@ import { ILoginUrl, ICallbackGame } from '../../typings/interfaces'; | ||
params?: object; | ||
payload?: object; | ||
} | ||
@@ -56,0 +56,0 @@ |
@@ -53,3 +53,3 @@ import { ILoginUrl, ICallbackGame } from '../../typings/interfaces'; | ||
params?: object; | ||
payload?: object; | ||
} | ||
@@ -56,0 +56,0 @@ |
@@ -15,17 +15,27 @@ import Params from '../../typings/params'; | ||
public from?: Interfaces.IUser; | ||
public from: Interfaces.IUser; | ||
public senderId?: number; | ||
public message?: Interfaces.IMessage; | ||
public message?: MessageContext; | ||
public inline_message_id?: string; | ||
public inlineMessageId?: string; | ||
public chat_instance: string; | ||
public chatInstance: string; | ||
public data?: string; | ||
public payload?: string | object; | ||
public game_short_name?: string; | ||
public gameShortName?: string; | ||
/** | ||
* Use this method to send answers to callback queries | ||
* sent from inline keyboards. | ||
* The answer will be displayed to the user as a notification | ||
* at the top of the chat screen or as an alert. | ||
* | ||
* On success, `True` is returned. | ||
*/ | ||
answerCallbackQuery(text: string, params?: Params.IAnswerCallbackQueryParams): Promise<true>; | ||
/** | ||
* Use this method to send text messages. | ||
@@ -32,0 +42,0 @@ * |
@@ -130,2 +130,7 @@ import Params from '../../typings/params'; | ||
/** | ||
* Bot through which the message was sent | ||
*/ | ||
public viaBot?: Interfaces.IUser; | ||
/** | ||
* Date the message was last edited in Unix time | ||
@@ -132,0 +137,0 @@ */ |
@@ -149,2 +149,10 @@ let { inspect } = require('util'); | ||
get viaBot() { | ||
let { via_bot: viaBot } = this.update; | ||
if (!viaBot) return null; | ||
return new User(viaBot); | ||
} | ||
get editDate() { | ||
@@ -151,0 +159,0 @@ return this.update.edit_date || null; |
@@ -141,2 +141,5 @@ let middlewareIo = require('middleware-io'); | ||
debug('startPolling error'); | ||
debug(e); | ||
throw e; | ||
@@ -152,3 +155,11 @@ } | ||
while (this.isStarted) { | ||
await this.fetchUpdates(); | ||
try { | ||
await this.fetchUpdates(); | ||
} catch (e) { | ||
debug('startFetchLoop error'); | ||
debug(e); | ||
this.stopPolling(); | ||
await this.startPolling(); | ||
} | ||
} | ||
@@ -155,0 +166,0 @@ } |
@@ -73,4 +73,4 @@ import Keyboard from '../src/attachments/keyboard'; | ||
export type DocumentTypes = 'application/pdf' | 'application/zip'; | ||
export type VideoTypes = 'text/html' | 'video/mp4'; | ||
export type MimeTypes = 'image/jpeg' | 'image/gif' | 'video/mp4'; | ||
@@ -77,0 +77,0 @@ export type PassportElementDataErrors = |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
782171
23594
59