/// <summary> /// Updates a message with a newer partial version of the same message. This is primarily used /// for obtaining the full message from a message update event, which only supplies the changes /// rather than the full message. /// </summary> /// <exception cref="ArgumentException">Thrown if the IDs of each message do not match.</exception> /// <exception cref="ArgumentNullException"></exception> /// <exception cref="DiscordHttpApiException"></exception> public static DiscordMessage Update(DiscordMessage message, DiscordMessage withPartial) { if (message == null) { throw new ArgumentNullException(nameof(message)); } if (withPartial == null) { throw new ArgumentNullException(nameof(withPartial)); } if (message.Id != withPartial.Id) { throw new ArgumentException("Cannot update one message with another. The message IDs must match."); } DiscordApiData updatedData = message.originalData.Clone(); updatedData.OverwriteUpdate(withPartial.originalData); return(new DiscordMessage(message.http, updatedData)); }