Add guild_member_stats table and update permissions for Discord members

- Created a new table `guild_member_stats` to track message counts and voice activity for users in each guild.
- Updated the database schema and models to include the new table.
- Added a new permission entry for `discord_members` in the `webapp_page_permission` table.
- Enhanced the webapp to include links and settings for managing Discord member statistics.
This commit is contained in:
2026-03-25 22:52:32 +01:00
parent bb92c3dd92
commit 855c13c183
10 changed files with 535 additions and 2 deletions
+6 -1
View File
@@ -29,6 +29,7 @@ from discordbot.welcome import sendWelcomeMessage, sendLeaveMessage, updateInvit
from discordbot.patreon import checkPatreonPosts
from discordbot.youtube import checkYouTubeVideos
from discordbot.auto_rooms import on_voice_state_update_auto_rooms, on_raw_reaction_add_auto_rooms, on_message_auto_rooms, cleanup_orphaned_auto_rooms
from discordbot.member_stats import record_message, on_voice_state_update_track_voice
from protondb import searhProtonDb
class DiscordBot(discord.Client):
@@ -167,7 +168,10 @@ async def on_message(message: Message):
# Gestion des messages dans les auto rooms (avant le check des commandes !)
await on_message_auto_rooms(bot, message)
if message.guild and not message.author.bot:
record_message(message.guild.id, message.author.id)
if not message.content.startswith('!'):
return
command_name = message.content.split()[0]
@@ -331,6 +335,7 @@ async def on_message(message: Message):
@bot.event
async def on_voice_state_update(member: Member, before, after):
await on_voice_state_update_auto_rooms(bot, member, before, after)
on_voice_state_update_track_voice(member, before, after)
@bot.event
async def on_raw_reaction_add(payload: discord.RawReactionActionEvent):