Fixed level seeder #46
This commit is contained in:
parent
95a64732f3
commit
7e5706137e
@ -1,7 +1,6 @@
|
|||||||
import discord
|
import discord
|
||||||
from cpl_discord.container import Guild, Role
|
from cpl_discord.container import Guild
|
||||||
from cpl_discord.service import DiscordBotServiceABC
|
from cpl_discord.service import DiscordBotServiceABC
|
||||||
from cpl_query.extension import List
|
|
||||||
from discord import Permissions, Colour
|
from discord import Permissions, Colour
|
||||||
|
|
||||||
from bot_core.logging.database_logger import DatabaseLogger
|
from bot_core.logging.database_logger import DatabaseLogger
|
||||||
@ -35,7 +34,7 @@ class LevelSeeder(DataSeederABC):
|
|||||||
await guild.create_role(name=level.name, colour=Colour(int(level.color, 16)), hoist=False, mentionable=True, permissions=Permissions(level.permissions))
|
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}')
|
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:
|
if self._levels.find_levels_by_server_id(server.server_id).where(lambda l: l.name == level.name).first_or_default() is not None:
|
||||||
self._levels.add_level(level)
|
self._levels.add_level(level)
|
||||||
except discord.errors.Forbidden as e:
|
except discord.errors.Forbidden as e:
|
||||||
self._logger.error(__name__, f'Creating level failed', e)
|
self._logger.error(__name__, f'Creating level failed', e)
|
||||||
|
Loading…
Reference in New Issue
Block a user