Simple Reddit Bot Library
Project description
=====
bottr
=====
Bottr is supposed to make writing bots for reddit easy. It relies on the `Python Reddit API Wrapper`
`PRAW <http://praw.readthedocs.io/en/latest/index.html>`_.
.. toctree::
:maxdepth: 2
:caption: Contents:
setup
bots
Quick Start
-----------
The following is a quick example on how to monitor `r/AskReddit` for new comments. If a comment
contains the string :code:`'banana'`, the bot replies :code:`'This comment is bananas'`::
import praw
def parse_comment(comment):
"""Define what to do with a comment"""
if 'banana' in comment.body:
comment.reply('This comment is bananas.')
if __name__ == '__main__':
# Get reddit instance with login details
reddit = praw.Reddit(client_id='id',
client_secret='secret'',
password='botpassword',
user_agent='Script by /u/...',
username='botname')
# Create Bot with methods to parse comments
bot = CommentBot(reddit=reddit,
func_comment=parse_comment,
subreddits=['AskReddit'])
# Start Bot
bot.start()
# Run bot for 10 minutes
time.sleep(10*60)
# Stop Bot
bot.stop()
Check out :ref:`setup` to see how to get the arguments for :class:`praw.Reddit`.
bottr
=====
Bottr is supposed to make writing bots for reddit easy. It relies on the `Python Reddit API Wrapper`
`PRAW <http://praw.readthedocs.io/en/latest/index.html>`_.
.. toctree::
:maxdepth: 2
:caption: Contents:
setup
bots
Quick Start
-----------
The following is a quick example on how to monitor `r/AskReddit` for new comments. If a comment
contains the string :code:`'banana'`, the bot replies :code:`'This comment is bananas'`::
import praw
def parse_comment(comment):
"""Define what to do with a comment"""
if 'banana' in comment.body:
comment.reply('This comment is bananas.')
if __name__ == '__main__':
# Get reddit instance with login details
reddit = praw.Reddit(client_id='id',
client_secret='secret'',
password='botpassword',
user_agent='Script by /u/...',
username='botname')
# Create Bot with methods to parse comments
bot = CommentBot(reddit=reddit,
func_comment=parse_comment,
subreddits=['AskReddit'])
# Start Bot
bot.start()
# Run bot for 10 minutes
time.sleep(10*60)
# Stop Bot
bot.stop()
Check out :ref:`setup` to see how to get the arguments for :class:`praw.Reddit`.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bottr-0.1.0.tar.gz
(5.3 kB
view hashes)
Built Distributions
bottr-0.1.0-py3-none-any.whl
(7.3 kB
view hashes)
Close
Hashes for bottr-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fb3ebd4f2f2be06713baa6064854e65852bdd6f144b389808483a78e2dea4a1 |
|
MD5 | 1f70d48b38c689503b5f062d2669b2cd |
|
BLAKE2b-256 | 7a6a203603d00da576b28a0ecd33856c179ef1166d06dc7b0bf849be7cba6b59 |