cleanup
This commit is contained in:
parent
ab9acdb033
commit
5acc3625a0
|
|
@ -1,5 +1,6 @@
|
||||||
|
from discord import Client
|
||||||
|
|
||||||
from .pool import NodePool
|
from .pool import NodePool
|
||||||
from .utils import ClientType
|
|
||||||
|
|
||||||
|
|
||||||
class PomiceEvent:
|
class PomiceEvent:
|
||||||
|
|
@ -14,7 +15,7 @@ class PomiceEvent:
|
||||||
name = "event"
|
name = "event"
|
||||||
handler_args = ()
|
handler_args = ()
|
||||||
|
|
||||||
def dispatch(self, bot: ClientType):
|
def dispatch(self, bot: Client):
|
||||||
bot.dispatch(f"pomice_{self.name}", *self.handler_args)
|
bot.dispatch(f"pomice_{self.name}", *self.handler_args)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,12 @@ import asyncio
|
||||||
import json
|
import json
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
import time
|
|
||||||
from typing import Dict, Optional, TYPE_CHECKING
|
from typing import Dict, Optional, TYPE_CHECKING
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
from enum import Enum
|
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
from discord import Client, VoiceRegion
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from discord import VoiceRegion
|
|
||||||
|
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
|
|
@ -30,7 +28,7 @@ from .exceptions import (
|
||||||
TrackLoadError
|
TrackLoadError
|
||||||
)
|
)
|
||||||
from .objects import Playlist, Track
|
from .objects import Playlist, Track
|
||||||
from .utils import ClientType, ExponentialBackoff, NodeStats, Ping
|
from .utils import ExponentialBackoff, NodeStats, Ping
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .player import Player
|
from .player import Player
|
||||||
|
|
@ -60,7 +58,7 @@ class Node:
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
pool,
|
pool,
|
||||||
bot: ClientType,
|
bot: Client,
|
||||||
host: str,
|
host: str,
|
||||||
port: int,
|
port: int,
|
||||||
password: str,
|
password: str,
|
||||||
|
|
@ -141,7 +139,7 @@ class Node:
|
||||||
return self._region
|
return self._region
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def bot(self) -> ClientType:
|
def bot(self) -> Client:
|
||||||
"""Property which returns the discord.py client linked to this node"""
|
"""Property which returns the discord.py client linked to this node"""
|
||||||
return self._bot
|
return self._bot
|
||||||
|
|
||||||
|
|
@ -518,7 +516,7 @@ class NodePool:
|
||||||
async def create_node(
|
async def create_node(
|
||||||
cls,
|
cls,
|
||||||
*,
|
*,
|
||||||
bot: ClientType,
|
bot: Client,
|
||||||
host: str,
|
host: str,
|
||||||
port: str,
|
port: str,
|
||||||
password: str,
|
password: str,
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,10 @@ from discord import AutoShardedClient, Client
|
||||||
from discord.ext.commands import AutoShardedBot, Bot
|
from discord.ext.commands import AutoShardedBot, Bot
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"ClientType",
|
|
||||||
"ExponentialBackoff",
|
"ExponentialBackoff",
|
||||||
"NodeStats"
|
"NodeStats"
|
||||||
]
|
]
|
||||||
|
|
||||||
ClientType = Union[AutoShardedBot, AutoShardedClient, Bot, Client]
|
|
||||||
|
|
||||||
|
|
||||||
class ExponentialBackoff:
|
class ExponentialBackoff:
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue