Skip to content

Commit bff4b63

Browse files
committed
Adding help functions to the spacebot modules
1 parent 9def6d3 commit bff4b63

File tree

7 files changed

+28
-0
lines changed

7 files changed

+28
-0
lines changed

checkin.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ def trackstate(bot):
2626
WHO = []
2727

2828
@willie.module.commands('checkin')
29+
@willie.module.example('.checkin','checkin')
2930
def checkin(bot, trigger):
31+
"""Adds you in to the list of people currently in the space"""
3032
global WHO
3133
if trigger.nick in WHO:
3234
bot.say(trigger.nick + ' is already checked in')
@@ -35,7 +37,9 @@ def checkin(bot, trigger):
3537
bot.say(trigger.nick + ' is now checked in')
3638

3739
@willie.module.commands('checkout')
40+
@willie.module.example('.checkout','checkout')
3841
def checkout(bot, trigger):
42+
"""Removes you from the list of people currently in the space"""
3943
global WHO
4044
if trigger.nick in WHO:
4145
WHO.remove(trigger.nick)
@@ -44,13 +48,17 @@ def checkout(bot, trigger):
4448
bot.say(trigger.nick + ' was not checked in')
4549

4650
@willie.module.commands('emptylist')
51+
@willie.module.example('.emptylist','emptylist')
4752
def emptylist(bot, trigger):
53+
"""Emptys the list of people currently checked in at the space"""
4854
global WHO
4955
WHO = []
5056
bot.say('Check-in list has been emptied')
5157

5258
@willie.module.commands('who')
59+
@willie.module.example('.who','who')
5360
def checkwho(bot, trigger):
61+
"""Returns the list of people currently checked in at the space"""
5462
global WHO
5563
peoplelist = ''
5664
if not WHO:
@@ -61,13 +69,17 @@ def checkwho(bot, trigger):
6169
bot.say(peoplelist)
6270

6371
@willie.module.commands('anoncheckin')
72+
@willie.module.example('.anoncheckin','anoncheckin')
6473
def anoncheckin(bot, trigger):
74+
"""Adds an anonymous user to the list of people currently checked in at the space"""
6575
global WHO
6676
WHO.append('anonymous')
6777
bot.say('anonymous is now checked in')
6878

6979
@willie.module.commands('anoncheckout')
80+
@willie.module.commands('.anoncheckout','anoncheckout')
7081
def anoncheckout(bot, trigger):
82+
"""Removes an anonymous user from the list of people currently checked in at the space"""
7183
global WHO
7284
if 'anonymous' in WHO:
7385
WHO.remove('anonymous')

flashlights.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
from willie.module import commands, interval
55

66
@willie.module.commands('alertspace')
7+
@willie.module.example('.alertspace','alertspace')
78
def spacestate(bot, trigger):
9+
"""Alerts the space by flashing the lights a few times"""
810
opener = urllib2.build_opener(urllib2.HTTPHandler)
911
request = urllib2.Request('http://10.0.20.32/api/0123456789abdcef0123456789abcdef/groups/0/action', data='{ "alert": "lselect" }')
1012
request.add_header('Content-Type', 'text/json')

spaceevents.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@ def getevents(bot, number):
3030
bot.say(stuff[0] + " - " + stuff[1])
3131

3232
@willie.module.commands('nextevents')
33+
@willie.module.example('.nextevents','nextevents')
3334
def eve(bot, trigger):
35+
"""Returns a list of the next events at the space"""
3436
eventnum = trigger.group(2)
3537
getevents(bot, 3)
3638

3739
@willie.module.commands('nextevent')
40+
@willie.module.example('.nextevent','nextevent')
3841
def nexteve(bot, trigger):
42+
"""Returns the next event at the space"""
3943
getevents(bot, 1)
4044

spacempd.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
PASSWORD = 'password goes here'
1111

1212
@willie.module.commands('mpd')
13+
@willie.module.example('.mpd playing or .mpd play or .mpd next','mpdplaying')
1314
def mpd(bot, trigger):
15+
"""Used to control the mpd music player at the space"""
1416
rulenum = trigger.group(2)
1517

1618
## MPD object instance

spacerules.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ def getrules():
2424
return therules
2525

2626
@willie.module.commands('rule')
27+
@willie.module.example('.rule 34','rule')
2728
def rule(bot, trigger):
29+
"""Returns a techinc rule from the wiki of the number specified"""
2830
rulenum = trigger.group(2)
2931
therules = getrules()
3032
try:

spacestate.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
import urllib2
1111

1212
@willie.module.commands('spacestate')
13+
@willie.module.example('.spacestate', 'Spacestate')
1314
def spacestate(bot, trigger):
15+
"""Replies with the current space state - Open/Closed"""
1416
response = urllib2.urlopen('http://techinc.nl/space/spacestate')
1517
html = response.read()
1618
bot.say('The space is currently ' + html)

spacestatechange.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ def trackstate(bot):
3636
SPACESTATE = state
3737

3838
@willie.module.commands('togglestate')
39+
@willie.module.example('.togglestate','togglestate')
3940
def togglestate(bot, trigger):
41+
"""Toggles the state of the space (open/closed)"""
4042
currentstate = checkstate()
4143
bot.say('Changing Spacestate')
4244
if currentstate == 'open':
@@ -46,7 +48,9 @@ def togglestate(bot, trigger):
4648
changestate(state)
4749

4850
@willie.module.commands('spacestate')
51+
@willie.module.example('.spacestate', 'spacestate')
4952
def spacestate(bot, trigger):
53+
"""Returns the current state of the space (open/closed)"""
5054
global SPACEURL
5155
response = urllib2.urlopen(SPACEURL)
5256
html = response.read()

0 commit comments

Comments
 (0)