Discord/cogs/analytics.py

29 lines
731 B
Python
Raw Normal View History

2023-05-06 18:52:46 +03:00
import logging
2023-05-06 20:17:40 +03:00
from discord import Cog, Message
2023-05-06 18:52:46 +03:00
from discord.ext import commands
2023-05-06 20:17:40 +03:00
from modules.database import col_analytics
2023-05-06 18:52:46 +03:00
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,
}
)