Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Edward

Join the chat at https://gitter.im/jahrik/edward

Dependencies

  • python 3.5+
  • Be sure to export envars first:
export REDDIT_CLIENT_ID=
export REDDIT_CLIENT_SECRET=
export REDDIT_USERNAME=
export REDDIT_PASSWORD=
export TWITTER_KEY=
export TWITTER_SECRET=
export TWITTER_TOKEN=
export TWITTER_TOKEN_SECRET=
export HIPCHAT_HOST=
export HIPCHAT_ROOM=
export HIPCHAT_ACCESS_TOKEN=
export GITTER_ROOM=
export GITTER_API_TOKEN=

TOC

Usage

Usage:
    ./edward.py [-l <level> | --level   <level>]
                [-t  <type> | --training <type>]
                [-b   <bot> | --bot       <bot>]
                [-e         | --export   <file>]
                [-h         | --help           ]
                [--version  ]

Options:
    -h --help               Show this screen and exit
    --version               Show version and exit
    -l --level=<level>      [default: info]
    -t --training=<type>    Training type:
                                english, word_list,
                                ubuntu, reddit, twitter
                                [default: None]

    -b --bot=<bot>          Run bot: [default: help]
                                gitter, hipchat, voice, feedback
                                [default: None]

Docker

Build and test with docker-compose

make test

Build and deploy to docker swarm

make deploy

docker stack services edward
ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
i3laoiilqi76        edward_mongo        replicated          1/1                 mongo:latest        *:27017->27017/tcp
qyio6ac50xyt        edward_bot          replicated          1/1                 bot:latest

Module defs

bot_on_bot()

bot_sploit()

  • Search for other bots on reddit
  • Talk to the other bots on reddit

chat_bot()

emoji_preprocessor(bot, statement)

english_training()

facebook_messenger_bot()

  • Connect to facebook messenger
  • API key?:

feedback_bot()

  • ask for input
  • present input_statement and response to user
  • ask if it makes sense
  • if no, user can fix
  • train bot

feedback(bot, comment)

  • parse comment for Master commands
  • return response

get_gitter_envars()

get_hipchat_envars()

  • get HipChat host, room, and api token from envars
  • obtain an api token at:
  • https://hipchat.com/admin/api
  • return hipchat_host, hipchat_room, hipchat_access_token

get_reddit_envars()

  • get Reddit creds from envars
  • return client_id, client_secret, username, password

get_reddit()

  • obtain client_id, client_secret, username, password from get_reddit_envars()
  • set reddit to praw.Reddit
  • return reddit

get_sub_comments(comment)

  • get sub comments from a reddit comment object as a list
  • generate a list of sub_comments from all replies
  • return sub_comments

get_twitter_envars()

  • get Twitter creds from envars
  • return twitter_key, twitter_secret, twitter_token, twitter_token_secret
  • create app https://apps.twitter.com/

gitter_bot()

Talk to bot with twitter or github access

hipchat_bot()

DOES NOT WORK YET

logging_setup()

  • setup logging
  • return logger

loop_trainer(input_s)

  • input_s str required default = None

    Input string

  • input string
  • process as input_statement
  • get statement and response form chat bot
  • if the response is not the same as the input string
  • train bot with conversation

main()

  • check docopt args

reddit_training(sub, lim)

  • sub str optional default = 'all'

    Which subreddit to use

  • lim int optional default = 9

    how many to grab

Configure

  • get base bot chat_bot()
  • get reddit from get_reddit()
  • configure read only true/false
  • sub = the subreddit to use
  • lim = the amount of submissions to grab from a chosen subreddit
  • slp = is set to keep from reaching reddit server rate limits

Training

  • training list starts as an empty list []
  • for every submission collect comment chains
  • for every comment in comment chains collect all replies
  • if the comment is not '[deleted]'
  • if reply is not '[removed]'
  • if reply is < 80 characters
  • append training list
  • Train the bot

twitter_bot()

  • Create a BotStreamListener(StreamListener) class
  • see details here: class StreamListener(object):
  • Start up bot on init()
  • watch for data
  • if 'direct_message' and not our user_id:
  • process a response for the message from the database
  • reply with response

twitter_training()

Train bot using data from Twitter.

ubuntu_training()

voice_bot()

  • input speech to text
  • output text to speech

word_list_training()

  • word_list contains 5000 most common words in English language
  • randomize the list
  • pool 4 child processes
  • run loop_trainer(input_s) with word as input s

TODO

About

No description, website, or topics provided.

Resources

Packages

No packages published