0.3 - Bei message Member.name -> Member.mentions oder so (#100) #137

Merged
edraft merged 1 commits from #100 into 0.3 2022-11-22 18:16:39 +01:00
6 changed files with 30 additions and 15 deletions

View File

@ -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')

View File

@ -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)

View File

@ -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,
)

View File

@ -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')

View File

@ -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 { }

View File

@ -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({