Title: Redesigning Interactivity · Issue #2153 · DSharpPlus/DSharpPlus · GitHub
Open Graph Title: Redesigning Interactivity · Issue #2153 · DSharpPlus/DSharpPlus
X Title: Redesigning Interactivity · Issue #2153 · DSharpPlus/DSharpPlus
Description: Summary Per "As some of y'all may know, Interactivity has had multiple bugs over the years, most of them being a result from the design. Since we haven't really maintained it recently - or even added more features to it - should we compl...
Open Graph Description: Summary Per "As some of y'all may know, Interactivity has had multiple bugs over the years, most of them being a result from the design. Since we haven't really maintained it recently - or even add...
X Description: Summary Per "As some of y'all may know, Interactivity has had multiple bugs over the years, most of them being a result from the design. Since we haven't really maintained it recently ...
Opengraph URL: https://github.com/DSharpPlus/DSharpPlus/issues/2153
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Redesigning Interactivity","articleBody":"# Summary\nPer [\"As some of y'all may know, Interactivity has had multiple bugs over the years, most of them being a result from the design. Since we haven't really maintained it recently - or even added more features to it - should we completely rewrite it from scratch?\"](https://discord.com/channels/379378609942560770/379386730538860554/1220790222736982026), there were 135 votes to merge Interactivity with the new Commands extension, 32 votes to keep Interactivity separate and rewrite it from scratch and 6 votes to just keep the current implementation and fix the bugs.\n\n\n\n\nWe've decided to do the following solution, quoted directly from @akiraveliara:\n\u003e if i had to design this for v6, i would make an Interactivity.Stateful and an Interactivity.Stateless internal package (PrivateAssets=\"all\")\nand have Commands include and frontend the first one\nhave Interactivity proper include and frontend both of them\ni do respect that interactivity integrated into and understanding commands is really good UX\nespecially if it can automatically decide the \"right thing\" for different contexts\n(though, that stuff will need some work to work with custom contexts)\n\nI will be working on the `DSharpPlus.Interactivity.Stateful` package, which will directly interface with `DSharpPlus.Commands`. Here is the following API:\n\n```cs\npublic async ValueTask PromptAsync(CommandContext context, string question, Func\u003cPromptData, ValueTask\u003e callback);\npublic async ValueTask ChooseAsync(CommandContext context, string question, IReadOnlyList\u003cstring\u003e answers, Func\u003cChooseData, ValueTask\u003e callback);\npublic async ValueTask ConfirmAsync(CommandContext context, string question, Func\u003cConfirmData ValueTask\u003e callback);\npublic async ValueTask PaginateAsync(CommandContext context, IEnumerable\u003cDiscordMessageBuilder\u003e pages, PaginationControls? controls = null);\n```\n\n\u003e [!Note]\n\u003e ALL methods above are non-blocking.\n\n# `PromptAsync`\nThis method will utilize each processor's available feature set to nicely present the question to the user:\n- Interaction-based contexts will use modals\n- Text command-based contexts will use modals via a button\n\nPrompts can timeout and it will be the callback's responsibility to check for that by reading the `PromptData.IsTimedOut` property.\n\n# `ChooseAsync`\nThe user will be presented with multiple choices through a select component and will return a single (or optionally multiple) responses within the callback data. This method has the same API timeout behavior as the `PromptAsync` method.\n\n# `ConfirmAsync`\nThis method will ask the user to confirm their decision, which will be returned via a `bool` property within the callback data. This method has the same API timeout behavior as the `PromptAsync` method.\n\n# `PaginateAsync`\n`PaginateAsync` is nearly identical to the existing pagination API that you're already familiar from the `DSharpPlus.Interactivity` extension. The `PaginationControls? controls = null` parameter will act as an override for the default `PaginationControls` defined within the interactivity/commands (tbd) configuration. The `PaginationControls` contains the control buttons (previous page, stop, next page, etc) for the user, which will attempt to be **appended** onto the message builder and will throw when it fails. `PaginationControls` will also contain a property (likely flags enum or delegate) that defines what to do when a non-author of a pagination clicks on the control buttons. The default implementations available are:\n- Act as the author\n- Copy and respond (non)ephemerally\n- Error ephemerally\n- Ignore\n\n# Notes\nIf there are any other API methods that you would like to see on `CommandContext` specifically, please comment down below.","author":{"url":"https://github.com/OoLunar","@type":"Person","name":"OoLunar"},"datePublished":"2024-11-03T20:53:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/2153/DSharpPlus/issues/2153"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7389457a-ec6d-0410-7a4c-3dfe955a1993 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CFFE:18E07E:3A13E9:4A91D3:698D1732 |
| html-safe-nonce | d4f00ca41a95f1b7c3ae870a753827cbccbae77d5090ea024750cb6f595ce8f3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRkZFOjE4RTA3RTozQTEzRTk6NEE5MUQzOjY5OEQxNzMyIiwidmlzaXRvcl9pZCI6IjMyOTU5NzIwODI0MDgyOTgyOTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7e4b88221df024c117c924750ed2a0fe282c7eabae8f2f9d11d947d7777709b2 |
| hovercard-subject-tag | issue:2631468273 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/DSharpPlus/DSharpPlus/2153/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a840f29686e9519c3d84ed166c5070db4a7937581f506faa4ed2e516061c9f45/DSharpPlus/DSharpPlus/issues/2153 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a840f29686e9519c3d84ed166c5070db4a7937581f506faa4ed2e516061c9f45/DSharpPlus/DSharpPlus/issues/2153 |
| og:image:alt | Summary Per "As some of y'all may know, Interactivity has had multiple bugs over the years, most of them being a result from the design. Since we haven't really maintained it recently - or even add... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | OoLunar |
| hostname | github.com |
| expected-hostname | github.com |
| None | c25395580e1e3bf82d705e0982a1b24255366088720fef945f1493d5e3e67954 |
| turbo-cache-control | no-preview |
| go-import | github.com/DSharpPlus/DSharpPlus git https://github.com/DSharpPlus/DSharpPlus.git |
| octolytics-dimension-user_id | 36208721 |
| octolytics-dimension-user_login | DSharpPlus |
| octolytics-dimension-repository_id | 67243489 |
| octolytics-dimension-repository_nwo | DSharpPlus/DSharpPlus |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 67243489 |
| octolytics-dimension-repository_network_root_nwo | DSharpPlus/DSharpPlus |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 94219dcb9c044792ec271fd5b23c73419858bef7 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width