@@ -183,11 +183,12 @@ async def respond(
183183 "Interaction is unknown (you have already responded to the interaction or responding took too long)" ,
184184 ) from None
185185
186- if not ephemeral and type in (4 , 7 ) and isinstance (res , dict ):
186+ if type in (4 , 7 ) and isinstance (res , dict ):
187187 return ComponentMessage (
188188 state = state ,
189189 data = res ,
190190 channel = self .channel or Object (id = self .channel_id ),
191+ ephemeral = res .get ("flags" ) == 64 ,
191192 )
192193 else :
193194 return res
@@ -205,6 +206,7 @@ async def send(
205206 components : List [Union [ActionRow , Component , List [Component ]]] = None ,
206207 delete_after : float = None ,
207208 ) -> Optional [Union [ComponentMessage , dict ]]:
209+ await self .defer (ephemeral = ephemeral )
208210 res = await self .respond (
209211 type = 4 ,
210212 content = content ,
@@ -217,9 +219,10 @@ async def send(
217219 ephemeral = ephemeral ,
218220 components = components ,
219221 )
220- if isinstance (res , dict ):
222+
223+ if delete_after is None :
221224 return res
222- elif res is not None and delete_after is not None :
225+ elif res is not None :
223226 await res .delete (delay = delete_after )
224227
225228 async def edit_origin (
@@ -234,6 +237,7 @@ async def edit_origin(
234237 components : List [Union [ActionRow , Component , List [Component ]]] = None ,
235238 delete_after : float = None ,
236239 ):
240+ await self .defer (edit_origin = True )
237241 res = await self .respond (
238242 type = 7 ,
239243 content = content ,
@@ -245,7 +249,8 @@ async def edit_origin(
245249 allowed_mentions = allowed_mentions ,
246250 components = components ,
247251 )
248- if isinstance (res , dict ):
252+
253+ if delete_after is None :
249254 return res
250- elif res is not None and delete_after is not None :
255+ elif res is not None :
251256 await res .delete (delay = delete_after )
0 commit comments