Browse Source

Update linktitler for new reddit api

dave/xdcc
dave 5 years ago
parent
commit
5a08b449c7
  1. 8
      examples/data/config/LinkTitler.json
  2. 2
      examples/docker/Dockerfile
  3. 5
      pyircbot/modules/LinkTitler.py

8
examples/data/config/LinkTitler.json

@ -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": ""
}

2
examples/docker/Dockerfile

@ -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 && \

5
pyircbot/modules/LinkTitler.py

@ -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" % {

Loading…
Cancel
Save