Poodletooth-iLand/toontown/toon/QuestionMgrCustom.py

27 lines
948 B
Python
Raw Normal View History

2015-03-03 16:10:12 -06:00
import random
class QuestionMgr:
def __init__(self):
self.greetings = ['hi', 'hello', 'hey', 'sup', 'howdy', 'yo']
self.greetingResp = ['Hello there, ', 'Howdy there, ', 'Hows it hanging, ', 'How do you do, ', 'Whats up, ', 'Woah! You scared me there ']
self.response = ''
self.confused = 1
def ask(self, message, sender):
msg = message.lower()
vbls = msg.split()
for i in xrange(0, len(vbls)):
if vbls[i] in self.greetings:
index = random.randint(0, len(self.greetingResp) -1)
helloResp = self.greetingResp[index]
respFinal = helloResp + '%s' % sender + '!'
self.response += helloResp
self.confused = 0
else:
if self.confused:
self.response += 'Dang, I really don\'t understand you.'
self.confused = 1
return self.response