Add IRCServer.has_user_id, to check if we've seen a user before

This commit is contained in:
jesopo 2019-05-05 00:16:37 +01:00
parent f715e46155
commit 920dce0221

View file

@ -174,6 +174,9 @@ class Server(IRCObject.Object):
nickname_lower = self.irc_lower(nickname)
self.bot.database.users.add(self.id, nickname_lower)
return self.bot.database.users.get_id(self.id, nickname_lower)
def has_user_id(self, nickname: str) -> bool:
id = self.bot.database.users.get_id(self.id, self.irc_lower(nickname))
return not id == None
def remove_user(self, user: IRCUser.User):
del self.users[user.nickname_lower]
for channel in user.channels: