summaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authorDipesh Amin <yaypunkrock@gmail.com>2011-09-11 19:11:00 +0100
committerDipesh Amin <yaypunkrock@gmail.com>2011-09-11 19:11:00 +0100
commitb4e545b615dda839d2bf8159d6e43fbded084299 (patch)
tree63fd675b9edd6428179f7c59b18e6ea9d6e6bfa0 /main.py
parentd070b62bb77bb67dcc38ad460e8f487a53b9ba50 (diff)
downloadmanamarket-b4e545b615dda839d2bf8159d6e43fbded084299.tar.gz
manamarket-b4e545b615dda839d2bf8159d6e43fbded084299.tar.bz2
manamarket-b4e545b615dda839d2bf8159d6e43fbded084299.tar.xz
manamarket-b4e545b615dda839d2bf8159d6e43fbded084299.zip
Add a new eliza bot.
- set the trade timeout to 2 mins also.
Diffstat (limited to 'main.py')
-rwxr-xr-xmain.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/main.py b/main.py
index 105043e..d2adb4f 100755
--- a/main.py
+++ b/main.py
@@ -29,7 +29,7 @@ import tradey
import utils
import eliza
-chatbot = eliza.Agent([eliza.patternResps,eliza.defReplys])
+chatbot = eliza.eliza()
shop_broadcaster = utils.Broadcast()
trader_state = utils.TraderState()
ItemDB = utils.ItemDB()
@@ -601,8 +601,9 @@ def process_whisper(nick, msg, mapserv):
mapserv.sendall(whisper(nick, "Where are you?!? I can't trade with somebody who isn't here!"))
trader_state.reset()
else:
- msg = filter(lambda x: x in string.letters, msg)
- mapserv.sendall(whisper(nick, chatbot.tell(msg.lower())))
+ response = chatbot.respond(msg)
+ logging.info("Bot Response: "+response)
+ mapserv.sendall(whisper(nick, response))
#mapserv.sendall(whisper(nick, "Command not recognised, please whisper me !help for a full list of commands."))
def main():
@@ -734,7 +735,7 @@ def main():
# For unfinished trades - one way to distrupt service would be leaving a trade active.
if trader_state.Trading.test():
- if time.time() - trader_state.timer > 5*60:
+ if time.time() - trader_state.timer > 2*60:
logging.info("Trade Cancelled - Timeout.")
trader_state.timer = time.time()
mapserv.sendall(str(PacketOut(CMSG_TRADE_CANCEL_REQUEST)))