66import zipfile
77
88from aiohttp import BasicAuth
9-
10- from core import utils , FatalException , Node
9+ from core import utils , FatalException
1110from core .services .base import Service
1211from core .services .registry import ServiceRegistry
1312from discord .ext import commands
2726yaml = YAML ()
2827
2928if TYPE_CHECKING :
30- from core import Server , Plugin
29+ from core import Server , Plugin , Node
3130
3231__all__ = ["BotService" ]
3332
@@ -98,17 +97,17 @@ def proxy_auth(self) -> Optional[BasicAuth]:
9897 return BasicAuth (username , password )
9998
10099 def init_bot (self ):
101- def get_prefix (client , message ):
102- prefixes = [self .locals .get ('command_prefix' , '.' )]
103- # Allow users to @mention the bot instead of using a prefix
104- return commands .when_mentioned_or (* prefixes )(client , message )
105-
106100 if self .locals .get ('no_discord' , False ):
107101 return DummyBot (version = self .node .bot_version ,
108102 sub_version = self .node .sub_version ,
109103 node = self .node ,
110104 locals = self .locals )
111105 else :
106+ def get_prefix (client , message ):
107+ prefixes = [self .locals .get ('command_prefix' , '.' )]
108+ # Allow users to @mention the bot instead of using a prefix
109+ return commands .when_mentioned_or (* prefixes )(client , message )
110+
112111 # Create the Bot
113112 return DCSServerBot (version = self .node .bot_version ,
114113 sub_version = self .node .sub_version ,
@@ -132,7 +131,7 @@ async def start(self, *, reconnect: bool = True) -> None:
132131 try :
133132 self .bot = self .init_bot ()
134133 await self .install_fonts ()
135- await self .bot .login (self .token )
134+ await self .bot .login (token = self .token )
136135 # noinspection PyAsyncCall
137136 asyncio .create_task (self .bot .connect (reconnect = reconnect ))
138137 except Exception as ex :
@@ -204,8 +203,8 @@ async def send_message(self, channel: Optional[int] = -1, content: Optional[str]
204203 await _channel .send (content = content , file = file , embed = _embed )
205204
206205 async def audit (self , message , user : Optional [Union [discord .Member , str ]] = None ,
207- server : Optional [Server ] = None , ** kwargs ):
208- await self .bot .audit (message , user = user , server = server , ** kwargs )
206+ server : Optional [Server ] = None , node : Optional [ Node ] = None , ** kwargs ):
207+ await self .bot .audit (message , user = user , server = server , node = node , ** kwargs )
209208
210209 async def rename_server (self , server : Server , new_name : str ):
211210 async with self .apool .connection () as conn :
0 commit comments