From 920dce0221b71a3573e0016ad462f3b4fe94bab0 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 5 May 2019 00:16:37 +0100 Subject: [PATCH] Add IRCServer.has_user_id, to check if we've seen a user before --- src/IRCServer.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/IRCServer.py b/src/IRCServer.py index e67cf913..98e8580e 100644 --- a/src/IRCServer.py +++ b/src/IRCServer.py @@ -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: