added type hints all over the project, updated mypy to ignore missing types from libraries

This commit is contained in:
2025-11-29 18:56:44 +00:00
parent 7c6249b120
commit 4ef4bdf309
5 changed files with 211 additions and 85 deletions

25
bot.py
View File

@@ -1,20 +1,30 @@
"""
Groovy-Zilean Bot Class
Main bot implementation with cog loading and background tasks
"""
from typing import Any
from discord.ext import commands
from discord.ext import tasks
from cogs.music.main import music
from help import GroovyHelp # Import the new Help Cog
from help import GroovyHelp
cogs = [
# List of cogs to load on startup
cogs: list[type[commands.Cog]] = [
music,
GroovyHelp
]
class Groovy(commands.Bot):
def __init__(self, *args, **kwargs):
"""Custom bot class with automatic cog loading and inactivity checking"""
def __init__(self, *args: Any, **kwargs: Any) -> None:
# We force help_command to None because we are using a custom Cog for it
# But we pass all other args (like command_prefix) to the parent
super().__init__(*args, help_command=None, **kwargs)
async def on_ready(self):
async def on_ready(self) -> None:
import config # Imported here to avoid circular dependencies if any
# Set status
@@ -47,11 +57,12 @@ class Groovy(commands.Bot):
print(f"{self.user} is ready and online!")
@tasks.loop(seconds=30)
async def inactivity_checker(self):
"""Check for inactive voice connections"""
async def inactivity_checker(self) -> None:
"""Check for inactive voice connections every 30 seconds"""
from cogs.music import util
await util.check_inactivity(self)
@inactivity_checker.before_loop
async def before_inactivity_checker(self):
async def before_inactivity_checker(self) -> None:
"""Wait for bot to be ready before starting inactivity checker"""
await self.wait_until_ready()