Table of Contents

Method WaitForButtonAsync

Namespace
DSharpPlus.Interactivity.Extensions
Assembly
DSharpPlus.Interactivity.dll

WaitForButtonAsync(DiscordMessage)

Waits for any button to be pressed on the specified message.

public static Task<InteractivityResult<ComponentInteractionCreatedEventArgs>> WaitForButtonAsync(this DiscordMessage message)

Parameters

message DiscordMessage

The message to wait on.

Returns

Task<InteractivityResult<ComponentInteractionCreatedEventArgs>>

WaitForButtonAsync(DiscordMessage, TimeSpan?)

Waits for any button to be pressed on the specified message.

public static Task<InteractivityResult<ComponentInteractionCreatedEventArgs>> WaitForButtonAsync(this DiscordMessage message, TimeSpan? timeoutOverride = null)

Parameters

message DiscordMessage

The message to wait on.

timeoutOverride TimeSpan?

Overrides the timeout set in Timeout

Returns

Task<InteractivityResult<ComponentInteractionCreatedEventArgs>>

WaitForButtonAsync(DiscordMessage, CancellationToken)

Waits for any button to be pressed on the specified message.

public static Task<InteractivityResult<ComponentInteractionCreatedEventArgs>> WaitForButtonAsync(this DiscordMessage message, CancellationToken token)

Parameters

message DiscordMessage

The message to wait on.

token CancellationToken

A custom cancellation token that can be cancelled at any point.

Returns

Task<InteractivityResult<ComponentInteractionCreatedEventArgs>>

WaitForButtonAsync(DiscordMessage, string, TimeSpan?)

Waits for a button with the specified Id to be pressed on the specified message.

public static Task<InteractivityResult<ComponentInteractionCreatedEventArgs>> WaitForButtonAsync(this DiscordMessage message, string id, TimeSpan? timeoutOverride = null)

Parameters

message DiscordMessage

The message to wait on.

id string

The Id of the button to wait for.

timeoutOverride TimeSpan?

Overrides the timeout set in Timeout

Returns

Task<InteractivityResult<ComponentInteractionCreatedEventArgs>>

WaitForButtonAsync(DiscordMessage, string, CancellationToken)

Waits for a button with the specified Id to be pressed on the specified message.

public static Task<InteractivityResult<ComponentInteractionCreatedEventArgs>> WaitForButtonAsync(this DiscordMessage message, string id, CancellationToken token)

Parameters

message DiscordMessage

The message to wait on.

id string

The Id of the button to wait for.

token CancellationToken

A custom cancellation token that can be cancelled at any point.

Returns

Task<InteractivityResult<ComponentInteractionCreatedEventArgs>>

WaitForButtonAsync(DiscordMessage, DiscordUser, TimeSpan?)

Waits for any button to be pressed on the specified message by the specified user.

public static Task<InteractivityResult<ComponentInteractionCreatedEventArgs>> WaitForButtonAsync(this DiscordMessage message, DiscordUser user, TimeSpan? timeoutOverride = null)

Parameters

message DiscordMessage

The message to wait on.

user DiscordUser

The user to wait for button input from.

timeoutOverride TimeSpan?

Overrides the timeout set in Timeout

Returns

Task<InteractivityResult<ComponentInteractionCreatedEventArgs>>

WaitForButtonAsync(DiscordMessage, DiscordUser, CancellationToken)

Waits for any button to be pressed on the specified message by the specified user.

public static Task<InteractivityResult<ComponentInteractionCreatedEventArgs>> WaitForButtonAsync(this DiscordMessage message, DiscordUser user, CancellationToken token)

Parameters

message DiscordMessage

The message to wait on.

user DiscordUser

The user to wait for button input from.

token CancellationToken

A custom cancellation token that can be cancelled at any point.

Returns

Task<InteractivityResult<ComponentInteractionCreatedEventArgs>>

WaitForButtonAsync(DiscordMessage, Func<ComponentInteractionCreatedEventArgs, bool>, TimeSpan?)

Waits for any button to be interacted with.

public static Task<InteractivityResult<ComponentInteractionCreatedEventArgs>> WaitForButtonAsync(this DiscordMessage message, Func<ComponentInteractionCreatedEventArgs, bool> predicate, TimeSpan? timeoutOverride = null)

Parameters

message DiscordMessage

The message to wait on.

predicate Func<ComponentInteractionCreatedEventArgs, bool>

The predicate to filter interactions by.

timeoutOverride TimeSpan?

Override the timeout specified in InteractivityConfiguration

Returns

Task<InteractivityResult<ComponentInteractionCreatedEventArgs>>

WaitForButtonAsync(DiscordMessage, Func<ComponentInteractionCreatedEventArgs, bool>, CancellationToken)

Waits for any button to be interacted with.

public static Task<InteractivityResult<ComponentInteractionCreatedEventArgs>> WaitForButtonAsync(this DiscordMessage message, Func<ComponentInteractionCreatedEventArgs, bool> predicate, CancellationToken token)

Parameters

message DiscordMessage

The message to wait on.

predicate Func<ComponentInteractionCreatedEventArgs, bool>

The predicate to filter interactions by.

token CancellationToken

A token to cancel interactivity with at any time. Pass System.Threading.CancellationToken.None to wait indefinitely.

Returns

Task<InteractivityResult<ComponentInteractionCreatedEventArgs>>