You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.
i'd like to generalize this to acking if it'd probably fail otherwise, the actual implementation is a bit tricky but im thinking something like this
make Bot::interaction_handle spawn a thread that waits 2 seconds (optimistically assumes next request will take less than a second) and if no request was sent before, defers the interaction
because both defer and Bot::interaction_handle need them, add builder-style ephemeral and update methods to InteractionHandle that use DeferVisibility::Ephemeral and DeferBehavior::Update respectively
remove these parameters from defer method, remove defer_component altogether
add Bot::interaction_handle_manual_defer (i hate the name, ideas?) which has the current behavior
test race conditions (oh no)
enforcement of safety
it'd probably be more idiomatic to have a InteractionHandle::prepare method instead of two variants of the Bot::interaction_handle method, but that way Bot::interaction_handle has no mention of the possible failures if InteractionClient::prepare isn't called besides documentation, so i think this is something like unwrap and unwrap_unchecked (imagine unwrap methods returning Unwrap<T>: Deref<Target = T> with an unsafe method Unwrap::unchecked)
alternatively, Bot::interaction_handle could take an enum/bool telling whether to handle deferring, but this is a hot method and i think writing out the parameter isnt worth it because many people would avoid Bot::interaction_handle_manual_defer since the point of this lib is to abstract over things
lastly, we could take the opposite approach, adding a InteractionHandle::defer_manually method that cancels the spawned thread, tho it looks the best, it means having the overhead of spawning unnecessary tasks and the complexity of holding a thread handle and making it safely cancel a task
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
attachments usually take long enough to upload that they will always require a defer, so automatically ack'ing them would be good
The text was updated successfully, but these errors were encountered: