Skip to content

Commit 86e9d2b

Browse files
SamNuttallLordOfPollspre-commit-ci[bot]
authored
feat: add kwargs to paginator send & reply methods (#1431)
* feat: add kwargs to send and reply in paginator This allows paginators to be sent ephemerally by passing kwargs to paginator methods * style: add whitespace below args (autofix by pre-commit) * refactor: revert BaseContext typehint change Co-authored-by: LordOfPolls <dev@lordofpolls.com> Signed-off-by: Sam Nuttall <dev@samln.dev> * ci: correct from checks. * fix: re-add BaseContext dependancy InteractionContext auto removed by pre-commit --------- Signed-off-by: Sam Nuttall <dev@samln.dev> Co-authored-by: LordOfPolls <dev@lordofpolls.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 5973a76 commit 86e9d2b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

interactions/ext/paginators.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,18 +352,19 @@ def to_dict(self) -> dict:
352352
"components": [c.to_dict() for c in self.create_components()],
353353
}
354354

355-
async def send(self, ctx: BaseContext) -> Message:
355+
async def send(self, ctx: BaseContext, **kwargs) -> Message:
356356
"""
357357
Send this paginator.
358358
359359
Args:
360360
ctx: The context to send this paginator with
361+
**kwargs: Additional options to pass to `send`.
361362
362363
Returns:
363364
The resulting message
364365
365366
"""
366-
self._message = await ctx.send(**self.to_dict())
367+
self._message = await ctx.send(**self.to_dict(), **kwargs)
367368
self._author_id = ctx.author.id
368369

369370
if self.timeout_interval > 1:
@@ -372,16 +373,18 @@ async def send(self, ctx: BaseContext) -> Message:
372373

373374
return self._message
374375

375-
async def reply(self, ctx: "PrefixedContext") -> Message:
376+
async def reply(self, ctx: "PrefixedContext", **kwargs) -> Message:
376377
"""
377378
Reply this paginator to ctx.
378379
379380
Args:
380381
ctx: The context to reply this paginator with
382+
**kwargs: Additional options to pass to `reply`.
383+
381384
Returns:
382385
The resulting message
383386
"""
384-
self._message = await ctx.reply(**self.to_dict())
387+
self._message = await ctx.reply(**self.to_dict(), **kwargs)
385388
self._author_id = ctx.author.id
386389

387390
if self.timeout_interval > 1:

0 commit comments

Comments
 (0)