@@ -51,6 +51,37 @@ impl AuditLogFormatter for MemberFormatter {
5151 }
5252
5353 async fn description ( & self , alc : & AuditLogContext < ' _ > ) -> String {
54+ match self . 0 {
55+ MemberAction :: MemberMove => {
56+ if let Some ( opts) = & alc. entry . options {
57+ if let Some ( channel_id) = opts. channel_id {
58+ let mut params = HashMap :: new ( ) ;
59+ params. insert ( "channel" . to_string ( ) , format ! ( "<#{}>" , channel_id. get( ) ) ) ;
60+ if let Some ( count) = opts. count {
61+ params. insert ( "count" . to_string ( ) , count. to_string ( ) ) ;
62+ }
63+ return alc
64+ . translate ( "audit_log.member.moved_to" , Some ( & params) )
65+ . await ;
66+ }
67+ }
68+ return String :: new ( ) ;
69+ }
70+ MemberAction :: MemberDisconnect => {
71+ if let Some ( opts) = & alc. entry . options {
72+ if let Some ( count) = opts. count {
73+ let mut params = HashMap :: new ( ) ;
74+ params. insert ( "count" . to_string ( ) , count. to_string ( ) ) ;
75+ return alc
76+ . translate ( "audit_log.member.disconnected_count" , Some ( & params) )
77+ . await ;
78+ }
79+ }
80+ return String :: new ( ) ;
81+ }
82+ _ => { }
83+ }
84+
5485 let target_label = alc. translate ( "audit_log.target" , None ) . await ;
5586
5687 let target = if let Some ( target_id) = alc. target_id ( ) {
@@ -85,29 +116,6 @@ impl AuditLogFormatter for MemberFormatter {
85116 }
86117 }
87118 }
88- MemberAction :: MemberMove => {
89- if let Some ( channel_id) = opts. channel_id {
90- let mut params = HashMap :: new ( ) ;
91- params. insert ( "channel" . to_string ( ) , format ! ( "<#{}>" , channel_id. get( ) ) ) ;
92- if let Some ( count) = opts. count {
93- params. insert ( "count" . to_string ( ) , count. to_string ( ) ) ;
94- }
95- let moved = alc
96- . translate ( "audit_log.member.moved_to" , Some ( & params) )
97- . await ;
98- desc. push_str ( & format ! ( "\n {}" , moved) ) ;
99- }
100- }
101- MemberAction :: MemberDisconnect => {
102- if let Some ( count) = opts. count {
103- let mut params = HashMap :: new ( ) ;
104- params. insert ( "count" . to_string ( ) , count. to_string ( ) ) ;
105- let disconnected = alc
106- . translate ( "audit_log.member.disconnected_count" , Some ( & params) )
107- . await ;
108- desc. push_str ( & format ! ( "\n {}" , disconnected) ) ;
109- }
110- }
111119 _ => { }
112120 }
113121 }
0 commit comments