Improved type-hinting and overall sanity checks implemented.

This commit is contained in:
kku
2024-12-16 20:34:37 +01:00
parent 5c763fc02e
commit c05cf64ae0
14 changed files with 193 additions and 165 deletions

View File

@@ -1,4 +1,5 @@
import logging
from typing import Dict, List, Any
from discord import Cog, Message
from discord.ext import commands
@@ -11,16 +12,17 @@ logger = logging.getLogger(__name__)
class Analytics(commands.Cog):
def __init__(self, client: PycordBot):
self.client = client
self.client: PycordBot = client
@Cog.listener()
async def on_message(self, message: Message):
async def on_message(self, message: Message) -> None:
if (
(message.author != self.client.user)
and (message.author.bot is False)
and (message.author.system is False)
):
stickers = []
stickers: List[Dict[str, Any]] = []
for sticker in message.stickers:
stickers.append(
{
@@ -31,7 +33,8 @@ class Analytics(commands.Cog):
}
)
attachments = []
attachments: List[Dict[str, Any]] = []
for attachment in message.attachments:
attachments.append(
{
@@ -57,5 +60,5 @@ class Analytics(commands.Cog):
)
def setup(client: PycordBot):
def setup(client: PycordBot) -> None:
client.add_cog(Analytics(client))