Fixed problems since merge #28
This commit is contained in:
parent
57d59e91ac
commit
eaae058754
@ -202,7 +202,7 @@
|
||||
"down": {
|
||||
"already_first": "{} hat bereits das erste Level.",
|
||||
"success": "{} wurde auf Level {} runtergesetzt :)",
|
||||
"failed": "{} konnte nicht runtergesetzt werden :("
|
||||
"failed": "{} konnte nicht runtergesetzt werden :(",
|
||||
"created": "Level {} mit Berechtigungen {} wurde erstellt."
|
||||
}
|
||||
},
|
||||
|
@ -3,6 +3,7 @@ from typing import List as TList
|
||||
import discord
|
||||
from cpl_core.database.context import DatabaseContextABC
|
||||
from cpl_discord.command import DiscordCommandABC
|
||||
from cpl_discord.container import Guild, Role
|
||||
from cpl_discord.service import DiscordBotServiceABC
|
||||
from cpl_translation import TranslatePipe
|
||||
from discord import app_commands
|
||||
@ -14,6 +15,7 @@ from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.logging.command_logger import CommandLogger
|
||||
from bot_data.abc.level_repository_abc import LevelRepositoryABC
|
||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
||||
from bot_data.model.level import Level
|
||||
from modules.level.level_seeder import LevelSeeder
|
||||
from modules.level.service.level_service import LevelService
|
||||
@ -30,9 +32,10 @@ class LevelGroup(DiscordCommandABC):
|
||||
client_utils: ClientUtilsServiceABC,
|
||||
permission_service: PermissionServiceABC,
|
||||
translate: TranslatePipe,
|
||||
db_context: DatabaseContextABC,
|
||||
db: DatabaseContextABC,
|
||||
levels: LevelRepositoryABC,
|
||||
servers: ServerRepositoryABC,
|
||||
users: UserRepositoryABC,
|
||||
level_service: LevelService,
|
||||
level_seeder: LevelSeeder,
|
||||
):
|
||||
@ -44,9 +47,10 @@ class LevelGroup(DiscordCommandABC):
|
||||
self._client_utils = client_utils
|
||||
self._permissions = permission_service
|
||||
self._t = translate
|
||||
self._db_context = db_context
|
||||
self._db = db
|
||||
self._levels = levels
|
||||
self._servers = servers
|
||||
self._users = users
|
||||
|
||||
self._level_service = level_service
|
||||
self._level_seeder = level_seeder
|
||||
@ -136,7 +140,7 @@ class LevelGroup(DiscordCommandABC):
|
||||
else:
|
||||
try:
|
||||
self._levels.add_level(level)
|
||||
self._db_context.save_changes()
|
||||
self._db.save_changes()
|
||||
self._logger.info(__name__, f'Saved level {name} with color {color}, min_xp {min_xp} and permissions {permissions}')
|
||||
except Exception as e:
|
||||
self._logger.error(__name__, f'Could not save level {name} with color {color}, min_xp {min_xp} and permissions {permissions}', e)
|
||||
@ -211,7 +215,7 @@ class LevelGroup(DiscordCommandABC):
|
||||
|
||||
try:
|
||||
self._levels.delete_level(level_from_db)
|
||||
self._db_context.save_changes()
|
||||
self._db.save_changes()
|
||||
guild: Guild = self._bot.guilds.where(lambda g: g == ctx.guild).single()
|
||||
role: Role = guild.roles.where(lambda r: r.name == level).single_or_default()
|
||||
if role is not None:
|
||||
|
Loading…
Reference in New Issue
Block a user