NetCord icon indicating copy to clipboard operation
NetCord copied to clipboard

Context CancellationToken?

Open nixonjoshua98 opened this issue 1 month ago • 1 comments

Description

Perhaps I have missed it on the documentation but do we have a way of accessing a cancellation token? Perhaps expires after 3 seconds or 15minutes if its deferred?

[SubSlashCommand("add", "Add timed role")]
public async Task OpenAddRoleModalAsync(CancellationToken cancellationToken) {}

nixonjoshua98 avatar Nov 08 '25 13:11 nixonjoshua98

Hi, something like this is not currently supported.

My takes on this:

  • I am not a fan of introducing parameters for slash commands that are not mapped to actual slash command parameters (this feature could be handled by Context.CancellationToken instead I think)
  • Making something like this to work would contradict https://github.com/NetCordDev/NetCord/issues/4#issuecomment-1454116536, you can always respond to the interaction with some other way making the cancellation token outdated

Even though I am not a fan of this feature, I am still curious what it would be for.

KubaZ2 avatar Nov 08 '25 14:11 KubaZ2