31 lines
743 B
Python
31 lines
743 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,
|
||
|
}
|
||
|
)
|