async def auth(): user_telegram_id = context.user.user_id user = User(user_telegram_id) await SendMessage(user_telegram_id, get_translation('enter_amizone_username')).send() yield next() username = context.message.text user.set_property('username', username) await SendMessage(user_telegram_id, get_translation('got_username').format(username)).send() await SendMessage(user_telegram_id, get_translation('enter_amizone_password')).send() yield next() password = context.message.text user.set_property('password', password) await SendMessage(user_telegram_id, get_translation('got_password').format(password)).send() await SendMessage(user_telegram_id, get_translation('got_password').format(password)).send() login = amizone_core.Amizone(user.get_property('username'), user.get_property('password')) if login: msg = get_translation('logged') else: msg = get_translation('went_wrong') await SendMessage(user_telegram_id, msg).send()
async def profile(): user_telegram_id = context.user.user_id user = User(user_telegram_id) amizone = amizone_core.Amizone(user.get_property('username'), user.get_property('password')) profile_information = '\n'.join(amizone.get_profile().values()) await SendMessage(user_telegram_id, profile_information).send()
async def update_information(): user_telegram_id = context.user.user_id user = User(user_telegram_id) amizone = amizone_core.Amizone(user.get_property('username'), user.get_property('password')) await SendMessage(context.user.user_id, get_translation('process')).send() amizone.update() await SendMessage(context.user.user_id, get_translation('information_updated')).send()
async def timetable(): user_telegram_id = context.user.user_id user = User(user_telegram_id) amizone = amizone_core.Amizone(user.get_property('username'), user.get_property('password')) timetable_information = amizone.get_timetable() msg = '\n'.join([ ' | '.join(information.values()) for information in timetable_information ]) await SendMessage(context.user.user_id, msg).send()