Skip to content

Commit 73b5000

Browse files
committed
TASK: Use pass_args instead of manually handling arguments
1 parent b356d58 commit 73b5000

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

main.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,23 +287,21 @@ def language_cmd(bot, update):
287287
reply_markup=lang_keyboard, message_id=update.message.message_id)
288288

289289

290-
def comment_cmd(bot, update):
290+
def comment_cmd(bot, update, args):
291291
user_id = update.message.from_user.id
292292
chat_id = update.message.chat_id
293293
first_name = update.message.from_user.first_name
294294
last_name = update.message.from_user.last_name
295295
username = update.message.from_user.username
296296
db = DBwrapper.get_instance()
297297
lang_id = db.get_lang_id(user_id)
298-
text = update.message.text
299-
params = text.split()
300298

301299
state_handler = StateHandler.get_instance()
302300
user = state_handler.get_user(user_id)
303301

304302
if user.get_state() == UserState.IDLE:
305-
if len(params) > 1:
306-
text = " ".join(params[1:])
303+
if len(args) > 1:
304+
text = " ".join(args)
307305
logger.debug("New comment! {}!".format(user_id))
308306

309307
bot.sendMessage(chat_id=chat_id, text=translate("userComment", lang_id))
@@ -444,7 +442,7 @@ def restart(bot, update):
444442
hide_handler = CommandHandler('hide', hide_cmd)
445443
stats_handler = CommandHandler('stats', stats_cmd)
446444
language_handler = CommandHandler('language', language_cmd)
447-
comment_handler = CommandHandler('comment', comment_cmd)
445+
comment_handler = CommandHandler('comment', comment_cmd, pass_args=True)
448446
callback_handler = CallbackQueryHandler(callback_eval)
449447
users_handler = CommandHandler('users', users)
450448
answer_handler = CommandHandler('answer', answer)

0 commit comments

Comments
 (0)