From b0692bcb7d19fd1527f2b5ccece3f2ae028243e7 Mon Sep 17 00:00:00 2001 From: CMDR furrycat Date: Wed, 2 Nov 2016 19:46:09 +0000 Subject: [PATCH] Log something more useful when an announcement with no text is made. --- plugin/announcements/announcements.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugin/announcements/announcements.py b/plugin/announcements/announcements.py index 166e0ff..b8984a8 100644 --- a/plugin/announcements/announcements.py +++ b/plugin/announcements/announcements.py @@ -836,19 +836,25 @@ class Announcements(DBConnection): filename = 'meow.wav' try: + logtext = text + if not logtext: + if attachment is not None: + logtext = attachment['filename'] + else: + logtext = 'No text' if bot.get('dryrun'): if not already_posted: if voice_only: log.info('Dryrun: Not playing announcement {} {} in {}'.format(announcement['id'], filename, channel)) else: - log.info('Dryrun: Not posting announcement {} to {}: {}'.format(announcement['id'], channel, text)) + log.info('Dryrun: Not posting announcement {} to {}: {}'.format(announcement['id'], channel, logtext)) else: announce = random.random() <= announcement['probability'] if not already_posted else 0 if announce: if voice_only: yield from bot.wake_up() else: - log.info('Posting announcement {} to {}: {}'.format(announcement['id'], channel, text)) + log.info('Posting announcement {} to {}: {}'.format(announcement['id'], channel, logtext)) message = yield from bot.say(channel, text, attachment = attachment) update['digest'] = bot.digest(message.content) else: -- 2.7.4