From d18500b96c18ad85734483898a0d9b4ef280f1d0 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Mon, 21 Nov 2022 20:29:50 +0100 Subject: [PATCH] Changed .name -> .mention #100 --- .../auto_role/command/auto_role_group.py | 4 ++-- .../base/events/base_on_member_join_event.py | 4 ++-- ...on_voice_state_update_event_help_channel.py | 2 +- .../src/modules/level/command/level_group.py | 18 +++++++++--------- .../server/members/members-routing.module.ts | 13 +++++++++++++ .../view/server/server-routing.module.ts | 4 +++- 6 files changed, 30 insertions(+), 15 deletions(-) create mode 100644 kdb-web/src/app/modules/view/server/members/members-routing.module.ts diff --git a/kdb-bot/src/modules/auto_role/command/auto_role_group.py b/kdb-bot/src/modules/auto_role/command/auto_role_group.py index ee599473..190580c9 100644 --- a/kdb-bot/src/modules/auto_role/command/auto_role_group.py +++ b/kdb-bot/src/modules/auto_role/command/auto_role_group.py @@ -98,7 +98,7 @@ class AutoRoleGroup(DiscordCommandABC): message = List(discord.Message, [message async for message in channel.history(limit=50)]).where(lambda m: m.id == int(message_id)).single_or_default() if message is None: self._logger.debug(__name__, f'Message with id {message_id} not found in {channel.name}') - await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.auto_role.add.error.not_found').format(message_id, channel.name)) + await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.auto_role.add.error.not_found').format(message_id, channel.mention)) self._logger.trace(__name__, f'Finished command auto-role add') return @@ -250,7 +250,7 @@ class AutoRoleGroup(DiscordCommandABC): except Exception as e: self._logger.error(__name__, f'Cannot add reaction {rule.emoji_name} to message: {auto_role_from_db.discord_message_id}', e) - await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.auto_role.rule.add.success').format(emoji, role.name, auto_role)) + await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.auto_role.rule.add.success').format(emoji, role.mention, auto_role)) self._logger.trace(__name__, f'Finished command auto-role rule add') @add.autocomplete('auto_role') diff --git a/kdb-bot/src/modules/base/events/base_on_member_join_event.py b/kdb-bot/src/modules/base/events/base_on_member_join_event.py index 0e483221..94b0bcb6 100644 --- a/kdb-bot/src/modules/base/events/base_on_member_join_event.py +++ b/kdb-bot/src/modules/base/events/base_on_member_join_event.py @@ -70,10 +70,10 @@ class BaseOnMemberJoinEvent(OnMemberJoinABC): await self._messenger.send_dm_message(self._t.transform('modules.base.welcome_message').format(member.guild.name), member) for admin in self._permission_service.get_admins(member.guild.id): - await self._messenger.send_dm_message(self._t.transform('modules.base.welcome_message_for_team').format(member.name), admin) + await self._messenger.send_dm_message(self._t.transform('modules.base.welcome_message_for_team').format(member.mention), admin) for moderator in self._permission_service.get_moderators(member.guild.id): - await self._messenger.send_dm_message(self._t.transform('modules.base.welcome_message_for_team').format(member.name), moderator) + await self._messenger.send_dm_message(self._t.transform('modules.base.welcome_message_for_team').format(member.mention), moderator) try: server = self._servers.get_server_by_discord_id(member.guild.id) diff --git a/kdb-bot/src/modules/base/events/base_on_voice_state_update_event_help_channel.py b/kdb-bot/src/modules/base/events/base_on_voice_state_update_event_help_channel.py index 6f9e6f4d..b2b98f37 100644 --- a/kdb-bot/src/modules/base/events/base_on_voice_state_update_event_help_channel.py +++ b/kdb-bot/src/modules/base/events/base_on_voice_state_update_event_help_channel.py @@ -46,7 +46,7 @@ class BaseOnVoiceStateUpdateEventHelpChannel(OnVoiceStateUpdateABC): mods = [*self._permissions.get_admins(member.guild.id), *self._permissions.get_moderators(member.guild.id)] for a in mods: await self._message_service.send_dm_message( - self._t.transform('modules.base.member_joined_help_voice_channel').format(member.name), + self._t.transform('modules.base.member_joined_help_voice_channel').format(member.mention), a, ) diff --git a/kdb-bot/src/modules/level/command/level_group.py b/kdb-bot/src/modules/level/command/level_group.py index 502c0936..7bf44d9a 100644 --- a/kdb-bot/src/modules/level/command/level_group.py +++ b/kdb-bot/src/modules/level/command/level_group.py @@ -303,7 +303,7 @@ class LevelGroup(DiscordCommandABC): levels = self._levels.get_levels_by_server_id(server.server_id).order_by(lambda l: l.min_xp) if level == levels.first(): - await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.down.already_first').format(member.name)) + await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.down.already_first').format(member.mention)) self._logger.trace(__name__, f'Finished command level down') return @@ -312,11 +312,11 @@ class LevelGroup(DiscordCommandABC): user.xp = new_level.min_xp self._users.update_user(user) self._db.save_changes() - await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.down.success').format(member.name, new_level.name)) + await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.down.success').format(member.mention, new_level.name)) await self._level_service.set_level(user) except Exception as e: self._logger.error(__name__, f'Cannot level down {member.name} with level {level.name}', e) - await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.down.failed').format(member.name)) + await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.down.failed').format(member.mention)) self._logger.trace(__name__, f'Finished command level down') @@ -336,7 +336,7 @@ class LevelGroup(DiscordCommandABC): levels = self._levels.get_levels_by_server_id(server.server_id).order_by(lambda l: l.min_xp) if level.name == levels.last().name: - await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.up.already_last').format(member.name)) + await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.up.already_last').format(member.mention)) self._logger.trace(__name__, f'Finished command level up') return @@ -345,11 +345,11 @@ class LevelGroup(DiscordCommandABC): user.xp = new_level.min_xp self._users.update_user(user) self._db.save_changes() - await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.up.success').format(member.name, new_level.name)) + await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.up.success').format(member.mention, new_level.name)) await self._level_service.set_level(user) except Exception as e: self._logger.error(__name__, f'Cannot level up {member.name} with level {level.name}', e) - await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.up.failed').format(member.name)) + await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.up.failed').format(member.mention)) self._logger.trace(__name__, f'Finished command level up') @@ -374,7 +374,7 @@ class LevelGroup(DiscordCommandABC): return if current_level.name == level: - await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.set.already_level').format(member.name, level)) + await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.set.already_level').format(member.mention, level)) self._logger.trace(__name__, f'Finished command level set') return @@ -382,11 +382,11 @@ class LevelGroup(DiscordCommandABC): user.xp = new_level.min_xp self._users.update_user(user) self._db.save_changes() - await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.set.success').format(member.name, new_level.name)) + await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.set.success').format(member.mention, new_level.name)) await self._level_service.set_level(user) except Exception as e: self._logger.error(__name__, f'Cannot set level {level} for {member.name}', e) - await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.set.failed').format(member.name)) + await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.set.failed').format(member.mention)) self._logger.trace(__name__, f'Finished command level set') diff --git a/kdb-web/src/app/modules/view/server/members/members-routing.module.ts b/kdb-web/src/app/modules/view/server/members/members-routing.module.ts new file mode 100644 index 00000000..2daacede --- /dev/null +++ b/kdb-web/src/app/modules/view/server/members/members-routing.module.ts @@ -0,0 +1,13 @@ +import { NgModule } from "@angular/core"; +import { RouterModule, Routes } from "@angular/router"; +import { MembersComponent } from "./component/members/members.component"; + +const routes: Routes = [ + { path: '', component: MembersComponent }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class MembersRoutingModule { } diff --git a/kdb-web/src/app/modules/view/server/server-routing.module.ts b/kdb-web/src/app/modules/view/server/server-routing.module.ts index 7b9f3ee7..174266af 100644 --- a/kdb-web/src/app/modules/view/server/server-routing.module.ts +++ b/kdb-web/src/app/modules/view/server/server-routing.module.ts @@ -1,9 +1,11 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { ServerDashboardComponent } from './server-dashboard/server-dashboard.component'; +import { AuthGuard } from "../../shared/guards/auth/auth.guard"; const routes: Routes = [ - { path: '', component: ServerDashboardComponent } + { path: '', component: ServerDashboardComponent }, + { path: 'members', loadChildren: () => import('./members/members.module').then(m => m.MembersModule), canActivate: [AuthGuard] }, ]; @NgModule({