Skip to content
Sudoku solving twitter bot. https://twitter.com/easysudoku
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ml
out
webhook-scripts
.gitignore
LICENSE
README.md
example.png
generalresponses.data
generalsamples.data
image_processor.py
main.py
requirements.txt
server.py
sudoku_solver.py

README.md

Sudoku Solving Twitter Bot

Send a image of a unsolved Sudoku puzzle as a tweet to @easySudoku and get the solved puzzle as a reply.

Dependencies

Create and configure a Twitter app

  1. Create a Twitter app on apps.twitter.com

  2. On the Permissions tab > Access section > enable Read, Write and Access direct messages.

  3. On the Keys and Access Tokens tab > Your Access Token section > click Create my access token button.

  4. On the Keys and Access Tokens tab, take note of the consumer key, consumer secret, access token and access token secret.

Setup & Run

You have to follow these steps in the right order.

Setup Bot

  1. Install python requirements

    pip3 install -r requirements.txt
  2. Define key variables locally using the keys, access tokens noted previously and your twitter user id from gettwitterid.com (replace the text after the =)

    export CONSUMER_KEY={INSERT_CONSUMER_KEY}
    export CONSUMER_SECRET={INSERT_CONSUMER_SECRET}
    export ACCESS_TOKEN={INSERT_ACCESS_TOKEN}
    export ACCESS_TOKEN_SECRET={INSERT_ACCESS_TOKEN_SECRET}
    export PORT={INSERT_FLASK_PORT}
    export CURRENT_USER_ID={INSERT_USER_ID}

Deploy Bot

  1. Start the flask server
python3 server.py
  1. Make sure your flask server is public (for example with a nginx to https://your-domain.com/twitter)

Setup Twitter Webhook

  1. Setup Bot and Deploy the Bot

  2. Go to developer.twitter.com/environments

  3. On Account Activity API/Sandbox > Set up dev environment button > add Dev environment label

  4. Define environment variables locally using your Dev environment label and your webhook url like https://your-domain.com/twitter (replace the text after the =)

    export ENV_LABEL={INSERT_ENV_LABEL}
    export WEBHOOK_ULR={INSERT_WEBHHOK_URL}
  5. Add your URL as webhook

    python webhook-scripts/create-webhook.py
  6. Subscribe your twitter account to the created webhook

    python webhook-scripts/subscribe-webhook.py

License

This project is licensed under the MIT License - see the LICENSE file for details

You can’t perform that action at this time.