Compare commits

..

No commits in common. "5d7698462a37d49a90d3336ab00c00e57a6a764e" and "f9b45edd54c56f0512c2e9a989d3d82ac51a2135" have entirely different histories.

2 changed files with 3 additions and 13 deletions

14
main.py
View File

@ -9,7 +9,6 @@ from pprint import pprint
from dotenv import load_dotenv
from telegram import Update, user
import telegram
from telegram.ext import (CallbackContext, CommandHandler, MessageHandler,
Updater)
@ -91,18 +90,9 @@ class Bot:
def cmd_unread(self, update: Update, context: CallbackContext):
# TODO: ignore messages from group
user_id = update.effective_user.id
self.send_unread(context.bot, user_id)
def send_unread(self, bot: telegram.Bot, user_id: str):
with self.db as db:
unread = Link.get_unread(db, user_id)
bot.send_message(
user_id, f"**Your unread links as of {datetime.now().isoformat()}:", parse_mode="MARKDOWN")
for link in unread:
bot.send_message(user_id, link.link)
# TODO: button to read or postpone
# TODO: button to mark all as read or postpone
links = Link.get_unread(db, user_id)
pprint(list(links))
def _natural_count(self, n, singular, plural):
if abs(n) == 1:

View File

@ -31,7 +31,7 @@ class Link:
return cls(
id=id,
link=link,
user_id=user_id,
user_id=useredid,
read_at=read_at,
added_at=added_at
)