@@ -19,19 +19,6 @@ function patchEmitUpdate(TelegramBot) {
19
19
}
20
20
}
21
21
22
- function patchEmitCallbackQuery ( TelegramBot ) {
23
- var _processUpdate = TelegramBot . prototype . _processUpdate ;
24
- TelegramBot . prototype . _processUpdate = function ( update ) {
25
- _processUpdate . call ( this , update ) ;
26
- var callbackQuery = update . callback_query ;
27
- if ( callbackQuery ) {
28
- debug ( 'Process Update callback_query %j' , callbackQuery ) ;
29
- this . emit ( 'callback_query' , callbackQuery ) ;
30
- }
31
-
32
- }
33
- }
34
-
35
22
function patchSendVenue ( TelegramBot ) {
36
23
/**
37
24
* Send venue.
@@ -57,136 +44,6 @@ function patchSendVenue(TelegramBot) {
57
44
}
58
45
}
59
46
60
- function patchKickChatMember ( TelegramBot ) {
61
- /**
62
- * Use this method to kick a user from a group or a supergroup.
63
- * In the case of supergroups, the user will not be able to return
64
- * to the group on their own using invite links, etc., unless unbanned
65
- * first. The bot must be an administrator in the group for this to work.
66
- * Returns True on success.
67
- *
68
- * @param {Number|String } chatId Unique identifier for the target group or username of the target supergroup
69
- * @param {String } userId Unique identifier of the target user
70
- * @return {Promise }
71
- * @see https://core.telegram.org/bots/api#kickchatmember
72
- */
73
- TelegramBot . prototype . kickChatMember = function kickChatMember ( chatId , userId ) {
74
- const form = {
75
- chat_id : chatId ,
76
- user_id : userId
77
- } ;
78
- return this . _request ( 'kickChatMember' , { form : form } ) ;
79
- }
80
- }
81
-
82
- function patchUnbanChatMember ( TelegramBot ) {
83
- /**
84
- * Use this method to unban a previously kicked user in a supergroup.
85
- * The user will not return to the group automatically, but will be
86
- * able to join via link, etc. The bot must be an administrator in
87
- * the group for this to work. Returns True on success.
88
- *
89
- * @param {Number|String } chatId Unique identifier for the target group or username of the target supergroup
90
- * @param {String } userId Unique identifier of the target user
91
- * @return {Promise }
92
- * @see https://core.telegram.org/bots/api#unbanchatmember
93
- */
94
- TelegramBot . prototype . unbanChatMember = function unbanChatMember ( chatId , userId ) {
95
- const form = {
96
- chat_id : chatId ,
97
- user_id : userId
98
- } ;
99
- return this . _request ( 'unbanChatMember' , { form : form } ) ;
100
- }
101
- }
102
-
103
- function pathAnswerCallbackQuery ( TelegramBot ) {
104
- /**
105
- * Use this method to send answers to callback queries sent from
106
- * inline keyboards. The answer will be displayed to the user as
107
- * a notification at the top of the chat screen or as an alert.
108
- * On success, True is returned.
109
- *
110
- * @param {Number|String } callbackQueryId Unique identifier for the query to be answered
111
- * @param {String } text Text of the notification. If not specified, nothing will be shown to the user
112
- * @param {Boolean } showAlert Whether to show an alert or a notification at the top of the screen
113
- * @param {Object } [options] Additional Telegram query options
114
- * @return {Promise }
115
- * @see https://core.telegram.org/bots/api#answercallbackquery
116
- */
117
- TelegramBot . prototype . answerCallbackQuery = function answerCallbackQuery ( callbackQueryId , text , showAlert , form ) {
118
- form = form || { } ;
119
- form . callback_query_id = callbackQueryId ;
120
- form . text = text ;
121
- form . show_alert = showAlert ;
122
- return this . _request ( 'answerCallbackQuery' , { form : form } ) ;
123
- }
124
- }
125
-
126
- function patchEditMessageText ( TelegramBot ) {
127
- /**
128
- * Use this method to edit text messages sent by the bot or via
129
- * the bot (for inline bots). On success, the edited Message is
130
- * returned.
131
- *
132
- * Note that you must provide one of chat_id, message_id, or
133
- * inline_message_id in your request.
134
- *
135
- * @param {String } text New text of the message
136
- * @param {Object } [options] Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here)
137
- * @return {Promise }
138
- * @see https://core.telegram.org/bots/api#editmessagetext
139
- */
140
- TelegramBot . prototype . editMessageText = function editMessageText ( text , form ) {
141
- form = form || { } ;
142
- form . text = text ;
143
- return this . _request ( 'editMessageText' , { form : form } ) ;
144
- }
145
-
146
- }
147
-
148
-
149
- function patchEditMessageCaption ( TelegramBot ) {
150
- /**
151
- * Use this method to edit captions of messages sent by the
152
- * bot or via the bot (for inline bots). On success, the
153
- * edited Message is returned.
154
- *
155
- * Note that you must provide one of chat_id, message_id, or
156
- * inline_message_id in your request.
157
- *
158
- * @param {String } caption New caption of the message
159
- * @param {Object } [options] Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here)
160
- * @return {Promise }
161
- * @see https://core.telegram.org/bots/api#editmessagecaption
162
- */
163
- TelegramBot . prototype . editMessageCaption = function editMessageCaption ( caption , form ) {
164
- form = form || { } ;
165
- form . caption = caption ;
166
- return this . _request ( 'editMessageCaption' , { form : form } ) ;
167
- }
168
- }
169
- function patchEditMessageReplyMarkup ( TelegramBot ) {
170
- /**
171
- * Use this method to edit only the reply markup of messages
172
- * sent by the bot or via the bot (for inline bots).
173
- * On success, the edited Message is returned.
174
- *
175
- * Note that you must provide one of chat_id, message_id, or
176
- * inline_message_id in your request.
177
- *
178
- * @param {Object } replyMarkup A JSON-serialized object for an inline keyboard.
179
- * @param {Object } [options] Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here)
180
- * @return {Promise }
181
- * @see https://core.telegram.org/bots/api#editmessagereplymarkup
182
- */
183
- TelegramBot . prototype . editMessageReplyMarkup = function editMessageReplyMarkup ( replyMarkup , form ) {
184
- form = form || { } ;
185
- form . reply_markup = replyMarkup ;
186
- return this . _request ( 'editMessageReplyMarkup' , { form : form } ) ;
187
- }
188
- }
189
-
190
47
module . exports = function ( TelegramBot , options ) {
191
48
options = options || { } ;
192
49
if ( options . all || options . stopPolling ) {
@@ -195,28 +52,7 @@ module.exports = function (TelegramBot, options) {
195
52
if ( options . all || options . emitUpdate ) {
196
53
patchEmitUpdate ( TelegramBot ) ;
197
54
}
198
- if ( options . all || options . emitCallbackQuery ) {
199
- patchEmitCallbackQuery ( TelegramBot ) ;
200
- }
201
55
if ( options . all || options . sendVenue ) {
202
56
patchSendVenue ( TelegramBot ) ;
203
57
}
204
- if ( options . all || options . kickChatMember ) {
205
- patchKickChatMember ( TelegramBot ) ;
206
- }
207
- if ( options . all || options . unbanChatMember ) {
208
- patchUnbanChatMember ( TelegramBot ) ;
209
- }
210
- if ( options . all || options . answerCallbackQuery ) {
211
- pathAnswerCallbackQuery ( TelegramBot ) ;
212
- }
213
- if ( options . all || options . editMessageText ) {
214
- patchEditMessageText ( TelegramBot ) ;
215
- }
216
- if ( options . all || options . editMessageCaption ) {
217
- patchEditMessageCaption ( TelegramBot ) ;
218
- }
219
- if ( options . all || options . editMessageReplyMarkup ) {
220
- patchEditMessageReplyMarkup ( TelegramBot ) ;
221
- }
222
58
} ;
0 commit comments