Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Can't edit ephemeral messages #2830

Open
3 tasks done
FemLolStudio opened this issue Jan 22, 2024 · 6 comments
Open
3 tasks done

[Bug]: Can't edit ephemeral messages #2830

FemLolStudio opened this issue Jan 22, 2024 · 6 comments
Labels

Comments

@FemLolStudio
Copy link

FemLolStudio commented Jan 22, 2024

Check The Docs

  • I double checked the docs and couldn't find any useful information.

Verify Issue Source

  • I verified the issue was caused by Discord.Net.

Check your intents

  • I double checked that I have the required intents.

Description

I have some command in my bot where I used this method to inform the user about the current stage from the process, but today I noticed somewhy now it's not working.

Maybe something changed about the Discord API, because I get the same problem on the previous Discord.NET versions.

The problem exists in 3.9.0 too, that was the lowest what I was able to go with my current bot codes, so maybe it's something about the Discord API.

Version

3.13.0

Logs

guid:4c60 : 07:34:48 Command     Command: ephemeral-test, User: femlol
guid:e291 : 07:34:49 App Command Discord.Net.HttpException: The server responded with error 10008: Unknown Message
   at Discord.Net.Queue.RequestBucket.SendAsync(RestRequest request)
   at Discord.Net.Queue.RequestQueue.SendAsync(RestRequest request)
   at Discord.API.DiscordRestApiClient.SendInternalAsync(String method, String endpoint, RestRequest request)
   at Discord.API.DiscordRestApiClient.SendJsonAsync[TResponse](String method, String endpoint, Object payload, BucketId bucketId, ClientBucketType clientBucket, RequestOptions options)
   at Discord.Rest.RestUserMessage.ModifyAsync(Action`1 func, RequestOptions options)
   at ChibiMation.Command.BaseCommands.Test(Boolean ephemeral) in /src/Command/BaseCommands.cs:line 68
   at Discord.Interactions.Builders.ModuleClassBuilder.<>c__DisplayClass11_0.<<CreateCallback>g__ExecuteCallback|1>d.MoveNext()
guid:4c60 : 07:34:57 Command     Command: ephemeral-test, User: femlol

Sample

[SlashCommand("ephemeral-test", "Testing bug")]
public async Task Test(bool ephemeral)
{
    await DeferAsync(ephemeral: ephemeral);
    IUserMessage msg = await FollowupAsync("Test", ephemeral: ephemeral);
    await msg.ModifyAsync(x => x.Content = "Test success");
}

Result for true and false:
image

Packages

<ItemGroup>
    <PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.7.300" />
    <PackageReference Include="AWSSDK.S3" Version="3.7.305.14" />
    <PackageReference Include="Betalgo.OpenAI" Version="7.4.3" />
    <PackageReference Include="Discord.Net" Version="3.13.0" />
    <PackageReference Include="Google.Apis.YouTube.v3" Version="1.66.0.3205" />
    <PackageReference Include="InnerTube" Version="1.1.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.1">
        <PrivateAssets>all</PrivateAssets>
        <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.Extensions.Configuration.Yaml" Version="2.0.0-preview2" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
    <PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="8.0.1" />
    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
    <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.0-beta.2" />
    <PackageReference Include="SixLabors.ImageSharp" Version="3.1.2" />
    <PackageReference Include="YamlDotNet" Version="13.7.1" />
</ItemGroup>

Environment

  • OS: Ubuntu 20.04.6 LTS
  • Architecture: x64 (vps)
  • .Net: 8.0
@Misha-133
Copy link
Member

iirc FollowupAsync returns a RestFollowupMessage. So try using this type instead.

@FemLolStudio
Copy link
Author

FemLolStudio commented Jan 22, 2024

Hmm, okey. Yeah now its working. But it's actually returning an IUserMessage instead of RestFollowupMessage so thats confusing.

image

Now in this form it's working:

[SlashCommand("ephemeral-test", "Testing bug")]
public async Task Test(bool ephemeral)
{
    await DeferAsync(ephemeral: ephemeral);
    RestFollowupMessage msg = (RestFollowupMessage)await FollowupAsync("Test", ephemeral: ephemeral);
    await msg.ModifyAsync(x => x.Content = "Test success");
}

@Misha-133
Copy link
Member

But it's actually returning an IUserMessage instead of RestFollowupMessage so thats confusing.

Hmm yeah, that's because of an abstraction layer. Actual method impls in Rest/SocketInteraction return a RestFollowupMessage. I'll see if we can change this.

@realdisplyy
Copy link

How could you first not respond with a file and then afterwards modifying it with a uploading a file to the message?

@SylveonDeko
Copy link
Contributor

How could you first not respond with a file and then afterwards modifying it with a uploading a file to the message?

How could you not ask for support in the discord

@realdisplyy
Copy link

Okay sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants