aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2025-10-01 15:58:17 +0100
committerjwansek <eddie.atten.ea29@gmail.com>2025-10-01 15:58:17 +0100
commitc01ae2c33ccf8d40b3957d918cc7c58eb60d3eaf (patch)
treee602cbb0d18c929775e8a6d4fe975027064d2756
parentfd5bfccc9c3074849d714bde98b6467e6532e721 (diff)
downloadSmallYTChannelBot-c01ae2c33ccf8d40b3957d918cc7c58eb60d3eaf.tar.gz
SmallYTChannelBot-c01ae2c33ccf8d40b3957d918cc7c58eb60d3eaf.zip
Removed references to the imgur API since it is no longer avaliable in the UK
-rwxr-xr-xcron/daily.py78
-rwxr-xr-xsubreddit.py4
2 files changed, 41 insertions, 41 deletions
diff --git a/cron/daily.py b/cron/daily.py
index 0f93d23..c7eadab 100755
--- a/cron/daily.py
+++ b/cron/daily.py
@@ -15,7 +15,7 @@ def main():
with database.Database() as db:
db.update_stats()
subreddit.display("Posting and updating wiki...")
- update_tables(db.get_scores(), db.get_stats())
+ # update_tables(db.get_scores(), db.get_stats())
subreddit.display("Formatting leaderboard...")
leaderboard = format_monthly_leaderboard()
@@ -35,36 +35,36 @@ def main():
subreddit.logging.info("Called OAD prog @ %s" % subreddit.get_time())
-def update_tables(scores, data):
- # really ought to switch to jinja for this...
- content = ""
- date = str(datetime.date.today())
- mods = get_mods()
- imagepath = graph.make_graph(data)
- imageurl = upload_image(imagepath, date)
- bylambda = [i for i in sorted(scores, key = itemgetter(1), reverse = True) if i[0] not in mods][:10]
- byhelps = sorted(scores, key = itemgetter(2), reverse = True)[:10]
-
- content += "\n\n##/r/SmallYTChannel lambda tables: %s" % date
-
- content += "\n\n###By lambda:"
- content += "\n\nUsername|Lambda|Help given\n:--|:--|:--"
- for line in bylambda:
- content += "\n/u/%s|%i|%i" % (line[0], line[1], line[2])
-
- content += "\n\n###By Help given:"
- content += "\n\nUsername|Lambda|Help given\n:--|:--|:--"
- for line in byhelps:
- λ = str(line[1])
- if line[0] in mods:
- λ = "∞"
- content += "\n/u/%s|%s|%i" % (line[0], λ, line[2])
-
- content += "\n\n##Statistics from %s:\n\nIf you're looking at this through the wiki, not through the bot's profile, then" % (date)
- content += "the most up-to-date graph will be shown below. To see the graph at this date, follow [this link.](%s)" % (imageurl)
- content += "\n\n![](%%%%wikigraph%%%%)\n\nTotal λ in circulation|Useful advice given|Unique users\n:--|:--|:--\n%i|%i|%i" % (data[-1][1], data[-1][2], data[-1][3])
+# def update_tables(scores, data):
+# # really ought to switch to jinja for this...
+# content = ""
+# date = str(datetime.date.today())
+# mods = get_mods()
+# # imagepath = graph.make_graph(data)
+# # imageurl = upload_image(imagepath, date)
+# bylambda = [i for i in sorted(scores, key = itemgetter(1), reverse = True) if i[0] not in mods][:10]
+# byhelps = sorted(scores, key = itemgetter(2), reverse = True)[:10]
+
+# content += "\n\n##/r/SmallYTChannel lambda tables: %s" % date
+
+# content += "\n\n###By lambda:"
+# content += "\n\nUsername|Lambda|Help given\n:--|:--|:--"
+# for line in bylambda:
+# content += "\n/u/%s|%i|%i" % (line[0], line[1], line[2])
+
+# content += "\n\n###By Help given:"
+# content += "\n\nUsername|Lambda|Help given\n:--|:--|:--"
+# for line in byhelps:
+# λ = str(line[1])
+# if line[0] in mods:
+# λ = "∞"
+# content += "\n/u/%s|%s|%i" % (line[0], λ, line[2])
+
+# # content += "\n\n##Statistics from %s:\n\nIf you're looking at this through the wiki, not through the bot's profile, then" % (date)
+# # content += "the most up-to-date graph will be shown below. To see the graph at this date, follow [this link.](%s)" % (imageurl)
+# content += "\n\n![](%%%%wikigraph%%%%)\n\nTotal λ in circulation|Useful advice given|Unique users\n:--|:--|:--\n%i|%i|%i" % (data[-1][1], data[-1][2], data[-1][3])
- subreddit.REDDIT.subreddit("u_SmallYTChannelBot").submit("/r/SmallYTChannel Statistics: %s" % date, url = imageurl).reply(content)
+# # subreddit.REDDIT.subreddit("u_SmallYTChannelBot").submit("/r/SmallYTChannel Statistics: %s" % date, url = imageurl).reply(content)
def get_mods():
@@ -78,17 +78,17 @@ def format_monthly_leaderboard():
out += "/u/%s|%1s|%s|%sλ\n" % (username, subreddit.get_medal(λ)[:-1], times_helped, λ)
return out + "\nLast updated: %s" % subreddit.get_time()
-def upload_image(path, date):
- config = {
- 'album': None,
- 'name': 'SmallYTChannelBot Statistics graph: %s' % date,
- 'title': 'SmallYTChannelBot Statistics graph: %s' % date,
- 'description': 'SmallYTChannelBot Statistics graph: %s' % date
- }
+# def upload_image(path, date):
+# config = {
+# 'album': None,
+# 'name': 'SmallYTChannelBot Statistics graph: %s' % date,
+# 'title': 'SmallYTChannelBot Statistics graph: %s' % date,
+# 'description': 'SmallYTChannelBot Statistics graph: %s' % date
+# }
- image = subreddit.IMGUR.upload_from_path(path, config = config)
+# image = subreddit.IMGUR.upload_from_path(path, config = config)
- return "https://i.imgur.com/%s.png" % image["id"]
+# return "https://i.imgur.com/%s.png" % image["id"]
if __name__ == "__main__":
main()
diff --git a/subreddit.py b/subreddit.py
index 219f59a..5f12e74 100755
--- a/subreddit.py
+++ b/subreddit.py
@@ -1,4 +1,4 @@
-from imgurpython import ImgurClient
+# from imgurpython import ImgurClient
from operator import itemgetter
import praw.models
@@ -30,7 +30,7 @@ SUBREDDIT = REDDIT.subreddit(CONFIG["subreddit"])
COMMENT_TAIL = CONFIG["comment_tail"]
FREE_FLAIRS = CONFIG["free_flairs"]
-IMGUR = ImgurClient(**CONFIG["imgurapi"])
+# IMGUR = ImgurClient(**CONFIG["imgurapi"])
logging.basicConfig(
format = "%(message)s",