mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-22 01:37:50 +00:00
Commit hoarding is a terrible practice
This commit is contained in:
+13
-3
@@ -1,13 +1,15 @@
|
||||
import asyncio
|
||||
from typing import Dict
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from discord.ext.commands import Cog
|
||||
|
||||
from bot import TuneBot
|
||||
if TYPE_CHECKING:
|
||||
from tunebot import BasePluginInstance
|
||||
from bot import TuneBot
|
||||
|
||||
|
||||
class BaseCog(Cog):
|
||||
def __init__(self, bot: TuneBot) -> None:
|
||||
def __init__(self, bot: "TuneBot") -> None:
|
||||
self.bot = bot
|
||||
|
||||
slash_descriptions: Dict[str, str] = self.bot.config["slash_descriptions"]
|
||||
@@ -20,3 +22,11 @@ class BaseCog(Cog):
|
||||
hasattr(self.bot, "lavalink")
|
||||
and len(self.bot.lavalink.node_manager.available_nodes) > 0
|
||||
)
|
||||
|
||||
|
||||
class PluginCog(BaseCog):
|
||||
def get_plugin_instance(self, name: str) -> "BasePluginInstance":
|
||||
if plugin := self.bot.plugin_manager.get_plugin(name):
|
||||
return plugin
|
||||
|
||||
raise KeyError(f"Failed to retrieve plugin instance with name: {name}")
|
||||
|
||||
Reference in New Issue
Block a user