HackSoc/csbot

!week & !termdates commands do not cope well when no data is set

LordAro opened this issue · 1 comments

Alan can add exception data below

Nov 06 16:52:53 csyorkbot app/worker.1: [2018/11/06 16:52:53] (D:csbot.raw_log) >>> ':hackbot!~hackbot@runciman.hacksoc.org PRIVMSG #hacksoc :!week' 
Nov 06 16:52:53 csyorkbot app/worker.1: [2018/11/06 16:52:53] (I:csbot.pretty_log) [#hacksoc] <hackbot> !week 
Nov 06 16:52:53 csyorkbot app/worker.1: [2018/11/06 16:52:53] (I:csbot.pretty_log) Command ('week', '') fired by hackbot in channel #hacksoc 
Nov 06 16:52:53 csyorkbot app/worker.1: [2018/11/06 16:52:53] (E:asyncio) Unhandled exception in event task 
Nov 06 16:52:53 csyorkbot app/worker.1: future: <Task finished coro=<Bot.fire_command() done, defined at /app/csbot/core.py:160> exception=KeyError(None,)> 
Nov 06 16:52:53 csyorkbot app/worker.1: Traceback (most recent call last): 
Nov 06 16:52:53 csyorkbot app/worker.1:   File "/app/csbot/core.py", line 172, in fire_command 
Nov 06 16:52:53 csyorkbot app/worker.1:     yield from f(event) 
Nov 06 16:52:53 csyorkbot app/worker.1:   File "/app/.heroku/python/lib/python3.6/asyncio/coroutines.py", line 212, in coro 
Nov 06 16:52:53 csyorkbot app/worker.1:     res = func(*args, **kw) 
Nov 06 16:52:53 csyorkbot app/worker.1:   File "/app/csbot/plugins/termdates.py", line 85, in week 
Nov 06 16:52:53 csyorkbot app/worker.1:     term, weeknum = self._current_week() 
Nov 06 16:52:53 csyorkbot app/worker.1:   File "/app/csbot/plugins/termdates.py", line 138, in _current_week 
Nov 06 16:52:53 csyorkbot app/worker.1:     start, _ = self.terms[term] 
Nov 06 16:52:53 csyorkbot app/worker.1: KeyError: None