Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace pretty_cron with cron_descriptor #83

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions matrix_reminder_bot/bot_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
from apscheduler.triggers.cron import CronTrigger
from apscheduler.triggers.date import DateTrigger
from apscheduler.triggers.interval import IntervalTrigger
from cron_descriptor import Options, get_description
from nio import AsyncClient, MatrixRoom
from nio.events.room_events import RoomMessageText
from pretty_cron import prettify_cron
from readabledelta import readabledelta

from matrix_reminder_bot.config import CONFIG
Expand Down Expand Up @@ -462,7 +462,9 @@ async def _list_reminders(self):
# Cron-based reminders
if isinstance(reminder.job.trigger, CronTrigger):
# A human-readable cron tab, in addition to the actual tab
line += f"{prettify_cron(reminder.cron_tab)} (`{reminder.cron_tab}`); next run {next_execution.humanize()}"
o = Options()
o.use_24hour_time_format = True
line += f"{get_description(reminder.cron_tab, options=o)} (`{reminder.cron_tab}`); next run {next_execution.humanize()}"

# One-time reminders
elif isinstance(reminder.job.trigger, DateTrigger):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def read_file(path_segments):
"apscheduler>=3.6.3",
"pytz>=2020.1",
"arrow>=0.17.0",
"pretty_cron>=1.2.0",
"cron_descriptor>=1.2.24",
],
extras_require={
"postgres": ["psycopg2>=2.8.5"],
Expand Down
Loading