Fixed seeder and module order #214
This commit is contained in:
parent
c841f39a03
commit
ac1affa937
@ -25,10 +25,10 @@ class ModuleList:
|
||||
DataModule,
|
||||
GraphQLModule,
|
||||
PermissionModule,
|
||||
LevelModule,
|
||||
DatabaseModule,
|
||||
AutoRoleModule,
|
||||
BaseModule,
|
||||
LevelModule,
|
||||
ApiModule,
|
||||
TechnicianModule,
|
||||
# has to be last!
|
||||
|
@ -375,8 +375,6 @@ class DatabaseOnReadyEvent(OnReadyABC):
|
||||
async def on_ready(self):
|
||||
self._logger.debug(__name__, f"Module {type(self)} started")
|
||||
|
||||
await self._seeder.seed()
|
||||
|
||||
self._check_known_users()
|
||||
self._check_servers()
|
||||
self._check_clients()
|
||||
@ -385,5 +383,7 @@ class DatabaseOnReadyEvent(OnReadyABC):
|
||||
self._check_user_joins_vc()
|
||||
self._check_user_joined_gs()
|
||||
|
||||
await self._seeder.seed()
|
||||
|
||||
self._validate_init_time()
|
||||
self._logger.trace(__name__, f"Module {type(self)} stopped")
|
||||
|
@ -1,4 +1,5 @@
|
||||
import discord
|
||||
from cpl_core.database.context import DatabaseContextABC
|
||||
from cpl_discord.container import Guild
|
||||
from cpl_discord.service import DiscordBotServiceABC
|
||||
from discord import Permissions, Colour
|
||||
@ -21,6 +22,7 @@ class LevelSeeder(DataSeederABC):
|
||||
level_repo: LevelRepositoryService,
|
||||
servers: ServerRepositoryABC,
|
||||
level: LevelService,
|
||||
db: DatabaseContextABC,
|
||||
bot: DiscordBotServiceABC,
|
||||
):
|
||||
DataSeederABC.__init__(self)
|
||||
@ -29,6 +31,7 @@ class LevelSeeder(DataSeederABC):
|
||||
self._levels = level_repo
|
||||
self._servers = servers
|
||||
self._level = level
|
||||
self._db = db
|
||||
self._bot = bot
|
||||
|
||||
self._level_header = levels.level_header
|
||||
@ -51,6 +54,7 @@ class LevelSeeder(DataSeederABC):
|
||||
if levels is None or levels.where(lambda l: l.name == level.name).first_or_default() is None:
|
||||
self._levels.add_level(level)
|
||||
self._logger.debug(__name__, f"Saved level {level.name}")
|
||||
self._db.save_changes()
|
||||
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