@@ -205,31 +205,31 @@ export class Member extends SnowflakeBase {
205
205
return this . guild . bans . add ( this . id , reason , deleteOldMessages )
206
206
}
207
207
208
- async manageable ( ) : Promise < boolean > {
209
- if ( this . id === this . guild . ownerID || this . id === this . client . user ?. id )
208
+ async manageable ( by ?: Member ) : Promise < boolean > {
209
+ by = by ?? await this . guild . me ( )
210
+ if ( this . id === this . guild . ownerID || this . id === by . id )
210
211
return false
211
- if ( this . guild . ownerID === this . client . user ?. id ) return true
212
- const me = await this . guild . me ( )
213
- const highestMe = ( await me . roles . array ( ) ) . sort (
212
+ if ( this . guild . ownerID === by . id ) return true
213
+ const highestBy = ( await by . roles . array ( ) ) . sort (
214
214
( b , a ) => a . position - b . position
215
215
) [ 0 ]
216
216
const highest = ( await this . roles . array ( ) ) . sort (
217
217
( b , a ) => a . position - b . position
218
218
) [ 0 ]
219
- return highestMe . position > highest . position
219
+ return highestBy . position > highest . position
220
220
}
221
221
222
- async bannable ( ) : Promise < boolean > {
223
- const manageable = await this . manageable ( )
222
+ async bannable ( by ?: Member ) : Promise < boolean > {
223
+ const manageable = await this . manageable ( by )
224
224
if ( ! manageable ) return false
225
- const me = await this . guild . me ( )
225
+ const me = by ?? await this . guild . me ( )
226
226
return me . permissions . has ( 'BAN_MEMBERS' )
227
227
}
228
228
229
- async kickable ( ) : Promise < boolean > {
230
- const manageable = await this . manageable ( )
229
+ async kickable ( by ?: Member ) : Promise < boolean > {
230
+ const manageable = await this . manageable ( by )
231
231
if ( ! manageable ) return false
232
- const me = await this . guild . me ( )
232
+ const me = by ?? await this . guild . me ( )
233
233
return me . permissions . has ( 'KICK_MEMBERS' )
234
234
}
235
235
}
0 commit comments