added type hints all over the project, updated mypy to ignore missing types from libraries
This commit is contained in:
25
bot.py
25
bot.py
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user