From: CMDR furrycat Date: Wed, 2 Nov 2016 19:46:09 +0000 (+0000) Subject: Log something more useful when an announcement with no text is made. X-Git-Url: http://git.furryclan.net/?a=commitdiff_plain;h=b0692bcb7d19fd1527f2b5ccece3f2ae028243e7;p=furrycat%2Fcatbot.git Log something more useful when an announcement with no text is made. --- 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: