Skip to content

A Bot for Reddit that gets top Hot sorted picture from a given Subreddit and sets it as background.

License

Notifications You must be signed in to change notification settings

Kandeel4411/RedditWallpaperBot

Repository files navigation

🎇 RedditWallpaperBot 🔮

A Bot for Reddit that gets top Hot sorted picture from a given Subreddit and sets it as background.

Supported OS & Environments

Windows, Mac and Linux(Ubuntu, Linux Mint)

Prerequisite

  • Must have python3.6+ installed.

Installation: 🔨

  • Download the repository by clicking the green "Clone or download" button on the top-right of the repository's main page, then click on "Download ZIP"

  • Extract folder to desired location

  • With the Reddit account that the bot will use go to Preferences -> Apps and create an app. Pick any name, choose script, and set the redirect url to http://localhost. Description and about url can be blank.

Reddit App preferences

  • In etc/config.ini add your client id and client secret from the app you just created. Client id is the id underneath the name of the app. Client secret is labeled.

  • Choose one of the following methods:

    • Installing in closed environment (Recommended):
      • Install pipenv through pip.
        pip install pipenv

      • Open the extracted folder in terminal and run pipenv install.
        cd RedditWallpaperBot-master && pipenv install

    • Installing globally:
      • Open the extracted folder in terminal and run:
        pip install -r requirements.txt

Usage:

Usage Demo

Skip this step if you installed globally

  • Open extracted folder and run:
    pipenv shell

  • Run main.py.
    python main.py

Or:

  • Open extracted folder and run main.py script directly by double clicking.

Running the tests: 🔧

Tests are written using the pytest framework.

Open terminal and navigate to the project directory

  • If you installed globally run:
    pytest

  • If you installed using the pipenv method:

    • Run the following command to install pytest:
      pipenv install --dev
    • Close and re-open the terminal to the project directory and run:
      pytest

Importing: 📦

  • Notes: If you want to import the bot functions, it by default uses sys.exit() to exit program once an error has been caught. You may want to use bot.raise_bot_exception(option=True) to raise BotExceptions instead that you can catch.

Acknowledgement:

License: