def set_task_status(chat_id, message_id, task_id, status, text): """ Changes task status: values: 1 - Created 2 - Rejected 3 - Accepted 4 - Completed Notice: from bot you can accept or reject task Checks if task exists :param chat_id: message's chat id :param message_id: message's id (uses to change task information message to notification about task status changing to accepted or rejected :param task_id: id of task what might be changed :param status: task's status number (int) :param text: text that notified user about rejecting or accepting task """ if not Task.objects.get(id=task_id): bot.send_message( chat_id, 'Your task data does not exist! Maybe it was deleted! Type /tasks') return Task.objects.set_task_status(task_id, status) bot.edit_message_text(text, chat_id, message_id) bot.enable_save_next_step_handlers() bot.load_next_step_handlers()
bot.register_next_step_handler(msg, mail_processing) return if request.find_email(): if request.user_id == request.user_info[1]: bot.reply_to( message, 'Oh-oh, it seems like you have already participated in this giveaway by entering ' 'this email. To keep the giveaway fair, we accept only one user account. ' 'You can always participate in other giveaways. To do so, just stay up to date ' 'with our [Channel](http://google.com)', parse_mode="Markdown") else: # another user bot.reply_to( message, 'Oh-oh, it seems like you have already participated in this giveaway by entering ' 'this email. To keep the giveaway fair, we accept only one user account. ' 'You can always participate in other giveaways. To do so, just stay up to date ' 'with our [Channel](http://google.com)', parse_mode="Markdown") # bot.register_next_step_handler(msg, mail_processing) else: bot.reply_to(message, 'Thnx, bro') request.save() bot.enable_save_next_step_handlers(delay=2) bot.load_next_step_handlers() bot.polling() # https://t.me/proxy?server=ru.tgproxy.today&port=8080&secret=ddfb175d6d7f820cdc73ab11edbdcdbd74