Remove unnecessary uuid protection for IRCUser, add uuid for IRCChannel

This commit is contained in:
Evelyn 2016-11-12 11:03:36 +00:00
parent 6105c8e6e3
commit fd80393e38
2 changed files with 3 additions and 2 deletions

View file

@ -1,7 +1,9 @@
import uuid
import IRCLog import IRCLog
class Channel(object): class Channel(object):
def __init__(self, name, server, bot): def __init__(self, name, server, bot):
self.id = uuid.uuid1().hex
self.name = name.lower() self.name = name.lower()
self.server = server self.server = server
self.bot = bot self.bot = bot

View file

@ -3,6 +3,7 @@ import IRCLog
class User(object): class User(object):
def __init__(self, nickname, server, bot): def __init__(self, nickname, server, bot):
self.id = uuid.uuid1().hex
self.set_nickname(nickname) self.set_nickname(nickname)
self.username = None self.username = None
self.hostname = None self.hostname = None
@ -10,8 +11,6 @@ class User(object):
self.bot = bot self.bot = bot
self.channels = set([]) self.channels = set([])
self.id = None self.id = None
while self.id == None or self.id in server.users:
self.id = uuid.uuid1().hex
self.log = IRCLog.Log(bot) self.log = IRCLog.Log(bot)
def set_nickname(self, nickname): def set_nickname(self, nickname):
self.nickname = nickname self.nickname = nickname