Skip to content

Commit 042a6bd

Browse files
authored
Merge pull request #326 from practical-python-org/fix/on-message-points-update
fix: on message points update
2 parents b79e533 + c422edc commit 042a6bd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/zorak/cogs/utility/points.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,16 @@ async def on_message(self, message: discord.Message):
3434
"""When a member sends a message, give them 1 point."""
3535
if message.author.bot:
3636
return
37-
self.bot.db_client.add_points_to_user(message.author.id, 1)
37+
message_value = len(message.content.split(" "))
38+
self.bot.db_client.add_points_to_user(message.author.id, abs(message_value))
3839

3940
@commands.Cog.listener()
4041
async def on_message_delete(self, message: discord.Message):
4142
"""When a member deletes a message, remove a point."""
43+
message_value = len(message.content.split(" "))
4244
mod_log = await self.bot.fetch_channel(self.bot.server_settings.log_channel["mod_log"])
43-
await mod_log.send(f"1 Point removed from {message.author} for deleting a message.")
44-
self.bot.db_client.remove_points_from_user(message.author.id, 1)
45+
await mod_log.send(f"{message_value} Point/s removed from {message.author} for deleting a message.")
46+
self.bot.db_client.remove_points_from_user(message.author.id, abs(message_value))
4547
#
4648
# # TODO: Fix the backup command.
4749
# # @commands.slash_command()

0 commit comments

Comments
 (0)