def perform_action(sender, act): if act == 'menu': view.menu(sender) elif act == 'top': view.top_text_menu(sender) elif act == 'admin': view.admin_menu(sender) elif act == 'sendmsg': view.send_msg_menu(sender) elif act == 'bottom': view.bottom_text_menu(sender) elif act == 'feedback': view.feedback(sender) elif act == 'send_image': view.send_image(sender) elif act == 'previous_image': generate_meme(sender) elif act == 'settings': view.user_settings(sender) elif act == 'caps': view.caps_settings(sender) elif act == 'font': view.font_settings(sender) elif act == 'caps_on': sender.save_preference('caps', True) view.user_settings(sender) elif act == 'caps_off': sender.save_preference('caps', False) view.user_settings(sender) elif act == 'lang': view.language_menu(sender)
def image_entry_point(sender): action = sender.get_preference('Action', 'menu') if action == 'send_image': try: if sender.download_image(path='images/in_{}.jpg'.format(sender.user_id)): generate_meme(sender) except Exception as ex: sender.send_message(text='Error occurred {}'.format(str(ex))) view.menu(sender) elif sender.update.message.caption: lines = sender.update.message.caption.split('/') sender.save_preference('Bottom', lines[0]) if len(lines) > 1: sender.save_preference('Top', lines[1]) else: sender.save_preference('Top', '') if sender.download_image(path='images/in_{}.jpg'.format(sender.user_id)): generate_meme(sender)
def image_entry_point(sender): action = sender.get_preference('Action', 'menu') if action == 'send_image': try: if sender.download_image( path='images/in_{}.jpg'.format(sender.user_id)): generate_meme(sender) except Exception as ex: sender.send_message(text='Error occurred {}'.format(str(ex))) view.menu(sender) elif sender.update.message.caption: lines = sender.update.message.caption.split('/') sender.save_preference('Bottom', lines[0]) if len(lines) > 1: sender.save_preference('Top', lines[1]) else: sender.save_preference('Top', '') if sender.download_image( path='images/in_{}.jpg'.format(sender.user_id)): generate_meme(sender)
def menu_entry_point(sender): view.menu(sender)
def cancel_entry_point(sender): view.menu(sender)
def mail(sender): if sender.is_admin(): thread = Thread(target=mail_everyone, args=sender) thread.start() else: view.menu(sender)