From 660c3106d50377c6c1beff5a83ca4284b42e7026 Mon Sep 17 00:00:00 2001 From: pocketjawa Date: Tue, 28 Feb 2017 23:08:35 -0500 Subject: [PATCH] Add framework for using reddit --- example_config.cfg | 6 +++++- pocketbot.py | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/example_config.cfg b/example_config.cfg index 8cb6c81..7bf5d4b 100644 --- a/example_config.cfg +++ b/example_config.cfg @@ -7,4 +7,8 @@ token: #Channel IDs -bot_channel_id: \ No newline at end of file +bot_channel_id: + +#Reddit Stuff +reddit_client_id: +reddit_client_secret: \ No newline at end of file diff --git a/pocketbot.py b/pocketbot.py index 23934c2..e8a3166 100644 --- a/pocketbot.py +++ b/pocketbot.py @@ -5,6 +5,7 @@ import configparser import datetime import random import xkcd +import praw #Import config file config = configparser.ConfigParser() @@ -13,6 +14,12 @@ config.read("/srv/discord-pocketbot/config.cfg") token = config.get("configuration", "token") bot_channel_id = discord.Object(id=config.get("configuration", "bot_channel_id")) +#Reddit Setup +reddit_client_id = config.get("configuration", "reddit_client_id") +reddit_client_secret = config.get("configuration", "reddit_client_secret") +reddit_user_agent = 'linux:com.pocketjawa.discord-pocketbot:v0.1 (by /u/pocketjava)' +reddit = praw.Reddit(client_id=reddit_client_id,client_secret=reddit_client_secret,user_agent=reddit_user_agent) + client = discord.Client() #Subroutine to get UPS Status