Added analytics
This commit is contained in:
30
cogs/analytics.py
Normal file
30
cogs/analytics.py
Normal file
@@ -0,0 +1,30 @@
|
||||
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,
|
||||
}
|
||||
)
|
Reference in New Issue
Block a user