Update level permission by db state on level seeding
This commit is contained in:
parent
bb0ff1c560
commit
414720f53b
@ -104,7 +104,8 @@ class LevelSeeder(DataSeederABC):
|
||||
levels = levels.order_by_descending(lambda l: l.min_xp)
|
||||
position_above_levels = guild.roles.where(lambda r: r.name == self._level_header).single().position
|
||||
for role in guild.roles.order_by_descending(lambda r: r.position):
|
||||
if levels.where(lambda l: l.name == role.name).count() == 0:
|
||||
level = levels.where(lambda l: l.name == role.name).first_or_default()
|
||||
if level is None:
|
||||
continue
|
||||
|
||||
new_position = position_above_levels - (
|
||||
@ -117,7 +118,7 @@ class LevelSeeder(DataSeederABC):
|
||||
__name__,
|
||||
f"Moved {role.name} from {role.position} to {new_position}",
|
||||
)
|
||||
await role.edit(position=new_position)
|
||||
await role.edit(permissions=level.permissions, position=new_position)
|
||||
except Exception as e:
|
||||
self._logger.error(__name__, f"Cannot change position of {role.name}", e)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user