Update linktitler for new reddit api

This commit is contained in:
dave 2017-07-16 13:10:49 -07:00
parent 493a966a03
commit 5a08b449c7
3 changed files with 10 additions and 5 deletions

View File

@ -1,4 +1,10 @@
{
"agent": "pyircbot3 by /u/(changeme)",
"reddit": {
"user_agent": "pyircbot3 by /u/(changeme)",
"client_id": "",
"client_secret": "",
"username": "",
"password": ""
},
"youtube_api_key": ""
}

View File

@ -8,7 +8,7 @@ RUN sed -i -e 's/archive.ubuntu.com/mirrors.digitalocean.com/' /etc/apt/sources.
apt-get update && \
apt-get install -y python3 python3-setuptools python3-requests curl unzip sqlite3 && \
easy_install3 pip && \
pip3 install praw pytz && \
pip3 install praw==5.0.1 pytz && \
cd /tmp && \
curl -o bitcoinrpc.tar.gz https://codeload.github.com/dpedu/python-bitcoinrpc/tar.gz/master && \
tar zxvf bitcoinrpc.tar.gz && \

View File

@ -58,9 +58,8 @@ class LinkTitler(ModuleBase):
if submissionId in done:
continue
done.append(submissionId)
# TODO configurable user agent
r = praw.Reddit(self.config["agent"])
submission = r.get_submission(submission_id=submissionId)
r = praw.Reddit(**self.config["reddit"])
submission = r.submission(id=submissionId)
msg = "👽 \x02\x031,15REDDIT\x0f\x02 :: %(title)s \x02on \x02%(domain)s%(nsfw)s\x02 - points " \
"\x02%(points)s\x02 (%(percent)s↑) - comments \x02%(comments)s\x02 - by \x02%(author)s\x02 on " \
"\x02%(date)s\x02" % {