Raise error if two trees are registered to the same connection state

This commit is contained in:
Rapptz 2022-03-09 20:35:07 -05:00
parent 446bfa78b0
commit a6ae7ec196

View File

@ -93,6 +93,10 @@ class CommandTree(Generic[ClientT]):
self.client: ClientT = client
self._http = client.http
self._state = client._connection
if self._state._command_tree is not None:
raise ClientException('This client already has an associated command tree.')
self._state._command_tree = self
self._guild_commands: Dict[int, Dict[str, Union[Command, Group]]] = {}
self._global_commands: Dict[str, Union[Command, Group]] = {}