Skip to main content

UNKNOWN

Project description

An extendable Python based Twitter bot which will reply to various keyworded tweets.

“Isn’t this against the ToS?”, I hear you ask. Well, sort of, but sort of not. Yes, it might be covered by the spamming or unsolicited mentions rules, but in my opinion, no more than some asshole going around correcting people manually, depending on your settings.

Example usage

Here’s my favourite use of the Corrections bot (and why I actually wrote this): the a lot correction bot:

# -*- coding: utf-8 -*-
from corrections import Correct
from random import choice

class Alot(Correct):
    auth = (OAUTH_TOKEN,
            OAUTH_SECRET,
            CONSUMER_KEY,
            CONSUMER_SECRET)
    phrases = ["alot"]
    cooldown = (60 * 5, 60 * 3)

    def reply(self, phrase, user):
        return choice([
            "@{user}: a lot*",
            "@{user}: Surely you mean 'a lot', right?",
            "@{user}: I think you meant 'a lot'!",
            "@{user}: Come on, use 'a lot', lazy..",
            "@{user}: Alot is sad you can't use 'a lot' right..",
            "@{user}: There should be a space in there somewhere.. 'a lot'*",
        ]).format(user=user)

if __name__ == "__main__":
    correct = Alot()
    correct()

Just for testing

Want to make sure your bot is functional but don’t want to start spamming tweets yet? Easy! Set dry = True in your Corrections class and Corrections won’t actually update your status.

class Alot(Correct):
    auth = (OAUTH_TOKEN,
            OAUTH_SECRET,
            CONSUMER_KEY,
            CONSUMER_SECRET)
    phrases = [...]
    cooldown = (...)
    dry = True

    def reply(...):
        # ...

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

corrections-0.2.3.tar.gz (4.5 kB view details)

Uploaded Source

File details

Details for the file corrections-0.2.3.tar.gz.

File metadata

File hashes

Hashes for corrections-0.2.3.tar.gz
Algorithm Hash digest
SHA256 a4b6efc71e4715a88fdd524d4a815326c4dab22b565d27898b3a22cd6fcfb7d2
MD5 bcc1e508b4fa09a8a619a587552e4543
BLAKE2b-256 edb8bf3ff314586b8fe924fbdbc62bfee64cddedae86954be501e7487d180bf4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page