File tree 2 files changed +2
-10
lines changed
2 files changed +2
-10
lines changed Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ export async function runAddUserCommand(
22
22
"m.room.power_levels" ,
23
23
""
24
24
) ;
25
- console . log ( power_levels ) ;
26
- if ( power_levels [ "users" ] ?. [ event . sender ] < 100 ) { // checks if user is an Admin
25
+ console . log ( power_levels [ "users" ] ) ;
26
+ if ( power_levels [ "users" ] ?. [ event . sender ] < 100 || ! power_levels [ "users" ] [ event . sender ] ) { // checks if user is an Admin
27
27
return client . sendMessage ( roomId , {
28
28
body : "You aren't a moderator!" ,
29
29
msgtype : "m.notice" ,
Original file line number Diff line number Diff line change @@ -17,20 +17,12 @@ export async function runDeleteUserCommand(
17
17
console . log ( formatted_body ) ;
18
18
19
19
if ( ! lookup_user ( event . sender ) . moderator ) {
20
- let power_levels = await client . getRoomStateEvent (
21
- roomId ,
22
- "m.room.power_levels" ,
23
- ""
24
- ) ;
25
- console . log ( power_levels ) ;
26
- if ( power_levels [ "users" ] ?. [ event . sender ] < 100 ) { // checks if user is an Admin
27
20
return client . sendMessage ( roomId , {
28
21
body : "You aren't a moderator!" ,
29
22
msgtype : "m.notice" ,
30
23
format : "org.matrix.custom.html" ,
31
24
formatted_body : "You aren't a moderator!" ,
32
25
} ) ;
33
- }
34
26
}
35
27
36
28
if ( ! args [ 1 ] ) {
You can’t perform that action at this time.
0 commit comments