diff --git a/IRCServer.py b/IRCServer.py index 96fd831c..81c64eed 100644 --- a/IRCServer.py +++ b/IRCServer.py @@ -160,7 +160,7 @@ class Server(object): def change_user_nickname(self, old_nickname, new_nickname): user = self.users.pop(old_nickname.lower()) - user.id = self.get_user_id(new_nickname) + user._id = self.get_user_id(new_nickname) self.users[new_nickname.lower()] = user def has_channel(self, channel_name): return channel_name[0] in self.channel_types and channel_name.lower( diff --git a/IRCUser.py b/IRCUser.py index 8782e083..d6f1c79c 100644 --- a/IRCUser.py +++ b/IRCUser.py @@ -23,9 +23,9 @@ class User(object): def __repr__(self): return "IRCUser.User(%s|%s)" % (self.server.name, self.name) - def _get_id(self): + def get_id(self): return (self.identified_account_id_override or - self.identified_account_id or self.id) + self.identified_account_id or self._id) def set_nickname(self, nickname): self.nickname = nickname @@ -36,21 +36,21 @@ class User(object): def part_channel(self, channel): self.channels.remove(channel) def set_setting(self, setting, value): - self.bot.database.user_settings.set(self._get_id(), setting, value) + self.bot.database.user_settings.set(self.get_id(), setting, value) def get_setting(self, setting, default=None): - return self.bot.database.user_settings.get(self._get_id(), setting, + return self.bot.database.user_settings.get(self.get_id(), setting, default) def find_settings(self, pattern, default=[]): - return self.bot.database.user_settings.find(self._get_id(), pattern, + return self.bot.database.user_settings.find(self.get_id(), pattern, default) def find_settings_prefix(self, prefix, default=[]): - return self.bot.database.user_settings.find_prefix(self._get_id(), + return self.bot.database.user_settings.find_prefix(self.get_id(), prefix, default) def del_setting(self, setting): - self.bot.database.user_settings.delete(self._get_id(), setting) + self.bot.database.user_settings.delete(self.get_id(), setting) def get_channel_settings_per_setting(self, setting, default=[]): return self.bot.database.user_channel_settings.find_by_setting( - self._get_id(), setting, default) + self.get_id(), setting, default) def send_message(self, message, prefix=None): self.server.send_message(self.nickname, message, prefix=prefix) diff --git a/modules/coins.py b/modules/coins.py index 15b06918..735d404d 100644 --- a/modules/coins.py +++ b/modules/coins.py @@ -156,7 +156,7 @@ class Module(object): "" if coin_bet == 1 else "s")) def send(self, event): - if event["user"].nickname_lower == event["args_split"][0].lower(): + if event["user"].get_id() == event["args_split"][0].get_id(): event["stderr"].write("You can't send coins to yourself") return send_amount = event["args_split"][1] diff --git a/modules/ducks.py b/modules/ducks.py index d66f2e9e..50a3b17c 100644 --- a/modules/ducks.py +++ b/modules/ducks.py @@ -124,7 +124,7 @@ class Module(object): def duck_bef(self, event): user = event["user"] target = user.nickname - id = user.id + id = user.get_id() active_duck = event["target"].get_setting("active-duck", False) @@ -159,7 +159,7 @@ class Module(object): def duck_bang(self, event): user = event["user"] target = user.nickname - id = user.id + id = user.get_id() if not event["target"].get_setting("active-duck", False): event["stderr"].set_prefix("Kick") if event["server"].has_user(target): @@ -224,7 +224,7 @@ class Module(object): user = event["user"] channel = event["target"].name nick = user.nickname - id = user.id + id = user.get_id() poached = user.get_channel_settings_per_setting("ducks-shot", [] ) diff --git a/modules/ids.py b/modules/ids.py index 8e5dc838..17b20a6e 100644 --- a/modules/ids.py +++ b/modules/ids.py @@ -11,7 +11,7 @@ class Module(object): def my_id(self, event): event["stdout"].write("%s: %d" % (event["user"].nickname, - event["user"].id)) + event["user"].get_id())) def channel_id(self, event): event["stdout"].write("%s: %d" % (event["target"].name, diff --git a/modules/to.py b/modules/to.py index c01c2a58..e566e4c7 100644 --- a/modules/to.py +++ b/modules/to.py @@ -11,20 +11,20 @@ class Module(object): channel_only=True, usage=" ") def channel_message(self, event): - messages = event["channel"].get_user_setting(event["user"].id, + messages = event["channel"].get_user_setting(event["user"].get_id(), "to", []) for nickname, message in messages: event["channel"].send_message("%s: <%s> %s" % ( event["user"].nickname, nickname, message)) if messages: - event["channel"].del_user_setting(event["user"].id, "to") + event["channel"].del_user_setting(event["user"].get_id(), "to") def to(self, event): target_user = event["server"].get_user(event["args_split"][0]) - messages = event["target"].get_user_setting(target_user.id, + messages = event["target"].get_user_setting(target_user.get_id(), "to", []) messages.append([event["user"].nickname, " ".join(event["args_split"][1:])]) - event["target"].set_user_setting(target_user.id, + event["target"].set_user_setting(target_user.get_id(), "to", messages) event["stdout"].write("Message saved") diff --git a/modules/words.py b/modules/words.py index 49ae42ed..e23f3113 100644 --- a/modules/words.py +++ b/modules/words.py @@ -25,15 +25,14 @@ class Module(object): words = list(filter(None, event["message_split"])) word_count = len(words) - user_words = event["channel"].get_user_setting(user.id, + user_words = event["channel"].get_user_setting(user.get_id(), "words", 0) user_words += word_count if user.get_setting("first-words", None) == None: user.set_setting("first-words", time.time()) - event["channel"].set_user_setting(user.id, - "words", user_words) + event["channel"].set_user_setting(user.get_id(), "words", user_words) tracked_words = set(event["server"].get_setting( "tracked-words", []))