Skip to content

Commit

Permalink
FollowupAsync ephemeral doesn't actually work, it uses whatever Defer…
Browse files Browse the repository at this point in the history
…Async is
  • Loading branch information
austins committed Sep 6, 2023
1 parent f824ffb commit fdf040c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ await _command
.Received(1)
.FollowupAsync(
embed: Arg.Is<Embed>(x => x.Title == "Translated Message"),
ephemeral: true,
options: Arg.Any<RequestOptions>()
);
}
Expand Down Expand Up @@ -167,7 +166,6 @@ await _command
.Received(1)
.FollowupAsync(
embed: Arg.Is<Embed>(x => x.Title == "Translated Message"),
ephemeral: true,
options: Arg.Any<RequestOptions>()
);
}
Expand All @@ -186,11 +184,7 @@ public async Task Handle_MessageCommandExecutedNotification_Returns_WhenTranslat
// Assert
await _command
.Received(1)
.FollowupAsync(
"Translating this bot's messages isn't allowed.",
ephemeral: true,
options: Arg.Any<RequestOptions>()
);
.FollowupAsync("Translating this bot's messages isn't allowed.", options: Arg.Any<RequestOptions>());
}

[Fact]
Expand Down Expand Up @@ -225,7 +219,6 @@ await _command
.Received(1)
.FollowupAsync(
$"Your locale {userLocale} isn't supported for translation via this action.",
ephemeral: true,
options: Arg.Any<RequestOptions>()
);
}
Expand Down Expand Up @@ -268,7 +261,6 @@ await _command
.Received(1)
.FollowupAsync(
"The message couldn't be translated. It might already be in your language or the translator failed to detect its source language.",
ephemeral: true,
options: Arg.Any<RequestOptions>()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ await _translationProvider
Arg.Is<SupportedLanguage>(x => x.LangCode == sourceLanguage.LangCode)
);

await command.Received(1).DeferAsync(true, Arg.Any<RequestOptions>());
await command.Received(1).DeferAsync(false, Arg.Any<RequestOptions>());

await command
.Received(1)
Expand Down Expand Up @@ -156,9 +156,7 @@ public async Task Handle_SlashCommandExecutedNotification_Returns_SourceTextIsEm
await _sut.Handle(notification, CancellationToken.None);

// Assert
await command
.Received(1)
.FollowupAsync("Nothing to translate.", ephemeral: true, options: Arg.Any<RequestOptions>());
await command.Received(1).FollowupAsync("Nothing to translate.", options: Arg.Any<RequestOptions>());

await _translationProvider
.DidNotReceive()
Expand Down Expand Up @@ -244,7 +242,6 @@ await command
.Received(1)
.FollowupAsync(
"Couldn't detect the source language to translate from or the result is the same.",
ephemeral: true,
options: Arg.Any<RequestOptions>()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public async Task Handle(MessageCommandExecutedNotification notification, Cancel

await notification.Command.FollowupAsync(
"Translating this bot's messages isn't allowed.",
ephemeral: true,
options: new RequestOptions { CancelToken = cancellationToken }
);

Expand Down Expand Up @@ -119,7 +118,6 @@ await notification.Command.FollowupAsync(
// Send message if no translation providers support the locale.
await notification.Command.FollowupAsync(
$"Your locale {userLocale} isn't supported for translation via this action.",
ephemeral: true,
options: new RequestOptions { CancelToken = cancellationToken }
);

Expand All @@ -132,7 +130,6 @@ await notification.Command.FollowupAsync(

await notification.Command.FollowupAsync(
"The message couldn't be translated. It might already be in your language or the translator failed to detect its source language.",
ephemeral: true,
options: new RequestOptions { CancelToken = cancellationToken }
);

Expand Down Expand Up @@ -164,7 +161,6 @@ await notification.Command.FollowupAsync(
.WithUrl(GetJumpUrl(notification.Command.Data.Message).AbsoluteUri)
.WithDescription(description)
.Build(),
ephemeral: true,
options: new RequestOptions { CancelToken = cancellationToken }
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public async Task Handle(SlashCommandExecutedNotification notification, Cancella
return;
}

await notification.Command.DeferAsync(true, new RequestOptions { CancelToken = cancellationToken });
await notification.Command.DeferAsync(options: new RequestOptions { CancelToken = cancellationToken });

// Get the input values.
var options = notification.Command.Data.Options;
Expand All @@ -60,7 +60,6 @@ public async Task Handle(SlashCommandExecutedNotification notification, Cancella

await notification.Command.FollowupAsync(
"Nothing to translate.",
ephemeral: true,
options: new RequestOptions { CancelToken = cancellationToken }
);

Expand Down Expand Up @@ -89,7 +88,6 @@ await notification.Command.FollowupAsync(

await notification.Command.FollowupAsync(
"Couldn't detect the source language to translate from or the result is the same.",
ephemeral: true,
options: new RequestOptions { CancelToken = cancellationToken }
);

Expand Down

0 comments on commit fdf040c

Please sign in to comment.