mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-22 01:37:50 +00:00
Merge pull request #44 from strNophix/lastfm-scrobbler
Plugins + lastfm scrobbler
This commit is contained in:
@@ -1,6 +1,16 @@
|
||||
from abc import ABC
|
||||
from abc import abstractmethod
|
||||
from typing import Any
|
||||
from typing import Optional
|
||||
from typing import Protocol
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Union
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from tunebot.plugins import ServiceEvent
|
||||
from discord.ext.commands import Cog
|
||||
|
||||
AnyDict = dict[Any, Any]
|
||||
|
||||
|
||||
class GlobalPlaylistSource(ABC):
|
||||
@@ -53,10 +63,53 @@ class AutoJoin(ABC):
|
||||
pass
|
||||
|
||||
|
||||
class ServiceBase(Protocol):
|
||||
async def on_dispatch(self, event: "ServiceEvent", payload: AnyDict):
|
||||
...
|
||||
|
||||
|
||||
class PluginManagerBase(Protocol):
|
||||
def get_plugin(self, name: str) -> Union["BasePluginInstance", None]:
|
||||
...
|
||||
|
||||
def remove_plugin(self, name: str):
|
||||
...
|
||||
|
||||
def enable_plugin(self, name: str, plugin: "BasePluginInstance"):
|
||||
...
|
||||
|
||||
async def dispatch(self, event: "ServiceEvent", payload: AnyDict = {}):
|
||||
...
|
||||
|
||||
|
||||
class PluginLoaderBase(Protocol):
|
||||
def load_plugin(self, plug_conf: AnyDict) -> "BasePluginInstance":
|
||||
...
|
||||
|
||||
|
||||
class GlobalUtils(Protocol):
|
||||
async def raw_table_lookup(self, table_name: str, keys: list[Any]) -> list[Any]:
|
||||
...
|
||||
|
||||
async def raw_table_del_entry(self, table_name: str, keys: list[Any]):
|
||||
...
|
||||
|
||||
|
||||
class BasePluginInstance(Protocol):
|
||||
config: AnyDict
|
||||
services: list["ServiceBase"]
|
||||
cogs: list[str]
|
||||
|
||||
|
||||
__all__ = (
|
||||
"GlobalPlaylistSource",
|
||||
"PlaylistSource",
|
||||
"GlobalPlaylist",
|
||||
"GlobalAutoJoin",
|
||||
"AutoJoin",
|
||||
"ServiceBase",
|
||||
"PluginManagerBase",
|
||||
"PluginLoaderBase",
|
||||
"GlobalUtils",
|
||||
"BasePluginInstance",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user