typescript-telegram-bot-api
Advanced tools
Comparing version 0.1.9 to 0.1.10
@@ -9,3 +9,4 @@ import { TelegramBot } from './index'; | ||
constructor(telegramBot: TelegramBot, allowedUpdates: UpdateType[]); | ||
private emit; | ||
private emitMessage; | ||
private emitUpdate; | ||
private poll; | ||
@@ -12,0 +13,0 @@ start(): void; |
@@ -12,3 +12,10 @@ "use strict"; | ||
} | ||
emit(update) { | ||
emitMessage(message) { | ||
types_1.messageTypes.forEach((key) => { | ||
if (key in message) { | ||
this.telegramBot.emit(key, message); | ||
} | ||
}); | ||
} | ||
emitUpdate(update) { | ||
Object.keys(update).forEach((key) => { | ||
@@ -21,7 +28,3 @@ if (key !== 'update_id' && key !== 'poll') { | ||
if (eventType === 'message') { | ||
const message = eventData; | ||
for (const messageType of Object.keys(types_1.messageTypes)) { | ||
if (messageType in message) | ||
this.telegramBot.emit(messageType, message); | ||
} | ||
this.emitMessage(eventData); | ||
} | ||
@@ -41,3 +44,3 @@ } | ||
for (const update of updates) { | ||
this.emit(update); | ||
this.emitUpdate(update); | ||
this.offset = update.update_id + 1; | ||
@@ -44,0 +47,0 @@ } |
{ | ||
"type": "commonjs", | ||
"name": "typescript-telegram-bot-api", | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"description": "Telegram Bot API wrapper for Node.js written in TypeScript", | ||
@@ -6,0 +6,0 @@ "repository": "github:Borodin/typescript-telegram-bot-api", |
5549
235098