Discord/cogs/analytics.py

31 lines
743 B
Python
Raw Normal View History

2023-05-06 18:52:46 +03:00
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,
}
)