Discord/cogs/analytics.py
2023-05-06 19:17:40 +02:00

29 lines
731 B
Python

import logging
from discord import Cog, Message
from discord.ext import commands
from modules.database import col_analytics
logger = logging.getLogger(__name__)
class Analytics(commands.Cog):
def __init__(self, client):
self.client = client
@Cog.listener()
async def on_message(self, message: Message):
if (
(message.author != self.client.user)
and (message.author.bot == False)
and (message.author.system == False)
):
col_analytics.insert_one(
{
"message": message.content,
"user": message.author.id,
"channel": message.channel.id,
}
)