Skip to content

Commit

Permalink
Making checkin response more sensible when the space is closed.
Browse files Browse the repository at this point in the history
Informing that member list is emptied when closing the space.
  • Loading branch information
chotee committed Jan 12, 2017
1 parent fbf5e1b commit de2d6cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
7 changes: 6 additions & 1 deletion checkin.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import urllib2
import time

import willie
from willie.module import commands, interval

from spacestatechange import SPACESTATE

INTERVAL = 5
SPACESTATE="unknown"
CHANNEL = "#techinc"
Expand All @@ -29,6 +31,9 @@ def trackstate(bot):
def checkin(bot, trigger):
"""Adds you in to the list of people currently in the space"""
global WHO
if SPACESTATE == "closed":
"Space is closed. %s cannot check-in. D'oh!" % trigger.nick
return
if trigger.host == 'bugblue.sponsor.oftc.net':
bot.say(trigger.nick + ' could not be checked in')
return
Expand Down
12 changes: 8 additions & 4 deletions spacestatechange.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import willie
from willie.module import commands, interval

from checkin import emptylist

INTERVAL = 5
SPACESTATE = "unknown"
CHANNEL = "#techinc"
Expand Down Expand Up @@ -40,12 +42,14 @@ def trackstate(bot):
def togglestate(bot, trigger):
"""Toggles the state of the space (open/closed)"""
currentstate = checkstate()
bot.say('Changing Spacestate')
if currentstate == 'open':
state = 'closed'
newstate = 'closed'
else:
state = 'open'
changestate(state)
newstate = 'open'
bot.say('Changing Spacestate from %s to %s' % (currentstate, newstate))
changestate(newstate)
if newstate == 'closed':
emptylist(bot, trigger)

@willie.module.commands('spacestate')
@willie.module.example('.spacestate', 'spacestate')
Expand Down

0 comments on commit de2d6cb

Please sign in to comment.