typescript-telegram-bot-api
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -1200,3 +1200,9 @@ "use strict"; | ||
} | ||
on(event, listener) { | ||
return super.on(event, listener); | ||
} | ||
emit(event, eventData) { | ||
return super.emit(event, eventData); | ||
} | ||
} | ||
exports.TelegramBot = TelegramBot; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Polling = void 0; | ||
const types_1 = require("./types/"); | ||
class Polling { | ||
@@ -21,5 +20,9 @@ constructor(telegramBot, allowedUpdates) { | ||
for (const update of updates) { | ||
Object.keys(types_1.UpdateTypeMap).forEach((key) => { | ||
if (update[key]) { | ||
this.telegramBot.emit(key, update[key]); | ||
Object.keys(update).forEach((key) => { | ||
if (key !== 'update_id') { | ||
const eventType = key; | ||
const eventData = update[eventType]; | ||
if (eventData !== undefined) { | ||
this.telegramBot.emit(eventType, eventData); | ||
} | ||
} | ||
@@ -26,0 +29,0 @@ }); |
import { InlineQuery, Message, BusinessConnection, BusinessMessagesDeleted, MessageReactionUpdated, MessageReactionCountUpdated, ChosenInlineResult, CallbackQuery, ShippingQuery, PreCheckoutQuery, Poll, PollAnswer, ChatMemberUpdated, ChatJoinRequest, ChatBoostUpdated, ChatBoostRemoved } from './'; | ||
export interface EventTypes { | ||
message: Message; | ||
edited_message: Message; | ||
channel_post: Message; | ||
edited_channel_post: Message; | ||
business_connection: BusinessConnection; | ||
business_message: Message; | ||
edited_business_message: Message; | ||
deleted_business_messages: BusinessMessagesDeleted; | ||
message_reaction: MessageReactionUpdated; | ||
message_reaction_count: MessageReactionCountUpdated; | ||
inline_query: InlineQuery; | ||
chosen_inline_result: ChosenInlineResult; | ||
callback_query: CallbackQuery; | ||
shipping_query: ShippingQuery; | ||
pre_checkout_query: PreCheckoutQuery; | ||
poll: Poll; | ||
poll_answer: PollAnswer; | ||
my_chat_member: ChatMemberUpdated; | ||
chat_member: ChatMemberUpdated; | ||
chat_join_request: ChatJoinRequest; | ||
chat_boost: ChatBoostUpdated; | ||
removed_chat_boost: ChatBoostRemoved; | ||
} | ||
export type UpdateType = keyof EventTypes; | ||
type AtMostOne<T, Keys extends keyof T = keyof T> = { | ||
@@ -7,53 +32,7 @@ [K in Keys]: { | ||
}[Keys]; | ||
export declare const UpdateTypeMap: { | ||
message: string; | ||
edited_message: string; | ||
channel_post: string; | ||
edited_channel_post: string; | ||
business_connection: string; | ||
business_message: string; | ||
edited_business_message: string; | ||
deleted_business_messages: string; | ||
message_reaction: string; | ||
message_reaction_count: string; | ||
inline_query: string; | ||
chosen_inline_result: string; | ||
callback_query: string; | ||
shipping_query: string; | ||
pre_checkout_query: string; | ||
poll: string; | ||
poll_answer: string; | ||
my_chat_member: string; | ||
chat_member: string; | ||
chat_join_request: string; | ||
chat_boost: string; | ||
removed_chat_boost: string; | ||
}; | ||
export type UpdateType = keyof typeof UpdateTypeMap; | ||
export type Update = { | ||
update_id: number; | ||
} & AtMostOne<{ | ||
message?: Message; | ||
edited_message?: Message; | ||
channel_post?: Message; | ||
edited_channel_post?: Message; | ||
business_connection?: BusinessConnection; | ||
business_message?: Message; | ||
edited_business_message?: Message; | ||
deleted_business_messages?: BusinessMessagesDeleted; | ||
message_reaction?: MessageReactionUpdated; | ||
message_reaction_count?: MessageReactionCountUpdated; | ||
inline_query?: InlineQuery; | ||
chosen_inline_result?: ChosenInlineResult; | ||
callback_query?: CallbackQuery; | ||
shipping_query?: ShippingQuery; | ||
pre_checkout_query?: PreCheckoutQuery; | ||
poll?: Poll; | ||
poll_answer?: PollAnswer; | ||
my_chat_member?: ChatMemberUpdated; | ||
chat_member?: ChatMemberUpdated; | ||
chat_join_request?: ChatJoinRequest; | ||
chat_boost?: ChatBoostUpdated; | ||
removed_chat_boost?: ChatBoostRemoved; | ||
[K in UpdateType]: EventTypes[K]; | ||
}>; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.UpdateTypeMap = void 0; | ||
exports.UpdateTypeMap = { | ||
message: 'Message', | ||
edited_message: 'Message', | ||
channel_post: 'Message', | ||
edited_channel_post: 'Message', | ||
business_connection: 'BusinessConnection', | ||
business_message: 'Message', | ||
edited_business_message: 'Message', | ||
deleted_business_messages: 'BusinessMessagesDeleted', | ||
message_reaction: 'MessageReactionUpdated', | ||
message_reaction_count: 'MessageReactionCountUpdated', | ||
inline_query: 'InlineQuery', | ||
chosen_inline_result: 'ChosenInlineResult', | ||
callback_query: 'CallbackQuery', | ||
shipping_query: 'ShippingQuery', | ||
pre_checkout_query: 'PreCheckoutQuery', | ||
poll: 'Poll', | ||
poll_answer: 'PollAnswer', | ||
my_chat_member: 'ChatMemberUpdated', | ||
chat_member: 'ChatMemberUpdated', | ||
chat_join_request: 'ChatJoinRequest', | ||
chat_boost: 'ChatBoostUpdated', | ||
removed_chat_boost: 'ChatBoostRemoved', | ||
}; |
{ | ||
"type": "commonjs", | ||
"name": "typescript-telegram-bot-api", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Telegram Bot API wrapper for Node.js written in TypeScript", | ||
@@ -6,0 +6,0 @@ "repository": "github:Borodin/typescript-telegram-bot-api", |
Sorry, the diff of this file is too big to display
233091
5490