| 35 | | identify(ievent) |
|---|
| 36 | | reply = repr(parse(ievent.txt,fuzzy=True)) |
|---|
| 37 | | ievent.reply(reply) |
|---|
| 38 | | |
|---|
| 39 | | def identify(ievent): |
|---|
| 40 | | pass |
|---|
| | 36 | """ The main `parser` |
|---|
| | 37 | INPUT: Ircevent """ |
|---|
| | 38 | #First Type: 5 hours (assumed current day) |
|---|
| | 39 | #Second Type: 1 AM to 5 PM |
|---|
| | 40 | #Third Type: ON Sunday: 5 hours or so |
|---|
| | 41 | #Fourth Type: ON Sunday: 1 AM to 5 PM |
|---|
| | 42 | setdate = re.findall(r"on (\b\w+\b).?:", ievent.txt, re.I) |
|---|
| | 43 | if (setdate): |
|---|
| | 44 | day = setdate[0] |
|---|
| | 45 | adjustment = timedelta(days=0) |
|---|
| | 46 | weekdays = ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'] |
|---|
| | 47 | if (day in weekdays): |
|---|
| | 48 | adjustment = timedelta(days=7) |
|---|
| | 49 | date = parse(day, fuzzy = True) - adjustment |
|---|
| | 50 | reply = "Day to be used: " + date.ctime() |
|---|
| | 51 | ievent.reply(reply) |
|---|