Socket
Socket
Sign inDemoInstall

tgb

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tgb - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

2

package.json
{
"name": "tgb",
"version": "0.3.0",
"version": "0.3.1",
"description": "The best choice for your Telegram Bots",

@@ -5,0 +5,0 @@ "homepage": "https://666.io",

@@ -46,3 +46,3 @@ [![Codacy][cod_b]][cod_l]

polling(bot.token, function({message}) {
polling(bot, function({message}, bot) {
bot.sendMessage([message.from.id, entities(message)]);

@@ -63,4 +63,5 @@ }).catch(function(error) {

// tgb.polling(token, onMessage(data)).stop().start();
// tgb.polling(token, options{limit, timeout, interval}, onMessage(data));
// tgb.polling(token, onMsg(data, bot)).stop().start();
// tgb.polling(token, options{limit, timeout, interval}, onMsg(data, bot));
// tgb.polling(bot, ...);

@@ -127,3 +128,3 @@ // https://core.telegram.org/bots/api#getupdates

<a name=""></a>
<a name="refSpy"></a>
#### Spy

@@ -143,3 +144,2 @@

function parseEntities(data, bot) {

@@ -201,5 +201,4 @@ const {message} = data;

const watch = spy({desc: true}); // Change the sort order
polling(bot, watch.update);
polling(bot.token, (data) => watch.update(data, bot));
// Third

@@ -298,7 +297,9 @@ watch("message.text", function(val, bot, message) {

console.log(await res);
console.log(req.paused, req.finished, req.ended, req.aborted);
// response was received -^ ^- request has been sent
// If a request has been aborted, this value is the time when the request was aborted,
// in milliseconds since 1 January 1970 00:00:00 UTC.
// | If a request has been aborted, this value is the time when the request was aborted,
// | in milliseconds since 1 January 1970 00:00:00 UTC.
// +-----------v
console.log(req.aborted, req.finished, req.ended, req.paused);
// response was received -^ ^- request has been sent
}();

@@ -475,6 +476,2 @@ ```

tgb = require("tgb");
-
tgb.buffer(proxy, token, method, data, callback(error, buf, res))

@@ -481,0 +478,0 @@ tgb.json(proxy, token, method, data, callback(error, json, res))

@@ -17,3 +17,7 @@ //-----------------------------------------------------

function polling(token, options, onMessage) {
function polling(bot, options, onMessage) {
if(typeof(bot) === "string") {
bot = client(bot);
}
if(typeof(options) === "function") {

@@ -34,3 +38,2 @@ onMessage = options;

const bot = client(token);
const tmInterval = Math.max(Math.trunc(options.interval) || 2, 1) * 1000;

@@ -37,0 +40,0 @@

@@ -16,6 +16,2 @@ //-----------------------------------------------------

let updates = [];
//-----------------------------------------------------
module.exports = spy;

@@ -55,2 +51,4 @@

this._sortDesc = typeof(options.desc) === "undefined" ? false : !!options.desc;
this.updates = [];
this.subTypes = {};

@@ -85,4 +83,4 @@

if(updates.indexOf(type) === -1) {
updates.push(t);
if(this.updates.indexOf(type) === -1) {
this.updates.push(t);
}

@@ -108,3 +106,3 @@ }

if(!this.subTypes[t] && !super.listenerCount(t)) {
updates = updates.filter((e) => e !== t);
this.updates = this.updates.filter((e) => e !== t);
}

@@ -129,4 +127,4 @@ }

for(let i = 0, len = updates.length; !update && i < len; ++i) {
update = data[eventType = updates[i]];
for(let i = 0, len = _bind.updates.length; !update && i < len; ++i) {
update = data[eventType = _bind.updates[i]];

@@ -177,3 +175,5 @@ }

removeAllListeners(type) {
this._removeSubType(type);
this.updates = [];
this.subTypes = {};
return super.removeAllListeners(type);

@@ -180,0 +180,0 @@ }

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