Exemple #1
0
 # Check if comment has a valid code
 if len(code_list) == 1 and code_list[0].upper() in avail_codes:
     if code_list[0].upper() == TERM:
         reply += \
         "**Current Term: {}**\
         \n\nStart Date: {}\
         \n\nEnd Date: {}\
         \n\n-----------------------------------------------\
         \n\n"\
         .format(current_term,\
         dt.strptime(start_date, "%Y-%m-%d").date().strftime("%d %b, %Y"),\
         dt.strptime(end_date, "%Y-%m-%d").date().strftime("%d %b, %Y"))
     if code_list[0].upper() == HOLIDAYS:
         reply += \
         "**Holidays this term:** \n\n"
         for holiday in uw.holidays():
             date = dt.strptime(holiday.get("date"), "%Y-%m-%d").date()
             if date >= dt.strptime(start_date, "%Y-%m-%d").date() \
                 and date <= dt.strptime(end_date, "%Y-%m-%d").date():
                 reply += \
                 "*{}* on {}\
                 \n\n-----------------------------------------------\
                 \n\n"\
                 .format(holiday.get("name"), date.strftime("%d %b, %Y"))
     if code_list[0].upper() == HELP:
         reply += \
         "Hi, I am a bot. The following commands are what I support:\
         \n\nUsage: *[[{Keyword}]]*\
         \n\n**{Subject} {Course Number} |** Shows information about the course.\
         \n\n*[option] -S* | Shows available classes for the current term.\
         \n\n **HOLIDAYS |** Shows holidays for the current term.\