Skip to main content

bottr

Bottr makes writing bots for reddit easy. It currently provides two predefined bots:

CommentBot:

Listens to new comments in a list of subreddits

SubmissionBot:

Listens to new submission in a list of subreddits

Bottr makes use of the Python Reddit API Wrapper PRAW.

Documentation: bottr.readthedocs.io

Check out [bottr-template](https://github.com/slang03/bottr-template) for a convenient code template to start with.

Installation

Bottr is available on PyPi and can be installed via

$ pip install bottr

Quick Start

The following is a quick example on how to monitor r/AskReddit for new comments. If a comment contains the string 'banana', the bot replies 'This comment is bananas.'

import praw
import time

from bottr.bot import CommentBot

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()

Metadata

Release files for bottr 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bottr 0.1.4
File Size Uploaded
bottr-0.1.4.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bottr 0.1.4
File Interpreter ABI Platform
bottr-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 15.3 kB

Release files / bottr-0.1.4.tar.gz

Download URL bottr-0.1.4.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
af897583a8d599e25dac6433e3c9930f98d3d190f9cc8310d09c95a7a139ac4b
BLAKE2b-256 checksum
How to use checksums
0036d9544cf3002d456848a45bcc18ea5f1fdec0fd6d95113ca9069201a546e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / bottr-0.1.4-py3-none-any.whl

Download URL bottr-0.1.4-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1eb249e940658906b494fdf096abc5f8f084bc2f714345dffc3f3963951873bd
BLAKE2b-256 checksum
How to use checksums
6aaecc6d7707e3222fc79422738ced52b6e7a14e39d60451b43d9cff4f702417
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page