Skip to content

Commit

Permalink
feat(analytics): track sent messages
Browse files Browse the repository at this point in the history
chore: bump version
  • Loading branch information
omame committed Jan 1, 2023
1 parent ed98569 commit c95cbcd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bob/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Constants used by bob.
"""
__version__ = "2.8.0"
__version__ = "2.8.1"

import random

Expand Down
6 changes: 5 additions & 1 deletion cogs/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self, client: commands.Bot):
"blacklist": [],
"analytics": [],
}
self.messages_sent = 0
self.question_map = {}
if os.path.exists("topgg.txt"):
with open("topgg.txt") as file:
Expand Down Expand Up @@ -132,7 +133,10 @@ async def log_data(self):
responses = len([response for question in self.question_map.values() for response in question.responses])

self.logger.debug("adding analytics info...")
self.config["analytics"].append([len(self.question_map), responses, len(self.client.guilds), time.time()])
self.config["analytics"].append([len(self.question_map), responses, len(self.client.guilds), time.time(),
self.messages_sent])

self.messages_sent = 0

if len(self.config["analytics"]) > 30:
self.config["analytics"] = self.config["analytics"][-30:]
Expand Down
1 change: 1 addition & 0 deletions cogs/lar.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ async def reply(self, message: discord.Message):
if self.mod_mode.is_in_mod_mode(guild, message.author):
self.mod_mode.save_info(guild, message.author, message_reply, question, response)
self.logger.debug(f"reply: {message.clean_content} -> {text}")
self.config.messages_sent += 1

@commands.Cog.listener()
async def on_message(self, message: discord.Message):
Expand Down

0 comments on commit c95cbcd

Please sign in to comment.