Переглянути джерело

Handle getting kicked

master
JustAnotherArchivist 3 роки тому
джерело
коміт
7c1d40d3ff
1 змінених файлів з 10 додано та 0 видалено
  1. +10
    -0
      irclog.py

+ 10
- 0
irclog.py Переглянути файл

@@ -278,6 +278,7 @@ class IRCClientProtocol(asyncio.Protocol):
channelsToPart = self.channels - channels
channelsToJoin = channels - self.channels
self.channels = channels
#TODO Rejoin channels the bot got kicked from?

if self.connected:
if channelsToPart:
@@ -369,6 +370,15 @@ class IRCClientProtocol(asyncio.Protocol):
return
self._send_join_part(b'JOIN', self.channels)

# Bot getting KICKed
elif line.command == 'KICK' and line.source and self.server.casefold(line.params[1]) == self.server.casefold(self.server.nickname):
self.logger.warning(f'Got kicked from {line.params[0]}')
kickedChannel = self.server.casefold(line.params[0])
for channel in self.channels:
if self.server.casefold(channel) == kickedChannel:
self.channels.remove(channel)
break

# General fatal ERROR
elif line.command == 'ERROR':
self.logger.error(f'Server sent ERROR: {message!r}')


Завантаження…
Відмінити
Зберегти