66
77import discord_typings
88from aiohttp import FormData
9+
10+ from interactions .client import const
911from interactions .client .const import get_logger , MISSING
1012from interactions .models .discord .components import BaseComponent
1113from interactions .models .discord .file import UPLOADABLE_TYPE
@@ -401,6 +403,14 @@ async def defer(self, *, ephemeral: bool = False) -> None:
401403 async def _send_http_request (
402404 self , message_payload : dict , files : typing .Iterable ["UPLOADABLE_TYPE" ] | None = None
403405 ) -> dict :
406+ if const .has_client_feature ("FOLLOWUP_INTERACTIONS_FOR_IMAGES" ) and not self .deferred :
407+ # experimental bypass for discords broken image proxy
408+ if embeds := message_payload .get ("embeds" , {}):
409+ if any (e .get ("image" ) for e in embeds ):
410+ if MessageFlags .EPHEMERAL in message_payload .get ("flags" , MessageFlags .NONE ):
411+ self .ephemeral = True
412+ await self .defer (ephemeral = self .ephemeral )
413+
404414 if self .responded :
405415 message_data = await self .client .http .post_followup (
406416 message_payload , self .client .app .id , self .token , files = files
@@ -409,9 +419,14 @@ async def _send_http_request(
409419 if isinstance (message_payload , FormData ) and not self .deferred :
410420 await self .defer (ephemeral = self .ephemeral )
411421 if self .deferred :
412- message_data = await self .client .http .edit_interaction_message (
413- message_payload , self .client .app .id , self .token , files = files
414- )
422+ if const .has_client_feature ("FOLLOWUP_INTERACTIONS_FOR_IMAGES" ):
423+ message_data = await self .client .http .post_followup (
424+ message_payload , self .client .app .id , self .token , files = files
425+ )
426+ else :
427+ message_data = await self .client .http .edit_interaction_message (
428+ message_payload , self .client .app .id , self .token , files = files
429+ )
415430 else :
416431 payload = {
417432 "type" : CallbackType .CHANNEL_MESSAGE_WITH_SOURCE ,
0 commit comments