Skip to content

Commit aff8c80

Browse files
committed
Only resend daily announcements as plain text if a captioned-photo version fails because of TooLong (see #82).
1 parent 470db44 commit aff8c80

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

metabot/modules/reminders.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,17 +164,17 @@ def reminder_send(bot, groupid, text, photo):
164164
"""Send a message with the given photo + caption, falling back to plain text."""
165165

166166
logging.info('Sending reminder to %s.', groupid)
167-
if photo:
168-
try:
169-
return bot.send_photo(chat_id=groupid,
170-
photo=photo,
171-
caption=text,
172-
parse_mode='HTML',
173-
disable_notification=True)
174-
except ntelebot.errors.Error: # See https://github.com/nmlorg/metabot/issues/76.
175-
logging.exception('Downgrading to plain text:')
176-
177167
try:
168+
if photo:
169+
try:
170+
return bot.send_photo(chat_id=groupid,
171+
photo=photo,
172+
caption=text,
173+
parse_mode='HTML',
174+
disable_notification=True)
175+
except ntelebot.errors.TooLong: # See https://github.com/nmlorg/metabot/issues/76.
176+
logging.info('Downgrading to plain text.')
177+
178178
return bot.send_message(chat_id=groupid,
179179
text=_truncate(text, ntelebot.limits.message_text_length_max),
180180
parse_mode='HTML',

0 commit comments

Comments
 (0)