From 4d6e3a3555cd137822c82f79db342962601e2676 Mon Sep 17 00:00:00 2001 From: FirePlank <44502537+FirePlank@users.noreply.github.com> Date: Fri, 1 Dec 2023 21:32:21 +0200 Subject: [PATCH] fixed issue where roles were getting pushed to memory more than once --- bot/extensions/selectable_roles/commands.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bot/extensions/selectable_roles/commands.py b/bot/extensions/selectable_roles/commands.py index 2dafb0a4..5c84eb74 100644 --- a/bot/extensions/selectable_roles/commands.py +++ b/bot/extensions/selectable_roles/commands.py @@ -28,6 +28,9 @@ def __init__(self, bot: core.DiscordBot): def update_roles(self, guild_id: int, data: tuple[str, int]) -> None: if self.roles.get(guild_id): + for role in self.roles[guild_id]: + if role.id == data[1]: + return self.roles[guild_id].append(Role(name=data[0], id=data[1])) else: self.roles[guild_id] = [Role(name=data[0], id=data[1])]