Fixed stuff caused by merges #26

This commit is contained in:
Sven Heidemann 2022-11-09 19:33:45 +01:00
parent 4f433c3840
commit c632ad51d4
2 changed files with 16 additions and 14 deletions

View File

@ -62,7 +62,7 @@
"gold": "Gold", "gold": "Gold",
"green": "Grün", "green": "Grün",
"greyple": "Graugrün", "greyple": "Graugrün",
"light_gray": "Hellgrau", "light_grey": "Hellgrau",
"magenta": "Magenta", "magenta": "Magenta",
"orange": "Orange", "orange": "Orange",
"purple": "Violett", "purple": "Violett",
@ -175,6 +175,9 @@
}, },
"level": { "level": {
"new_level_message": "<@{}> ist nun Level {}", "new_level_message": "<@{}> ist nun Level {}",
"seeding_started": "Levelsystem wird neu geladen.",
"seeding_failed": "Levelsystem konnte nicht neu geladen werden.",
"seeding_finished": "Levelsystem wurde Erfolgreich neu geladen.",
"error": { "error": {
"nothing_found": "Keine Level Einträge gefunden.", "nothing_found": "Keine Level Einträge gefunden.",
"level_with_name_already_exists": "Ein Level mit dem Namen {} existiert bereits!", "level_with_name_already_exists": "Ein Level mit dem Namen {} existiert bereits!",
@ -188,10 +191,7 @@
"permission_int": "Berechtigungen" "permission_int": "Berechtigungen"
}, },
"create": { "create": {
"created": "Level {} mit Berechtigungen {} wurde erstellt.", "created": "Level {} mit Berechtigungen {} wurde erstellt."
"seeding_started": "Levelsystem wird neu geladen.",
"seeding_failed": "Levelsystem konnte nicht neu geladen werden.",
"seeding_finished": "Levelsystem wurde Erfolgreich neu geladen."
}, },
"remove": { "remove": {
"success": "Level {} wurde entfernt :D", "success": "Level {} wurde entfernt :D",

View File

@ -57,6 +57,16 @@ class LevelGroup(DiscordCommandABC):
self._logger.trace(__name__, f'Loaded command service: {type(self).__name__}') self._logger.trace(__name__, f'Loaded command service: {type(self).__name__}')
async def _seed_levels(self, channel: discord.TextChannel):
# send message to ctx.channel because send_ctx_msg resolves ctx
try:
await self._message_service.send_channel_message(channel, self._t.transform('modules.level.seeding_started'))
await self._level_seeder.seed()
await self._message_service.send_channel_message(channel, self._t.transform('modules.level.seeding_finished'))
except Exception as e:
self._logger.error(__name__, f'Level seeding failed', e)
await self._message_service.send_channel_message(channel, self._t.transform('modules.level.seeding_failed'))
@commands.hybrid_group() @commands.hybrid_group()
@commands.guild_only() @commands.guild_only()
async def level(self, ctx: Context): async def level(self, ctx: Context):
@ -146,15 +156,7 @@ class LevelGroup(DiscordCommandABC):
self._logger.error(__name__, f'Could not save level {name} with color {color}, min_xp {min_xp} and permissions {permissions}', e) self._logger.error(__name__, f'Could not save level {name} with color {color}, min_xp {min_xp} and permissions {permissions}', e)
else: else:
await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.create.created').format(name, permissions)) await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.create.created').format(name, permissions))
await self._seed_levels(ctx.channel)
# send message to ctx.channel because send_ctx_msg resolves ctx
try:
await self._message_service.send_channel_message(ctx.channel, self._t.transform('modules.level.create.seeding_started'))
await self._level_seeder.seed()
await self._message_service.send_channel_message(ctx.channel, self._t.transform('modules.level.create.seeding_finished'))
except Exception as e:
self._logger.error(__name__, f'Level seeding failed', e)
await self._message_service.send_channel_message(ctx.channel, self._t.transform('modules.level.create.seeding_failed'))
self._logger.trace(__name__, f'Finished command level create') self._logger.trace(__name__, f'Finished command level create')