err-elizabot

a classic electronic shrink for the chatbot err
git clone https://git.ce9e.org/err-elizabot.git

commit
0260d39375b8da57d2593fc5c1d9d5010c23ba7e
parent
1442720ccb61dd0eeae235bf4da80b567add4dc8
Author
Tobias Bengfort <tobias.bengfort@gmx.net>
Date
2016-05-24 06:24
rm non-eliza commands

Diffstat

M elizaBot.py 34 +---------------------------------
D requirements.txt 2 --

2 files changed, 1 insertions, 35 deletions


diff --git a/elizaBot.py b/elizaBot.py

@@ -1,13 +1,6 @@
    1    -1 import json
    2    -1 from random import choice
    3    -1 from lxml import objectify
    4     1 from eliza import Eliza
    5    -1 from errbot import botcmd, BotPlugin, PY2
   -1     2 from errbot import botcmd, BotPlugin
    6     3 
    7    -1 if PY2:
    8    -1     from urllib2 import urlopen, quote
    9    -1 else:
   10    -1     from urllib.request import urlopen, quote
   11     4 
   12     5 class ElizaBot(BotPlugin):
   13     6     eliza_daemon = Eliza()
@@ -17,27 +10,3 @@ class ElizaBot(BotPlugin):
   17    10         """ El'cheapo shrink for you """
   18    11         args = args.strip()
   19    12         return self.eliza_daemon.respond(args)
   20    -1 
   21    -1     @botcmd
   22    -1     def askus(self, _, __):
   23    -1         """ Give us a fun topic to talk about
   24    -1             thx to http://chatoms.com/
   25    -1         """
   26    -1         content = urlopen('http://chatoms.com/chatom.json?Normal=1&Fun=2&Philosophy=3&Out+There=4&Love=5&Personal=7').read()
   27    -1         return json.loads(content.decode())['text']
   28    -1 
   29    -1     @botcmd
   30    -1     def complete(self, _, args):
   31    -1         """ Complete the given sentence
   32    -1             thx to the awesome google completion
   33    -1         """
   34    -1         args = args.strip()
   35    -1         if not args:
   36    -1             return 'Complete what ?'
   37    -1 
   38    -1         content = urlopen('http://google.com/complete/search?q=%s&output=toolbar' % quote(args)).read()
   39    -1         xml = objectify.fromstring(content)
   40    -1         possibilities = xml.xpath("//toplevel/CompleteSuggestion/suggestion/@data")
   41    -1         if possibilities:
   42    -1             return choice(possibilities)
   43    -1         return 'Hmmm... no answer for that
   43    -1 
\ No newline at end of file

diff --git a/requirements.txt b/requirements.txt

@@ -1 +0,0 @@
    1    -1 lxm
    1    -1 
\ No newline at end of file