File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 11use http:: StatusCode ;
2- use lambda_http:: tracing:: error;
2+ use lambda_http:: tracing:: { error, info } ;
33use twilight_http:: Error ;
44use twilight_model:: guild:: Permissions ;
55use twilight_model:: id:: Id ;
@@ -32,11 +32,18 @@ pub async fn intersect_admin_guilds(
3232}
3333
3434async fn is_client_admin_guild ( guild_id : Id < GuildMarker > , client : & twilight_http:: Client ) -> Result < bool , Error > {
35+ info ! ( "Checking if client is admin in guild: {}, {}" , guild_id, client. token( ) . unwrap( ) ) ;
3536 let guilds = client. current_user_guilds ( ) . after ( Id :: new ( guild_id. get ( ) -1 ) ) . limit ( 1 ) . await ?. models ( ) . await . unwrap ( ) ;
37+ info ! ( "Fetched guilds: {:?}" , guilds) ;
3638 let admin_guilds: Vec < CurrentUserGuild > = guilds
3739 . into_iter ( )
3840 . filter ( |g| g. permissions & Permissions :: ADMINISTRATOR == Permissions :: ADMINISTRATOR )
3941 . collect ( ) ;
42+ info ! ( "Admin guilds: {:?}" , admin_guilds) ;
43+ if admin_guilds. is_empty ( ) {
44+ info ! ( "No admin guilds found for client in guild: {}" , guild_id) ;
45+ return Ok ( false ) ;
46+ }
4047 Ok ( admin_guilds. len ( ) == 1 )
4148}
4249
You can’t perform that action at this time.
0 commit comments