Skip to content

Commit 1a54aca

Browse files
committed
fix: update auto-defer to kwargs only deferral
1 parent acf24bd commit 1a54aca

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

interactions/models/internal/auto_defer.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import asyncio
2+
import contextlib
23
from typing import TYPE_CHECKING
34

45
import attrs
@@ -30,12 +31,10 @@ async def __call__(self, ctx: "InteractionContext") -> None:
3031
loop = asyncio.get_event_loop()
3132
loop.call_later(self.time_until_defer, loop.create_task, self.defer(ctx))
3233
else:
33-
await ctx.defer(self.ephemeral)
34+
await ctx.defer(ephemeral=self.ephemeral)
3435

3536
async def defer(self, ctx: "InteractionContext") -> None:
3637
"""Defer the command"""
3738
if not ctx.responded or not ctx.deferred:
38-
try:
39-
await ctx.defer(self.ephemeral)
40-
except (AlreadyDeferred, NotFound, BadRequest, HTTPException):
41-
pass
39+
with contextlib.suppress(AlreadyDeferred, NotFound, BadRequest, HTTPException):
40+
await ctx.defer(ephemeral=self.ephemeral)

0 commit comments

Comments
 (0)