From 1ee1730090df5d717ecd36692fa7accb64a32b13 Mon Sep 17 00:00:00 2001 From: James Date: Sat, 27 Oct 2018 12:02:10 +1300 Subject: [PATCH] [V3 Chatchart] Handle bot only content Sends a message when message history only contains bot content --- chatchart/chatchart.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/chatchart/chatchart.py b/chatchart/chatchart.py index d22a617..1238a3c 100644 --- a/chatchart/chatchart.py +++ b/chatchart/chatchart.py @@ -119,6 +119,10 @@ class Chatchart(BaseCog): msg_data["users"][whole_name]["msgcount"] = 1 msg_data["total count"] += 1 + if msg_data['users'] == {}: + await em.delete() + return await ctx.message.channel.send(f'Only bots have sent messages in {channel.mention}') + for usr in msg_data["users"]: pd = float(msg_data["users"][usr]["msgcount"]) / float(msg_data["total count"]) msg_data["users"][usr]["percent"] = round(pd * 100, 1)