From f0fb2fb281578d99584c5b5a685da3e86038d059 Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Sun, 10 Nov 2024 01:14:50 +1100 Subject: [PATCH] pubbot: Don't send updates with 0 increase These double messages happen occasionally, we want to just ignore them. --- zulip_bots/zulip_bots/pubbot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zulip_bots/zulip_bots/pubbot.py b/zulip_bots/zulip_bots/pubbot.py index 1acf493..8bece91 100644 --- a/zulip_bots/zulip_bots/pubbot.py +++ b/zulip_bots/zulip_bots/pubbot.py @@ -133,7 +133,8 @@ def main(conf_file, message_log_file, name=socket.gethostname()): log["giveaway_entries"] = entries entries_str = " ({} entries of ${:.2f})".format(entries, giveaway_amount) logging.info("New donation total: {}{}{}".format(msg["d"], increase_str, entries_str)) - client.send_to_stream("bot-spam", "Donation Firehose", "Donation total is now ${:.2f}{}{}".format(msg["d"], increase_str, entries_str)) + if increase is not None and increase > 0: + client.send_to_stream("bot-spam", "Donation Firehose", "Donation total is now ${:.2f}{}{}".format(msg["d"], increase_str, entries_str)) if increase is not None and increase >= 500: client.send_to_stream("bot-spam", "Notable Donations", "Large donation of ${:.2f} (total ${:.2f}){}".format(increase, msg['d'], entries_str)) total = msg["d"]