summaryrefslogtreecommitdiffstats
path: root/actions
diff options
context:
space:
mode:
authorjason2006-07-24 20:39:43 +0000
committerjason2006-07-24 20:39:43 +0000
commitc8a737e7e673db646a35819dab6aa560eea88a53 (patch)
tree2ba03a74333ad890260dcac90b1bccf289e4f9d4 /actions
parent862840e980954fd86a4dd675a158ec03f52e5d7f (diff)
downloadwarmachine-c8a737e7e673db646a35819dab6aa560eea88a53.tar.gz
warmachine-c8a737e7e673db646a35819dab6aa560eea88a53.zip
steve's initial framework
git-svn-id: svn://svn.zzq.org/warmachine/trunk@2 3ede8657-8418-0410-873f-eb3fb5a66eab
Diffstat (limited to 'actions')
-rw-r--r--actions/ActionMap.py16
-rw-r--r--actions/__init__.py0
-rw-r--r--actions/coin.py17
-rw-r--r--actions/deop.py8
-rw-r--r--actions/devoice.py8
-rw-r--r--actions/join.py7
-rw-r--r--actions/kick.py9
-rw-r--r--actions/op.py8
-rw-r--r--actions/part.py7
-rw-r--r--actions/pythondoc.py22
-rw-r--r--actions/quit.py7
-rw-r--r--actions/say.py11
-rw-r--r--actions/settopic.py11
-rw-r--r--actions/voice.py8
14 files changed, 139 insertions, 0 deletions
diff --git a/actions/ActionMap.py b/actions/ActionMap.py
new file mode 100644
index 0000000..4c8431f
--- /dev/null
+++ b/actions/ActionMap.py
@@ -0,0 +1,16 @@
1import say, op, deop, quit, part, voice, devoice
2import join, kick, pythondoc, settopic, coin
3
4actions = {}
5actions['say'] = say.say()
6actions['op'] = op.op()
7actions['deop'] = deop.deop()
8actions['quit'] = quit.quit()
9actions['part'] = part.part()
10actions['voice'] = voice.voice()
11actions['devoice'] = devoice.devoice()
12actions['kick'] = kick.kick()
13actions['join'] = join.join()
14actions['pythondoc'] = pythondoc.pythondoc()
15actions['settopic'] = settopic.settopic()
16actions['coin'] = coin.coin()
diff --git a/actions/__init__.py b/actions/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/actions/__init__.py
diff --git a/actions/coin.py b/actions/coin.py
new file mode 100644
index 0000000..05dfbda
--- /dev/null
+++ b/actions/coin.py
@@ -0,0 +1,17 @@
1import random
2
3class coin:
4
5 def __init__(self):
6 self = []
7
8 def getAction(self, data):
9 ret = int(random.random()*10)
10 print ret
11 thecoin = 'The coin lands on it\'s SIDE!!!'
12 if ret >= 6:
13 thecoin = "The coin lands on HEAD."
14 else:
15 thecoin = "The coin lands on TAILS."
16 input = data.split(' ')
17 return 'PRIVMSG ' + input[4] + ' :' + thecoin
diff --git a/actions/deop.py b/actions/deop.py
new file mode 100644
index 0000000..d9c61eb
--- /dev/null
+++ b/actions/deop.py
@@ -0,0 +1,8 @@
1class deop:
2
3 def __init__(self):
4 self = []
5
6 def getAction(self, data):
7 input = data.split(' ')
8 return 'MODE ' + input[5] + ' -o ' + input[6]
diff --git a/actions/devoice.py b/actions/devoice.py
new file mode 100644
index 0000000..9539634
--- /dev/null
+++ b/actions/devoice.py
@@ -0,0 +1,8 @@
1class devoice:
2
3 def __init__(self):
4 self = []
5
6 def getAction(self, data):
7 input = data.split(' ')
8 return 'MODE ' + input[5] + ' -v ' + input[6]
diff --git a/actions/join.py b/actions/join.py
new file mode 100644
index 0000000..7a36947
--- /dev/null
+++ b/actions/join.py
@@ -0,0 +1,7 @@
1class join:
2
3 def __init__(self):
4 self = []
5
6 def getAction(self, data):
7 return 'JOIN ' + data[data.index('join')+5:]
diff --git a/actions/kick.py b/actions/kick.py
new file mode 100644
index 0000000..86416fa
--- /dev/null
+++ b/actions/kick.py
@@ -0,0 +1,9 @@
1class kick:
2
3 def __init__(self):
4 self = []
5
6 def getAction(self, data):
7 input = data.split(' ')
8 return 'KICK ' + input[5] + ' ' + input[6]
9
diff --git a/actions/op.py b/actions/op.py
new file mode 100644
index 0000000..60102c4
--- /dev/null
+++ b/actions/op.py
@@ -0,0 +1,8 @@
1class op:
2
3 def __init__(self):
4 self = []
5
6 def getAction(self, data):
7 input = data.split(' ')
8 return 'MODE ' + input[5] + ' +o ' + input[6]
diff --git a/actions/part.py b/actions/part.py
new file mode 100644
index 0000000..f55e63f
--- /dev/null
+++ b/actions/part.py
@@ -0,0 +1,7 @@
1class part:
2
3 def __init__(self):
4 self = []
5
6 def getAction(self, data):
7 return 'PART ' + data[data.index('part')+5:]
diff --git a/actions/pythondoc.py b/actions/pythondoc.py
new file mode 100644
index 0000000..e420723
--- /dev/null
+++ b/actions/pythondoc.py
@@ -0,0 +1,22 @@
1import os
2
3class pythondoc:
4
5 def __init__(self):
6 self = []
7
8 def getAction(self, data):
9 try:
10 input = data.split(' ')
11 module = input[5].replace(' ', '')
12 try:
13 module2 = input[6][0:-2]
14 execstring = "python -c \"from " + module + " import " + module2 + "\nprint " + module2 + ".__doc__\n\" > /tmp/wmpycmd"
15 except:
16 module = input[5][0:-2]
17 execstring = "python -c \"import " + module + "\nprint " + module + ".__doc__\n\" > /tmp/wmpycmd"
18 os.system(execstring)
19 doc = file('/tmp/wmpycmd').read().replace("\n", " ")
20 except:
21 doc = "I don't know nuthn about that."
22 return 'PRIVMSG ' + input[2] + ' :' + doc
diff --git a/actions/quit.py b/actions/quit.py
new file mode 100644
index 0000000..c945f5d
--- /dev/null
+++ b/actions/quit.py
@@ -0,0 +1,7 @@
1class quit:
2
3 def __init__(self):
4 self = []
5
6 def getAction(self, data):
7 return 'QUIT\r\n'
diff --git a/actions/say.py b/actions/say.py
new file mode 100644
index 0000000..7c7273f
--- /dev/null
+++ b/actions/say.py
@@ -0,0 +1,11 @@
1class say:
2
3 def __init__(self):
4 self = []
5
6 def getAction(self, data):
7 input = data.split(' ')
8 words = ""
9 for word in input[6:]:
10 words += ' ' + word
11 return 'PRIVMSG ' + input[5] + ' :' + words[1:]
diff --git a/actions/settopic.py b/actions/settopic.py
new file mode 100644
index 0000000..8fa574a
--- /dev/null
+++ b/actions/settopic.py
@@ -0,0 +1,11 @@
1class settopic:
2
3 def __init__(self):
4 self = []
5
6 def getAction(self, data):
7 input = data.split(' ')
8 words = ""
9 for word in input[6:]:
10 words += ' ' + word
11 return 'TOPIC ' + input[5] + ' :' + words[1:]
diff --git a/actions/voice.py b/actions/voice.py
new file mode 100644
index 0000000..fe42d05
--- /dev/null
+++ b/actions/voice.py
@@ -0,0 +1,8 @@
1class voice:
2
3 def __init__(self):
4 self = []
5
6 def getAction(self, data):
7 input = data.split(' ')
8 return 'MODE ' + input[5] + ' +v ' + input[6]