Improved type-hinting and overall sanity checks implemented.
This commit is contained in:
@@ -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))
|
||||
|
Reference in New Issue
Block a user