From 0aefb97844c495c0235b8e2c3c88eda9609fc8ee Mon Sep 17 00:00:00 2001 From: Ahmed Date: Sat, 20 Jun 2026 16:08:04 +0300 Subject: fix: bit of vibed update --- alfred/feed.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'alfred/feed.py') diff --git a/alfred/feed.py b/alfred/feed.py index b4c1c28..4839181 100644 --- a/alfred/feed.py +++ b/alfred/feed.py @@ -12,6 +12,7 @@ Commands (owner only): import subprocess import os import sys +from datetime import date as _date from sopel import plugin @@ -21,8 +22,9 @@ if _alfred_dir not in _sys.path: _sys.path.insert(0, _alfred_dir) import helpstrings as h -FEEDS_FILE = '/home/ahmed/feeds.txt' -FEED_SCRIPT = '/home/ahmed/scripts/feed-gen.py' +FEEDS_FILE = '/home/ahmed/feeds.txt' +READ_POINT_FILE = '/home/ahmed/feed-read.txt' +FEED_SCRIPT = '/home/ahmed/scripts/feed-gen.py' def _is_owner(bot, trigger): @@ -128,4 +130,24 @@ def cmd_feed(bot, trigger): _refresh(bot) return + if sub == 'read': + if len(args) >= 2: + date_str = args[1].strip() + try: + from datetime import datetime + datetime.strptime(date_str, '%Y-%m-%d') + except ValueError: + bot.say('usage: !feed read [yyyy-mm-dd]') + return + else: + date_str = _date.today().strftime('%Y-%m-%d') + try: + with open(READ_POINT_FILE, 'w') as f: + f.write(date_str + '\n') + bot.say(f'read point set to {date_str}') + _refresh(bot) + except Exception as e: + bot.say(f'error: {e}') + return + bot.say(h.FEED_TOPIC) -- cgit v1.2.3