Skip to content

Commit

Permalink
Add parsing to the bot
Browse files Browse the repository at this point in the history
  • Loading branch information
mzanella committed Dec 9, 2017
1 parent faccdf5 commit 6875503
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion torrearchimedebot/bot/handlers/room_handler.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
from .abs_handler import AbsHandler
from ../parsing import *

class RoomHandler(AbsHandler):

def __init__(self, roomId):
self.roomId = roomId

def handleMessage(self):
return "Scheduling for " + self.roomId + ": WIP"
return schedulePrettyfier(URLParser().parseSchedule(self.roomId))

def schedulePrettyfier(scheduleObj):
schedule = scheduleObj.getSchedule()
toReturn = ''
if (not schedule):
toReturn = "The room is always empty today!"
else:
delimiter = " "
for time in schedule:
activity = schedule[time]
stop = 2
if (activity[2] == '')
stop = 1
toReturn += time
for i in range(0, stop):
toReturn = delimiter + activity[i]
toReturn += "\n"
return toReturn

0 comments on commit 6875503

Please sign in to comment.