DSharpPlus icon indicating copy to clipboard operation
DSharpPlus copied to clipboard

Create and Edit message dont have the same Mentions default values

Open MichaelPrust opened this issue 4 years ago • 7 comments

Summary

Messages assumes different behaviour about "mentions" between create and edit routines.

Details

Using a DiscordMessageBuilder: When creating a message using DiscordChannel.CreateMessageAsync(), the message assumes Mentions.All by default on DiscordApiClient.CreateMessageAsync() (currently on line 1300). But when editing a message by DiscordMessage.ModifyAsync(), the message assumes Mentions.None on by default on DiscordApiClient.EditMessageAsync() (currently on line 1414).

MichaelPrust avatar Dec 23 '21 16:12 MichaelPrust

This is a mitigation for an issue that arises with mentions. The reason Mentions.None is used when editing is so you don’t pseudo-mention users and roles (editing messages does not ping users, but will highlight the message)

VelvetToroyashi avatar Dec 23 '21 18:12 VelvetToroyashi

This is a mitigation for an issue that arises with mentions. The reason Mentions.None is used when editing is so you don’t pseudo-mention users and roles (editing messages does not ping users, but will highlight the message)

but the "highlight" is gone after editing the message

MichaelPrust avatar Dec 23 '21 19:12 MichaelPrust

What version are you using, though? And how're you going about editing messages, because I did extensive testing before opening a PR that put the nail in the coffin for mention issues.

VelvetToroyashi avatar Dec 23 '21 19:12 VelvetToroyashi

#1054 for reference

VelvetToroyashi avatar Dec 23 '21 19:12 VelvetToroyashi

What version are you using, though? And how're you going about editing messages, because I did extensive testing before opening a PR that put the nail in the coffin for mention issues.

I update yesterday to 4.2.0-nightly-01054 after saw the messages lossing highlight on edited messages. But its keep occuring.

Before it, I was on 4.2.0-nightly-01045 when I saw it happening for the first time.

Previous this update to 4.2.0-nightly-01045, I was using the 04.01.00, where its dont happens.

MichaelPrust avatar Dec 23 '21 19:12 MichaelPrust

How are you going about editing these messages?

VelvetToroyashi avatar Dec 23 '21 20:12 VelvetToroyashi

How are you going about editing these messages?

I did a simple command to reproduce this issue

image image

        [Command("TestBuildMessage")]
        public async Task TestBuildMessage(CommandContext ctx, [RemainingText] string msg)
        {
            var b = new DiscordMessageBuilder();
            b.WithContent(msg);

            await ctx.Channel.SendMessageAsync(b);
        }

        [Command("TestEditBuildMessage")]
        public async Task TestBuildMessage(CommandContext ctx, ulong msgId, [RemainingText] string msg)
        {
            var b = new DiscordMessageBuilder();
            b.WithContent(msg);

            var dMsg = await ctx.Channel.GetMessageAsync(msgId);

            await dMsg.ModifyAsync(b);
        }

MichaelPrust avatar Dec 23 '21 20:12 MichaelPrust

👋🏽 Just making sure this is a nonissue before I close this

VelvetToroyashi avatar Dec 06 '22 01:12 VelvetToroyashi