This commit is contained in:
iou1name 2019-10-09 18:35:38 -04:00
parent b552c35baa
commit a7fb575a55

14
bot.py
View File

@ -38,7 +38,7 @@ class Fulvia(irc.IRCClient):
"""The path to the bot's static file directory.""" """The path to the bot's static file directory."""
self.log_path = "logs" self.log_path = "logs"
os.makedirs(self.static, exist_ok=True) os.makedirs(self.log_path, exist_ok=True)
"""The path to the bot's log files.""" """The path to the bot's log files."""
self._log_dump = tools.FulviaMemoryDefault(list) self._log_dump = tools.FulviaMemoryDefault(list)
@ -373,7 +373,7 @@ class Fulvia(irc.IRCClient):
line = f"-!- you are now known as {nick}" line = f"-!- you are now known as {nick}"
for channel_name, channel in self.channels.items(): for channel_name, channel in self.channels.items():
self.log(key, line) self.log(channel_name, line)
user = channel.users.pop(self.nickname) user = channel.users.pop(self.nickname)
user.nick = nick user.nick = nick
@ -390,8 +390,8 @@ class Fulvia(irc.IRCClient):
line = f"-!- {nick} [{host}] has joined {channel}" line = f"-!- {nick} [{host}] has joined {channel}"
self.log(channel, line) self.log(channel, line)
user = tools.User(nick) new_user = tools.User(nick)
self.channels[channel].users[nick] = user self.channels[channel].users[nick] = new_user
for func in self._user_joined: for func in self._user_joined:
trigger = Trigger(user, channel, f"{user} has joined", "PRIVMSG") trigger = Trigger(user, channel, f"{user} has joined", "PRIVMSG")
@ -413,12 +413,12 @@ class Fulvia(irc.IRCClient):
def userQuit(self, user, quitMessage): def userQuit(self, user, quitMessage):
"""Called when the bot sees another user disconnect from the network.""" """Called when the bot sees another user disconnect from the network."""
nick, _, host = user.partition("!") nick, _, host = user.partition("!")
line = "-!- {nick} [{host}] has quit [{quitMessage}]" line = f"-!- {nick} [{host}] has quit [{quitMessage}]"
for channel_name, channel in self.channels.items(): for channel_name, channel in self.channels.items():
if not nick in channel.users: if not nick in channel.users:
continue continue
self.log(channel, line) self.log(channel_name, line)
channel.users.pop(nick) channel.users.pop(nick)
@ -514,7 +514,7 @@ class Fulvia(irc.IRCClient):
line = f"<{opSym}{self.nickname}> {message}" line = f"<{opSym}{self.nickname}> {message}"
self.log(user, line) self.log(user, line)
irc.IRCClient.msg(self, user, message, length=None) super().msg(user, message, length)
def reply(self, text, dest, reply_to, notice=False): def reply(self, text, dest, reply_to, notice=False):