Compare commits
No commits in common. "5d7698462a37d49a90d3336ab00c00e57a6a764e" and "f9b45edd54c56f0512c2e9a989d3d82ac51a2135" have entirely different histories.
5d7698462a
...
f9b45edd54
14
main.py
14
main.py
|
|
@ -9,7 +9,6 @@ from pprint import pprint
|
||||||
|
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from telegram import Update, user
|
from telegram import Update, user
|
||||||
import telegram
|
|
||||||
from telegram.ext import (CallbackContext, CommandHandler, MessageHandler,
|
from telegram.ext import (CallbackContext, CommandHandler, MessageHandler,
|
||||||
Updater)
|
Updater)
|
||||||
|
|
||||||
|
|
@ -91,18 +90,9 @@ class Bot:
|
||||||
def cmd_unread(self, update: Update, context: CallbackContext):
|
def cmd_unread(self, update: Update, context: CallbackContext):
|
||||||
# TODO: ignore messages from group
|
# TODO: ignore messages from group
|
||||||
user_id = update.effective_user.id
|
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:
|
with self.db as db:
|
||||||
unread = Link.get_unread(db, user_id)
|
links = Link.get_unread(db, user_id)
|
||||||
|
pprint(list(links))
|
||||||
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
|
|
||||||
|
|
||||||
def _natural_count(self, n, singular, plural):
|
def _natural_count(self, n, singular, plural):
|
||||||
if abs(n) == 1:
|
if abs(n) == 1:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue