def ivTTMenu(update,context): ''' Function to send error when user enters Invalid rollno in Student Timetable Menu ''' menu = cs.build_menu(buttons=["Today's Timetable","Daily Timetable","Back"]) update.message.reply_text( text = '''Sorry , I can't do that.\nPlease select from the Given list''',reply_markup=telegram.ReplyKeyboardMarkup(menu)) return TT_MENU_KEY
def atd_Menu(update,context): ''' Function to send Student Attendance Menu to the user ''' menu = cs.build_menu(buttons=["Get Attendance","Set Attendance","Back"]) update.message.reply_text( text = '''what do you want to know about Your Attendance?''',reply_markup=telegram.ReplyKeyboardMarkup(menu)) return ATD_MENU_KEY
def tt_Menu(update,context): ''' Function to send Student Timetable Menu to the user ''' menu = cs.build_menu(buttons=["Today's Timetable","Daily Timetable","Back"]) update.message.reply_text(text = '''what do you want to know about Your Timetable?''',reply_markup = telegram.ReplyKeyboardMarkup(menu)) return TT_MENU_KEY
def ivAtdMenu(update,context): ''' Function to send error when user enters Invalid rollno in Student Attendance Menu ''' menu = cs.build_menu(buttons=["Get Attendance","Set Attendance","Back"]) update.message.reply_text( text = '''Sorry , I can't do that.\nPlease select from the Given list''',reply_markup=telegram.ReplyKeyboardMarkup(menu)) return ATD_MENU_KEY
def ivsub_CRSC(update,context): ''' Function to send error when user enters Invalid subject in CR Menu/Replace_Class path ''' update.message.reply_text(text='''Its not a Subject from the list.\nPlease sent me a Grade and Subject from the list''', reply_markup=telegram.ReplyKeyboardMarkup(cs.build_menu(context.user_data['stdCRsubkb']+['Back']))) return RPLCLS_SUB_KEY
def ivStat_SASC(update,context): ''' Function to send error when user enters Invalid Status in Student Attendance Menu ''' update.message.reply_text(text='''Sorry , I can't do that.\nPlease select a Valid status of the subject''', reply_markup=telegram.ReplyKeyboardMarkup(cs.build_menu(['Present','Absent','Back']))) return SETATD_STAT_KEY
def ivperiod_CCPC(update,context): ''' Function to send error when user enters Invalid Period in Teacher_Announcements/Create_Class path ''' update.message.reply_text(text='''Its not a Period from the list.\nPlease sent me a Period from the list''', reply_markup=telegram.ReplyKeyboardMarkup(cs.build_menu(context.user_data['availableperlst']+['Back']))) return CR8CLS_PERD_KEY
def period_CCPC(update, context): ''' Function to send KeyBoard of Periods to the user in Teacher_Announcements/Create_Class path ''' context.user_data['CR8ClsDay'] = (update.message.text) availableperlst = list() stdperiodlst = [ i[0] for i in db.getStdtt((context.user_data['CR8ClsGrdSub'] ).split(':')[0], context.user_data['CR8ClsDay']) ] tchperiodlst = [ i[0] for i in db.getTeachtt(( update.effective_chat.id), context.user_data['CR8ClsDay']) ] for i in cs.datajson['periodlst']: if (i not in stdperiodlst) and (i not in tchperiodlst): availableperlst.append(i) context.user_data['availableperlst'] = availableperlst update.message.reply_text( text='''Which period of {} do you want ?'''.format( (update.message.text)), reply_markup=telegram.ReplyKeyboardMarkup( cs.build_menu(context.user_data['availableperlst'] + ['Back']))) return CR8CLS_PERD_KEY
def dev_Menu(update,context): ''' Developer's Menu function ''' menu = cs.build_menu(buttons=["No of Users","Manage CR","Message Users","Remove User\nAccount","Json Update",'Back']) update.message.reply_text( text = '''Ask me what you want to do from the Below list''',reply_markup=telegram.ReplyKeyboardMarkup(menu)) return DEV_MENU_KEY
def daykb_CxCDC(update,context): ''' Function to send KeyBoard of Days to the user in CR Menu/Cancel_Class path ''' text = cs.build_menu(buttons=(cs.datajson['daylst']+['Back'])) update.message.reply_text(text=''' Which day class do you want to cancel ?''', reply_markup=telegram.ReplyKeyboardMarkup(text)) return CXLCLS_DAY_KEY
def ivday_CxCDC(update,context): ''' Function to send error when user enters Invalid day in Teacher_Announcements/Cancel_Class path ''' text = cs.build_menu(buttons=(cs.datajson['daylst']+['Back'])) update.message.reply_text(text='''Its not a Day from the list.\nPlease sent me a day from the list''', reply_markup=telegram.ReplyKeyboardMarkup(text)) return CXLCLS_DAY_KEY
def ivGSP_CxCGC(update,context): ''' Function to send error when user enters Invalid Class in Teacher_Announcements/Cancel_Class path ''' update.message.reply_text(text='''Its not a Class from the list.\nPlease sent me a class from the list''', reply_markup=telegram.ReplyKeyboardMarkup(cs.build_menu(context.user_data['avGSPlst']+['Back'],n_cols=1))) return CXLCLS_GSP_KEY
def dayKb_DTMC (update,context): ''' Function to send KeyBoard of Days to the user in Student Timetable/Daily_Timetable path ''' text = cs.build_menu(buttons=(cs.datajson['daylst']+['Back'])) update.message.reply_text( text = '''Which day Timetable do you want ?''',reply_markup=telegram.ReplyKeyboardMarkup(text)) return DAILY_TT_KEY
def ivday_DTMC(update,context): ''' Function to send error when user enters Invalid day in Student Timetable/Daily_Timetable path ''' text = cs.build_menu(buttons=(cs.datajson['daylst']+['Back'])) update.message.reply_text( text = '''Its not a Day from the list.\nPlease sent me a day from the list''',reply_markup=telegram.ReplyKeyboardMarkup(text)) return DAILY_TT_KEY
def dayKb_CCDC(update,context): ''' Function to send KeyBoard of Days to the user in CR Menu/Create_Class path ''' text = cs.build_menu(buttons=(cs.datajson['daylst']+['Back'])) update.message.reply_text( text='''Which day do you want to Create class for {}?'''.format((db.chkusr(update.effective_chat.id)).split('U')[0]), reply_markup=telegram.ReplyKeyboardMarkup(text)) return CR8CLS_Day_KEY
def ivCRMenu(update,context): ''' Function to send error when user enters Invalid Option in CR Announcement Menu ''' menu = cs.build_menu(buttons=["Create Class","Cancel Class","Replace Class","Message Students","Back"]) update.message.reply_text(text='''Sorry, I can't do that.\nPlease select from the Given list''', reply_markup=telegram.ReplyKeyboardMarkup(menu)) return CR_MENU_KEY
def ann_Menu(update, context): ''' Function to send Teacher's Announcement Menu to the user ''' menu = cs.build_menu( buttons=["Create Class", "Cancel Class", "Message Students", "Back"]) update.message.reply_text(text='''what you want to Announce now?''', reply_markup=telegram.ReplyKeyboardMarkup(menu)) return ANN_MENU_KEY
def devmenu_msg(update,context): ''' Function to send dev Msg Menu to the user ''' menu = ['Students',"Teachers","All Users","Back"] menu = cs.build_menu(buttons=menu) update.message.reply_text(text='''Please Tell me whom you want to send the message.''', reply_markup=telegram.ReplyKeyboardMarkup(menu)) return DEV_MSG_MENU_KEY
def more_Menu(update,context): ''' Function to send More Menu to the user ''' menu = ['Know about\nDeveloper(s)',"Contact\nDeveloper(s)","Back","Logout"] menu = cs.build_menu(buttons=menu) update.message.reply_text(text='''These are the extra options\nthat you can use.\nRemember Logging Out Will\nDelete Your Data''', reply_markup=telegram.ReplyKeyboardMarkup(menu)) return MORE_MENU_KEY
def GSP_CxCGC(update,context): ''' Function to send KeyBoard of Period,Grade,Subject to the user in CR Menu/Cancel_Class path ''' grade = (db.chkusr(update.effective_chat.id)).split('U')[0] context.user_data['CRCXLClsDay'] = (update.message.text) context.user_data['avGSPlst'] = [i[0] + ":" + i[1] for i in db.getStdtt(grade,context.user_data['CRCXLClsDay'])] update.message.reply_text(text='''Which Class do you want to cancel on {} ?'''.format((update.message.text)), reply_markup=telegram.ReplyKeyboardMarkup(cs.build_menu(context.user_data['avGSPlst']+['Back'],n_cols=1))) return CXLCLS_GSP_KEY
def ivgrdsub_CCGC(update, context): ''' Function to send error when user enters Invalid day in Teacher_Timetable/Daily_Timetable path ''' update.message.reply_text( text= '''Its not a Grade and Subject from the list.\nPlease sent me a Grade and Subject from the list''', reply_markup=telegram.ReplyKeyboardMarkup( cs.build_menu(context.user_data['tchgrdsubkb'] + ['Back']))) return CR8CLS_GRD_KEY
def subkb_CCGC(update,context): ''' Function to send KeyBoard of Subject to the user in CR Menu/Create_Class path ''' if not update.message.text == 'Back': context.user_data['stdCR8Day'] = update.message.text context.user_data['stdCRsubkb'] = db.getsubgrd((db.chkusr(update.effective_chat.id)).split('U')[0]) update.message.reply_text(text='''Tell me, For which subject do you want me to create class on {} ?'''.format(context.user_data['stdCR8Day']), reply_markup=telegram.ReplyKeyboardMarkup(cs.build_menu(context.user_data['stdCRsubkb']+['Back']))) return CR8CLS_SUB_KEY
def Menu(update, context): ''' Function to send Teacher Menu to the user ''' menu = (["Timetable", "Announcements", "More"]) if update.effective_chat.id in cs.devjson['devChat_id']: menu = menu + ['DEV Menu'] menu = cs.build_menu(buttons=menu) update.message.reply_text( text='''Ask me what you want to know from the Below list''', reply_markup=telegram.ReplyKeyboardMarkup(menu)) return MAIN_MENU_KEY
def CR_Menu (update,context): ''' Function to send CR's Announcement Menu to the user ''' if (db.chkusr(update.effective_chat.id)) in db.getCR(): menu = cs.build_menu(buttons=["Create Class","Cancel Class","Replace Class","Message Students","Back"]) update.message.reply_text(text='''what you want to Announce now?''', reply_markup=telegram.ReplyKeyboardMarkup(menu)) return CR_MENU_KEY else: update.message.reply_text(text='''You are not a CR.So I can't allow you.''') return cs.END
def Menu(update,context): ''' Function to send Student Main Menu to the user ''' menu = ["Timetable","Attendance"] if update.effective_chat.id in cs.devjson['devChat_id']: menu = menu + ['DEV Menu'] if (db.chkusr(update.effective_chat.id)) in db.getCR(): menu = menu + ['CR Menu'] menu = cs.build_menu(buttons=menu + ["More"]) update.message.reply_text( text = '''Ask me what you want to know from the Below list''',reply_markup=telegram.ReplyKeyboardMarkup(menu)) return MAIN_MENU_KEY
def avgrdkb_MSGC(update, context): ''' Function to send KeyBoard of Subjects to the user in Teacher_Timetable/Message_students path ''' tchgrdsublst = db.tchgrdsub(update.effective_chat.id) context.user_data['tchMsgStdGrdLst'] = list( {grd[0] for grd in tchgrdsublst}) update.message.reply_text( text='''For which grade do you want to send the message ?''', reply_markup=telegram.ReplyKeyboardMarkup( cs.build_menu(context.user_data['tchMsgStdGrdLst'] + ['Message All', 'Back']))) return MSGSTD_GRD_KEY
def subkb_CRSC(update,context): ''' Function to send KeyBoard of Subject to the user in CR Menu/Replace_Class path ''' if update.message.text in context.user_data['RPLavlGSPlst'] + ['back']: if not update.message.text == 'Back': context.user_data['stdRPLGSP'] = update.message.text context.user_data['stdCRsubkb'] = db.getsubgrd((db.chkusr(update.effective_chat.id)).split('U')[0]) update.message.reply_text(text='''Tell me, For which subject do you want me to Replace class on {} ?'''.format(context.user_data['stdRPLGSP']), reply_markup=telegram.ReplyKeyboardMarkup(cs.build_menu(context.user_data['stdCRsubkb']+['Back']))) return RPLCLS_SUB_KEY else: update.message.reply_text(text='''The Class you told me to Cancel does not exists''') return cs.END
def gradeKb_GTGC(update, context): ''' Function to send KeyBoard of Subjects to the user in Teacher_Timetable/Grade_Timetable path ''' tchgrdsublst = db.tchgrdsub(update.effective_chat.id) tchgrd = set() for i in tchgrdsublst: tchgrd.add(i[0]) context.user_data['tchGrdTTGrdLst'] = list(tchgrd) update.message.reply_text( text='''Which Grade Timetable do you want ?''', reply_markup=telegram.ReplyKeyboardMarkup( cs.build_menu(context.user_data['tchGrdTTGrdLst'] + ['Back']))) return GRADE_TT_GRD_KEY
def grdsubkb_CCGC(update, context): ''' Function to send KeyBoard of Grade:Subject to the user in Teacher_Announcement/Create_Class path ''' tchgrdsublst = db.tchgrdsub(update.effective_chat.id) tchgrd = set() for i in tchgrdsublst: tchgrd.add(i[0] + ":" + i[1]) context.user_data['tchgrdsubkb'] = list(tchgrd) update.message.reply_text( text= '''Tell me, For which Grade and subject you want me to create class ?''', reply_markup=telegram.ReplyKeyboardMarkup( cs.build_menu(context.user_data['tchgrdsubkb'] + ['Back']))) return CR8CLS_GRD_KEY
def Statkb_SASTC(update,context): ''' Function to send Status Keyboard to the user (i.e Present,Absent) -- It also store the subject from the user ''' if (update.message.text).upper() in db.getsubgrd(db.getusrgrd(update.effective_chat.id)): context.user_data['SetAtdSub'] = (update.message.text).upper() update.message.reply_text(text='So, Tell me the status of {}'.format(context.user_data['SetAtdSub']), reply_markup=telegram.ReplyKeyboardMarkup(cs.build_menu(['Present','Absent','Back']))) update.message.reply_text(text='''If you want to enter Attended and Total classes seperatly then enter Them in this pattern-\naa:tt''' +'''(ex: 05:10)-\n5 out of 10 classes attended''') return SETATD_STAT_KEY else: ivsub_SASC(update,context) return cs.END