Fixed level seeder #28
This commit is contained in:
parent
fe32604a14
commit
faaadb0009
@ -29,14 +29,14 @@ class LevelSeeder(DataSeederABC):
|
||||
async def _create_level(self, level: Level, guild: Guild, server: Server):
|
||||
level.server = server
|
||||
try:
|
||||
if guild.roles.where(lambda r: r.name == level.name).first_or_default() is not None:
|
||||
return
|
||||
if guild.roles.where(lambda r: r.name == level.name).first_or_default() is None:
|
||||
await guild.create_role(name=level.name, colour=Colour(int(level.color, 16)), hoist=False, mentionable=True, permissions=Permissions(level.permissions))
|
||||
self._logger.debug(__name__, f'Created role {level.name}')
|
||||
|
||||
await guild.create_role(name=level.name, colour=Colour(int(level.color, 16)), hoist=False, mentionable=True, permissions=Permissions(level.permissions))
|
||||
self._logger.info(__name__, f'Created level {level.name}')
|
||||
|
||||
if self._levels.find_levels_by_server_id(server.server_id).where(lambda l: l == level).first_or_default() is not None:
|
||||
levels = self._levels.find_levels_by_server_id(server.server_id)
|
||||
if levels is None or levels.where(lambda l: l == level).first_or_default() is None:
|
||||
self._levels.add_level(level)
|
||||
self._logger.debug(__name__, f'Saved level {level.name}')
|
||||
except discord.errors.Forbidden as e:
|
||||
self._logger.error(__name__, f'Creating level failed', e)
|
||||
level.permissions = 0
|
||||
|
Loading…
Reference in New Issue
Block a user