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",
"green": "Grün",
"greyple": "Graugrün",
"light_gray": "Hellgrau",
"light_grey": "Hellgrau",
"magenta": "Magenta",
"orange": "Orange",
"purple": "Violett",
@ -175,6 +175,9 @@
},
"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": {
"nothing_found": "Keine Level Einträge gefunden.",
"level_with_name_already_exists": "Ein Level mit dem Namen {} existiert bereits!",
@ -188,10 +191,7 @@
"permission_int": "Berechtigungen"
},
"create": {
"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."
"created": "Level {} mit Berechtigungen {} wurde erstellt."
},
"remove": {
"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__}')
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.guild_only()
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)
else:
await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.create.created').format(name, permissions))
# 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'))
await self._seed_levels(ctx.channel)
self._logger.trace(__name__, f'Finished command level create')