@@ -38,7 +38,7 @@ def __init__(self, tg_bot_token, vk_client_id):
38
38
39
39
start_command_handler = CommandHandler ('start' , self .start_command_callback )
40
40
dispatcher .add_handler (start_command_handler )
41
- start_command_handler = CommandHandler ('auth ' , self .auth_command_callback )
41
+ start_command_handler = CommandHandler ('authenticate ' , self .auth_command_callback )
42
42
dispatcher .add_handler (start_command_handler )
43
43
start_command_handler = CommandHandler ('downloadByLink' , self .downloadByLink_callback )
44
44
dispatcher .add_handler (start_command_handler )
@@ -69,20 +69,21 @@ def __init__(self, tg_bot_token, vk_client_id):
69
69
70
70
def button (self , update : Update , context : CallbackContext ) -> None :
71
71
"""Parses the CallbackQuery and updates the message text."""
72
+ buttons_to_display = 16
72
73
query = update .callback_query
73
74
query .answer ()
74
75
75
76
client = self .clients [query .message .chat_id ]
76
77
client .seen_now ()
77
78
78
79
if query .data .startswith ("<-Friends" ):
79
- if client .offset_friends >= 16 :
80
+ if client .offset_friends >= buttons_to_display :
80
81
client .prev_message_id_friends = query .message .message_id
81
- client .offset_friends -= 16
82
+ client .offset_friends -= buttons_to_display
82
83
self .friends_command_callback (update , context , client .chat_id )
83
84
elif query .data .startswith ("->Friends" ):
84
85
client .prev_message_id_friends = query .message .message_id
85
- client .offset_friends += 16
86
+ client .offset_friends += buttons_to_display
86
87
self .friends_command_callback (update , context , client .chat_id )
87
88
88
89
if query .data .startswith ("['user id'" ):
@@ -95,13 +96,13 @@ def button(self, update: Update, context: CallbackContext) -> None:
95
96
reply_markup = TelegramController .keyboard (client .keyboard_markup ()))
96
97
97
98
if query .data .startswith ("<-Files" ):
98
- if client .offset_files >= 16 :
99
+ if client .offset_files >= buttons_to_display :
99
100
client .prev_message_id_files = query .message .message_id
100
- client .offset_files -= 16
101
+ client .offset_files -= buttons_to_display
101
102
self .list_files_callback (update , context , client .chat_id )
102
103
elif query .data .startswith ("->Files" ):
103
104
client .prev_message_id_files = query .message .message_id
104
- client .offset_files += 16
105
+ client .offset_files += buttons_to_display
105
106
self .list_files_callback (update , context , client .chat_id )
106
107
107
108
if query .data .startswith ("['file id'" ):
@@ -148,8 +149,8 @@ def restore(self):
148
149
def start_command_callback (self , update , context : CallbackContext ):
149
150
chat_id = update .message .chat_id
150
151
self .updater .bot .sendMessage (chat_id = chat_id ,
151
- text = "Hello! Can yoe choose button from th list?" ,
152
- reply_markup = TelegramController .keyboard ([["/downloadByLink" ]] + [["/auth " ]])
152
+ text = message . HELLO ,
153
+ reply_markup = TelegramController .keyboard ([["/downloadByLink" ]] + [["/authenticate " ]])
153
154
)
154
155
155
156
def auth_command_callback (self , update , context : CallbackContext ):
@@ -187,7 +188,7 @@ def downloadByLink_callback(self, update, context: CallbackContext):
187
188
chat_id = update .message .chat_id
188
189
self .flagNotAuth = True
189
190
self .updater .bot .sendMessage (chat_id = chat_id ,
190
- text = "Please, eneter the link" )
191
+ text = message . ENTER_LINK )
191
192
192
193
def download_file_callback (self , update , context : CallbackContext ):
193
194
"""
@@ -251,13 +252,13 @@ def friends_command_callback(self, update, context: CallbackContext, chatID=None
251
252
reply_markup = InlineKeyboardMarkup (self .build_menu (button_list ))
252
253
if chatID is None :
253
254
self .updater .bot .sendMessage (chat_id = chat_id ,
254
- text = 'Choose from the following' ,
255
+ text = message . CHOOSE_OPTION ,
255
256
parse_mode = ParseMode .MARKDOWN ,
256
257
reply_markup = reply_markup )
257
258
else :
258
259
self .updater .bot .edit_message_text (chat_id = chat_id ,
259
260
message_id = client .prev_message_id_friends ,
260
- text = 'Choose from the following' ,
261
+ text = message . CHOOSE_OPTION ,
261
262
parse_mode = ParseMode .MARKDOWN ,
262
263
reply_markup = reply_markup )
263
264
0 commit comments