Skip to content

Commit

Permalink
expand read me, bump vers
Browse files Browse the repository at this point in the history
  • Loading branch information
fitnr committed Feb 14, 2015
1 parent 0e489a1 commit 48934fd
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
7 changes: 7 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
0.2.4
-----

* `Twitter_markov` class no longer extends Tweepy.API, so an existing API object can be passed in
* Cleaned up code around brain naming.
* Expanded readme.

0.2
---

Expand Down
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,29 @@ On a *nix system, set up a cron job like so:
0 10-20 * * * twittermarkov --tweet example_screen_name
15,45 10-20 * * * twittermarkov --reply example_screen_name
````

## API

If you want to write a script to expand on twitter_markov, the api is fairly simple.

#### class twitter_markov.Twitter_markov(screen_name, brains=None, config=None, api=None)

* screen_name - Twitter user account
* brains - Path to a brain file, or a list of paths. If omitted, Twitter_markov looks in its config for a `brains` entry.
* config - A dictionary of configuration settings. But default, twitter_markov will try to read this from the bots.yaml file (see above)/
* api - A tweepy-like API object. In the twitter_markov class, this is a `twitter_bot_utils.API` object.

The first brain in brains (or in the config file) will be the default brain.

Properties:
* recently_tweeted - A list of the 20 (or `config['checkback']`) most recent tweets `screen_name`.

Methods:

* `check_tweet(text)`: Check if a string contains blacklisted words or is similar to a recent tweet.
* `reply(status, brainname=None): Compose a reply to the given `tweepy.Status`. Brainname could refer to the filename of a given brain (for instance, "special" for the brain stored at "dir/special.brain").
* `reply_all(brainname=None)`: Reply to all mentions since the last time `self.screen_name` sent a reply tweet.
* `compose(catalyst='', brainname=None, max_len=140)`: Returns a string generated "brainname" (or the default brain).
* `tweet(catylyst='', brainname=None)`: Post a tweet composed by giving "catalyst" to "brainname" (or the default brain).
* `learn_parent(brainname=None)`: Learn recent tweets (since the last time `self.screen_name` tweeted) by the parent account. This is subject to the filters described in `bots.yaml`.
2 changes: 1 addition & 1 deletion bots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ users:
language: english

# Words to never tweet
# These will be added to a built in blacklist, taken from https://github.com/dariusk/wordfilter
# These will be added to a built-in blacklist, taken from https://github.com/dariusk/wordfilter
#
blacklist:
- badword
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def read_md(f):
setup(
name='twitter_markov',

version='0.2.3',
version='0.2.4',

description='Create markov chain ("_ebooks") accounts on Twitter',

Expand Down

0 comments on commit 48934fd

Please # to comment.