Giter VIP home page Giter VIP logo

not-a-bot's Introduction

Reddit Place Script 2022

Code style: black forthebadge forthebadge

About

This is a script to draw an image onto r/place (https://www.reddit.com/r/place/).

Features

  • Support for multiple accounts
  • Determines the cooldown time remaining for each account
  • Detects existing matching pixels on the r/place map and skips them
  • Automatically converts colors to the r/place color palette
  • Easy(ish) to read output with colors

Requirements

How to Get App Client ID and App Secret Key

You need to generate an app client id and app secret key for each account in order to use this script. Or, just create one, and add each username as a developer in the developer app settings. You will need to duplicate the client ID and secret in .env, though.

Steps:

  1. Visit https://www.reddit.com/prefs/apps
  2. Click "create (another) app" button at very bottom
  3. Select the "script" option and fill in the fields with anything

App ID Screenshot

Python Package Requirements

Install requirements from 'requirements.txt' file.

Windows

pip install -r requirements.txt

Other OS

pip3 install -r requirements.txt

MacOSX

If you are using MacOSX and encounter an SSL_CERTIFICATE error. Please apply the fix detailed https://stackoverflow.com/questions/42098126/mac-osx-python-ssl-sslerror-ssl-certificate-verify-failed-certificate-verify

Get Started

Move the file 'config_example.json' to config.json

Edit the values to replace with actual credentials and values

{
  //Where the image's path is
  "image_path": "image.png",
  // [x,y] where you want the top left pixel of the local image to be drawn on canvas
  "image_start_coords": [504, 436],
  // delay between starting threads (can be 0)
  "thread_delay": 2,
  // array of accounts to use
  "workers": {
    // username of account 1
    "worker1username": {
      // password of account 1
      "password": "password",
      // appid and secret (see How To Get App Client ID And App Secret Key)
      "client_id": "clientid",
      "client_secret": "clientsecret",
      // which pixel of the image to draw first
      "start_coords": [0, 0]
    },
    // username of account 2
    "worker1username": {
      // password of account 2
      "password": "password",
      // appid and secret (see How To Get App Client ID And App Secret Key)
      "client_id": "clientid",
      "client_secret": "clientsecret",
      // which pixel of the image to draw first
      "start_coords": [0, 0]
    }
    // etc... add as many accounts as you want (but reddit may detect you the more you add)
  }
}

Notes

  • Change image.jpg/png to specify what image to draw. One pixel is drawn every 5 minutes. PNG takes priority over JPG.

Run the Script

python3 main.py

Multiple Workers

Just create multiple child arrays to "workers" in the .json

{
  "image_path": "image.png",
  "image_start_coords": [741, 610],
  "thread_delay": 2,

  "workers": {
    "worker1username": {
      "password": "password",
      "client_id": "clientid",
      "client_secret": "clientsecret",
      "start_coords": [0, 0]
    },
    "worker2username": {
      "password": "password",
      "client_id": "clientid",
      "client_secret": "clientsecret",
      "start_coords": [0, 50]
    }
  }
}

In this case, the first worker will start drawing from (0, 0) and the second worker will start drawing from (0, 50) from the input image.jpg file.

This is useful if you want different threads drawing different parts of the image with different accounts.

Other Settings

If any JSON decoders errors are found, the config.json needs a fix. Make sure to add the below 2 lines in the file.

{
    "thread_delay": 2,
    "unverified_place_frequency": false,
}
  • thread_delay - Adds a delay between starting a new thread. Can be used to avoid ratelimiting

  • unverified_place_frequency - Sets the pixel place frequency to the unverified account limit

  • Transparency can be achieved by using the RGB value (69, 42, 0) in any part of your image

  • If you'd like, you can enable Verbose Mode by adding --verbose to "python main.py". This will output a lot more information, and not neccessarily in the right order, but it is useful for development and debugging.

Docker

A dockerfile is provided. Instructions on installing docker are outside the scope of this guide.

To build: After editing your config.json, run docker build . -t place-bot. and wait for the image to build

You can now run with

docker run place-bot

Developing

The nox CI job will run flake8 and black on the code. You can also do this locally by pip installing nox on your system and running nox in the repository directory.

not-a-bot's People

Contributors

randomblock1 avatar rdeepak2002 avatar risewill23 avatar ixi2101 avatar jakonl avatar entropyvalley avatar skyline-9 avatar robiot avatar gemcdaniel avatar johngilbert-ibm avatar reallylily avatar romainl972 avatar nsk126 avatar zorudarinku avatar marius851000 avatar rsedxcftvgyhbujnkiqwe avatar

Stargazers

 avatar Julia avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.