Fix praw stuff

This commit is contained in:
root 2017-11-08 14:38:11 +00:00
parent 0d0c4533bd
commit d4014a998b
2 changed files with 14 additions and 15 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
client.py client.py
*.pyc *.pyc
apikey.py apikey.py
redditcredentials.py

View File

@ -4,7 +4,7 @@ import random
import re import re
import requests import requests
import praw import praw
from client import * import client
from threading import Timer from threading import Timer
@sopel.module.commands('4matter') @sopel.module.commands('4matter')
@ -156,14 +156,16 @@ def hitler(bot, trigger):
@sopel.module.commands('hmm', 'hmmm') @sopel.module.commands('hmm', 'hmmm')
def hmm(bot, trigger): def hmm(bot, trigger):
# try: reddit = praw.Reddit(client_id=client.client_id, client_secret=client.client_secret, user_agent='asdfasdfasdfjhwrgth', username=client.username, password=client.password)
#try:
sub=reddit.subreddit('hmmm') sub=reddit.subreddit('hmmm')
posts=sub.new(limit=100) posts=sub.new(limit=100)
n=random.randint(0,100) n=random.randint(0,100)
for i, post in enumerate(posts): for i, post in enumerate(posts):
if i==n: if i==n:
bot.say(post.url) bot.say(post.url)
# except: #except:
# bot.say("Something something reddit's servers") # bot.say("Something something reddit's servers")
herooptions = [ herooptions = [
@ -444,13 +446,9 @@ def trivia(bot, trigger):
bot.say("No trivia for you!") bot.say("No trivia for you!")
reddit=praw.Reddit(client_id=client_id,
client_secret=client_secret,
user_agent='monerobux',
username=username,
password=password)
@sopel.module.commands('tinytrump') @sopel.module.commands('tinytrump')
def tinytrump(bot, trigger): def tinytrump(bot, trigger):
reddit = praw.Reddit(client_id=client.client_id, client_secret=client.client_secret, user_agent='asdfasdfasdfjhwrgth', username=client.username, password=client.password)
try: try:
sub=reddit.subreddit('tinytrump') sub=reddit.subreddit('tinytrump')
posts=sub.new(limit=100) posts=sub.new(limit=100)