This commit is contained in:
deathbybandaid 2019-06-19 10:59:41 -04:00
parent 63a02dfcc6
commit 9dd2503900
2 changed files with 3 additions and 9 deletions

View File

@ -28,7 +28,7 @@ class BotReddit():
"""This Logs all channels known to the server""" """This Logs all channels known to the server"""
def __init__(self): def __init__(self):
self.setup_reddit() self.setup_reddit()
self.dict = {} self.cache = {}
self.header = {'User-Agent': str(UserAgent().chrome)} self.header = {'User-Agent': str(UserAgent().chrome)}
self.client_id = botconfig.SpiceBot_Reddit.client_id self.client_id = botconfig.SpiceBot_Reddit.client_id
self.client_secret = botconfig.SpiceBot_Reddit.client_secret self.client_secret = botconfig.SpiceBot_Reddit.client_secret
@ -174,6 +174,7 @@ class BotReddit():
try: try:
subtype = self.praw.subreddit(sub).subreddit_type subtype = self.praw.subreddit(sub).subreddit_type
returndict["subtype"] = subtype
except Exception as e: except Exception as e:
returndict["exists"] = False returndict["exists"] = False
if str(e) == "received 403 HTTP response": if str(e) == "received 403 HTTP response":
@ -185,8 +186,6 @@ class BotReddit():
else: else:
returndict["error"] = str(sub + " appears to not have a type") returndict["error"] = str(sub + " appears to not have a type")
return returndict return returndict
return subtype
return returndict return returndict
def reddit_user_exists(self, user): def reddit_user_exists(self, user):

View File

@ -12,16 +12,11 @@ import sopel_modules.SpiceBot as SpiceBot
(?:\\/ | [^/])+ (?:\\/ | [^/])+
) )
""") """)
def bot_command_reddit_user(bot, trigger):
message = SpiceBot.reddit.prerun(trigger)
bot.osd(str(message))
@sopel.module.rule(r"""(?:)r/ @sopel.module.rule(r"""(?:)r/
( (
(?:\\/ | [^/])+ (?:\\/ | [^/])+
) )
""") """)
def bot_command_reddit_subreddit(bot, trigger): def bot_command_reddit_user(bot, trigger):
message = SpiceBot.reddit.prerun(trigger) message = SpiceBot.reddit.prerun(trigger)
bot.osd(str(message)) bot.osd(str(message))