Changed tokens & improved permission service

This commit is contained in:
Sven Heidemann 2022-07-17 12:12:10 +02:00
parent 9f8dd52c82
commit eab80f68ef
5 changed files with 7 additions and 24 deletions

View File

@ -18,7 +18,7 @@
]
},
"DiscordBot": {
"Token": "OTA5ODc4NDcyNzExNzU3ODQ1.YZKsXA.8p-g1c37EBZzYYW09Fvr7egQzhE",
"Token": "OTk4MTU5NjczODkzMDYwNzM4.GN3QyA.yvWO6L7Eu36gXQ7ARDs0Jg2J1VqIDnHLou5lT4",
"Prefix": "!kd "
}
}

View File

@ -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": {

View File

@ -16,9 +16,5 @@
"Languages": [
"de"
]
},
"Discord": {
"Token": "OTA5ODc3NDg3MjEzODk5ODQ3.YZKrcQ.JLfdP_X0xtpfXKiBqP49HQe6z9Y",
"Prefix": "!kb "
}
}

View File

@ -18,6 +18,7 @@
]
},
"Discord": {
"Token": "OTEwMjAxNjA1NDkwNjEwMjA3.YZPZTQ.lUj2Bs5pQAv4AJ_tb_mHMTpIRls"
"Token": "OTk4MTU5ODAyMzkzOTY0NTk0.G4rLkF.uBQ9pW8X1Lm5agHqvBfzf7qEf8Ton-3a1oJPmY",
"Prefix": "!kdt "
}
}

View File

@ -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)