3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-28 05:32:51 +01:00

ClientbotBaseProtocol: disallow part() from the main pseudoclient by default

This commit is contained in:
James Lu 2019-06-16 11:23:32 -07:00
parent 0836845ff9
commit e25a5df4db

View File

@ -170,6 +170,8 @@ class ClientbotBaseProtocol(PyLinkNetworkCoreWithUtils):
def part(self, source, channel, reason=''):
"""STUB: Parts a user from a channel."""
if self.pseudoclient and source == self.pseudoclient.uid:
raise NotImplementedError("Explicitly leaving channels is not supported here.")
self._channels[channel].remove_user(source)
self.users[source].channels.discard(channel)
self.call_hooks([source, 'CLIENTBOT_PART', {'channel': channel, 'text': reason}])