Changed tokens & improved permission service
This commit is contained in:
parent
9f8dd52c82
commit
eab80f68ef
@ -18,7 +18,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"DiscordBot": {
|
"DiscordBot": {
|
||||||
"Token": "OTA5ODc4NDcyNzExNzU3ODQ1.YZKsXA.8p-g1c37EBZzYYW09Fvr7egQzhE",
|
"Token": "OTk4MTU5NjczODkzMDYwNzM4.GN3QyA.yvWO6L7Eu36gXQ7ARDs0Jg2J1VqIDnHLou5lT4",
|
||||||
"Prefix": "!kd "
|
"Prefix": "!kd "
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
"LoggingSettings": {
|
"LoggingSettings": {
|
||||||
"Path": "logs/",
|
"Path": "logs/",
|
||||||
"Filename": "log_dev.log",
|
"Filename": "log_dev.log",
|
||||||
"ConsoleLogLevel": "TRACE",
|
"ConsoleLogLevel": "DEBUG",
|
||||||
"FileLogLevel": "TRACE"
|
"FileLogLevel": "TRACE"
|
||||||
},
|
},
|
||||||
"DatabaseSettings": {
|
"DatabaseSettings": {
|
||||||
@ -16,7 +16,7 @@
|
|||||||
"AuthPlugin": "mysql_native_password"
|
"AuthPlugin": "mysql_native_password"
|
||||||
},
|
},
|
||||||
"DiscordBot": {
|
"DiscordBot": {
|
||||||
"Token": "OTExNTc0NDQyMzMxNzM0MDI2.YZjX2w.k7N2qTkvkDD7j9bT4Nrdl4qBHlI",
|
"Token": "OTk4MTYwNDI3Njg5MTgxMjM3.GI7h67.BqD6Lu1Tz0MuG8iktYrcLnHi1pNozyMiWFGTKI",
|
||||||
"Prefix": "!kde "
|
"Prefix": "!kde "
|
||||||
},
|
},
|
||||||
"Bot": {
|
"Bot": {
|
||||||
|
@ -16,9 +16,5 @@
|
|||||||
"Languages": [
|
"Languages": [
|
||||||
"de"
|
"de"
|
||||||
]
|
]
|
||||||
},
|
|
||||||
"Discord": {
|
|
||||||
"Token": "OTA5ODc3NDg3MjEzODk5ODQ3.YZKrcQ.JLfdP_X0xtpfXKiBqP49HQe6z9Y",
|
|
||||||
"Prefix": "!kb "
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -18,6 +18,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"Discord": {
|
"Discord": {
|
||||||
"Token": "OTEwMjAxNjA1NDkwNjEwMjA3.YZPZTQ.lUj2Bs5pQAv4AJ_tb_mHMTpIRls"
|
"Token": "OTk4MTU5ODAyMzkzOTY0NTk0.G4rLkF.uBQ9pW8X1Lm5agHqvBfzf7qEf8Ton-3a1oJPmY",
|
||||||
|
"Prefix": "!kdt "
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -66,8 +66,6 @@ class PermissionService(PermissionServiceABC):
|
|||||||
self._moderator_roles[guild.id] = mod_roles
|
self._moderator_roles[guild.id] = mod_roles
|
||||||
self._moderators[guild.id] = mods
|
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):
|
def on_member_update(self, before: discord.Member, after: discord.Member):
|
||||||
g_id = after.guild.id
|
g_id = after.guild.id
|
||||||
|
|
||||||
@ -108,19 +106,7 @@ class PermissionService(PermissionServiceABC):
|
|||||||
return self._moderators[g_id]
|
return self._moderators[g_id]
|
||||||
|
|
||||||
def is_member_admin(self, member: discord.Member) -> bool:
|
def is_member_admin(self, member: discord.Member) -> bool:
|
||||||
role_match = False
|
return member in self._admins[member.guild.id]
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
def is_member_moderator(self, member: discord.Member) -> bool:
|
def is_member_moderator(self, member: discord.Member) -> bool:
|
||||||
role_match = False
|
return member in self._moderators[member.guild.id] or self.is_member_admin(member)
|
||||||
|
|
||||||
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)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user