From eab80f68effcb2b5bebe7a57a676261ab1f3572f Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 17 Jul 2022 12:12:10 +0200 Subject: [PATCH] Changed tokens & improved permission service --- src/bot/config/appsettings.development.json | 2 +- src/bot/config/appsettings.edrafts-lapi.json | 4 ++-- src/bot/config/appsettings.production.json | 4 ---- src/bot/config/appsettings.staging.json | 3 ++- .../permission/service/permission_service.py | 18 ++---------------- 5 files changed, 7 insertions(+), 24 deletions(-) diff --git a/src/bot/config/appsettings.development.json b/src/bot/config/appsettings.development.json index d9c04a0db4..9812f840f5 100644 --- a/src/bot/config/appsettings.development.json +++ b/src/bot/config/appsettings.development.json @@ -18,7 +18,7 @@ ] }, "DiscordBot": { - "Token": "OTA5ODc4NDcyNzExNzU3ODQ1.YZKsXA.8p-g1c37EBZzYYW09Fvr7egQzhE", + "Token": "OTk4MTU5NjczODkzMDYwNzM4.GN3QyA.yvWO6L7Eu36gXQ7ARDs0Jg2J1VqIDnHLou5lT4", "Prefix": "!kd " } } \ No newline at end of file diff --git a/src/bot/config/appsettings.edrafts-lapi.json b/src/bot/config/appsettings.edrafts-lapi.json index 5694a0f6e6..5da5305b7b 100644 --- a/src/bot/config/appsettings.edrafts-lapi.json +++ b/src/bot/config/appsettings.edrafts-lapi.json @@ -2,7 +2,7 @@ "LoggingSettings": { "Path": "logs/", "Filename": "log_dev.log", - "ConsoleLogLevel": "TRACE", + "ConsoleLogLevel": "DEBUG", "FileLogLevel": "TRACE" }, "DatabaseSettings": { @@ -16,7 +16,7 @@ "AuthPlugin": "mysql_native_password" }, "DiscordBot": { - "Token": "OTExNTc0NDQyMzMxNzM0MDI2.YZjX2w.k7N2qTkvkDD7j9bT4Nrdl4qBHlI", + "Token": "OTk4MTYwNDI3Njg5MTgxMjM3.GI7h67.BqD6Lu1Tz0MuG8iktYrcLnHi1pNozyMiWFGTKI", "Prefix": "!kde " }, "Bot": { diff --git a/src/bot/config/appsettings.production.json b/src/bot/config/appsettings.production.json index a37c918ee5..50c1108e8f 100644 --- a/src/bot/config/appsettings.production.json +++ b/src/bot/config/appsettings.production.json @@ -16,9 +16,5 @@ "Languages": [ "de" ] - }, - "Discord": { - "Token": "OTA5ODc3NDg3MjEzODk5ODQ3.YZKrcQ.JLfdP_X0xtpfXKiBqP49HQe6z9Y", - "Prefix": "!kb " } } \ No newline at end of file diff --git a/src/bot/config/appsettings.staging.json b/src/bot/config/appsettings.staging.json index 846c160dd9..e9139b66da 100644 --- a/src/bot/config/appsettings.staging.json +++ b/src/bot/config/appsettings.staging.json @@ -18,6 +18,7 @@ ] }, "Discord": { - "Token": "OTEwMjAxNjA1NDkwNjEwMjA3.YZPZTQ.lUj2Bs5pQAv4AJ_tb_mHMTpIRls" + "Token": "OTk4MTU5ODAyMzkzOTY0NTk0.G4rLkF.uBQ9pW8X1Lm5agHqvBfzf7qEf8Ton-3a1oJPmY", + "Prefix": "!kdt " } } \ No newline at end of file diff --git a/src/modules/permission/service/permission_service.py b/src/modules/permission/service/permission_service.py index 19d8560c1c..f9caa63a3a 100644 --- a/src/modules/permission/service/permission_service.py +++ b/src/modules/permission/service/permission_service.py @@ -66,8 +66,6 @@ class PermissionService(PermissionServiceABC): self._moderator_roles[guild.id] = mod_roles self._moderators[guild.id] = mods - self._logger.error(__name__, f'USERS {self._admins} {self._moderators}') - def on_member_update(self, before: discord.Member, after: discord.Member): g_id = after.guild.id @@ -108,19 +106,7 @@ class PermissionService(PermissionServiceABC): return self._moderators[g_id] def is_member_admin(self, member: discord.Member) -> bool: - role_match = False - - for role in member.roles: - if role in self._admin_roles: - role_match = True - - return member in self._admins[member.guild.id] or role_match + return member in self._admins[member.guild.id] def is_member_moderator(self, member: discord.Member) -> bool: - role_match = False - - for role in member.roles: - if role in self._moderator_roles: - role_match = True - - return member in self._moderators[member.guild.id] or role_match or self.is_member_admin(member) + return member in self._moderators[member.guild.id] or self.is_member_admin(member)