skoocda / reddit

A collection of reddit bots and utilities

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

reddit

A collection of reddit bots and utilities, all written by /u/GoldenSights. Many of these are done via /r/botrequests+requestabot, and some are done on a whim.


###Before running any of my bots

Read this.

Do not put multiple programs in the same folder. They use SQL databases to store information and you musn't allow them to mix. You can always edit sql = sqlite3.connect('sql.db') to use a different filename for the database, but folders are nice.

Use descriptive useragents. Include a username by which admins can identify you. Tell what your bot is doing and why. Convince the admins that you aren't wasting their bandwidth. Inadequate useragents may cause your bot to get logged out in the middle of your session, and the program will crash. Abusive useragents can get your bot shadowbanned.

Reddit API rules


###Concerned about your password?

For the bots that require login information, I tell you to put your password in the Config area as PASSWORD. Understandably, you may be concerned about having your password stored in plain text on your computer.

If you replace

PASSWORD = ""

with

import getpass
PASSWORD = getpass.getpass("Password: ")

Then you will be asked to type in your bot's password when it starts using the getpass module. For additional security, you can put

del PASSWORD

immediately after r.login() so that the password variable is nowhere in the namespace.

Alternatively, for automated and semi-secure password storage, see Bot.py


###Bot.py

In a lot of my bots, you'll see

import bot

USERNAME = bot.uG

etc. This is a file in my python library which contains my username and my password. I use this system so that I can push this code to git without worrying about my password being seen.

To create your own bot.py is very simple. It's just a regular .py file which you save in C:\Python34\Lib. Then you just enter some variables

username = "GoldenSights"

password = "12345"

Then, when you import bot, you can type bot.username and get "GoldenSights". You can create as many variables as you want, including useragents and multiple account credentials.

About

A collection of reddit bots and utilities

License:Other


Languages

Language:Python 99.9%Language:Shell 0.1%