diff options
Diffstat (limited to 'commands/announce.py')
-rw-r--r-- | commands/announce.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/commands/announce.py b/commands/announce.py index 733e8d8..46e6500 100644 --- a/commands/announce.py +++ b/commands/announce.py @@ -12,7 +12,8 @@ from telegram import Update, error from telegram.ext import ContextTypes -from strings import ANNOUNCEMENT_TEMPLATE, ANNOUNCEMENT_FINISHED_EVENT +from strings import ANNOUNCEMENT_TEMPLATE, ANNOUNCEMENT_FINISHED_EVENT, \ + ANNOUNCEMENT_EVENT_NEEDS_EDITING from utils import context_init, create_users_string, choose_next_user from predicates import has_unfinished_event @@ -31,7 +32,10 @@ async def create_announcement( last_event = events[-1] last_movie = movies[-1] - genres = " #".join(last_movie["genres"]) + if last_event["when"] is None or last_event["where"] is None or last_event["movie"] is None: + raise error.TelegramError(ANNOUNCEMENT_EVENT_NEEDS_EDITING) + + genres ="#" + " #".join(last_movie["genres"]) await update.message.reply_markdown( ANNOUNCEMENT_TEMPLATE.format( |