@@ -602,13 +602,8 @@ namespace Discord.API
|
|||||||
Preconditions.NotEqual(channelId, 0, nameof(channelId));
|
Preconditions.NotEqual(channelId, 0, nameof(channelId));
|
||||||
Preconditions.NotEqual(messageId, 0, nameof(messageId));
|
Preconditions.NotEqual(messageId, 0, nameof(messageId));
|
||||||
Preconditions.NotNull(args, nameof(args));
|
Preconditions.NotNull(args, nameof(args));
|
||||||
if (args.Content.IsSpecified)
|
if (args.Content.IsSpecified && args.Content.Value?.Length > DiscordConfig.MaxMessageSize)
|
||||||
{
|
throw new ArgumentOutOfRangeException($"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", nameof(args.Content));
|
||||||
if (!args.Embed.IsSpecified)
|
|
||||||
Preconditions.NotNullOrEmpty(args.Content, nameof(args.Content));
|
|
||||||
if (args.Content.Value?.Length > DiscordConfig.MaxMessageSize)
|
|
||||||
throw new ArgumentOutOfRangeException($"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", nameof(args.Content));
|
|
||||||
}
|
|
||||||
options = RequestOptions.CreateOrClone(options);
|
options = RequestOptions.CreateOrClone(options);
|
||||||
|
|
||||||
var ids = new BucketIds(channelId: channelId);
|
var ids = new BucketIds(channelId: channelId);
|
||||||
|
|||||||
@@ -32,6 +32,11 @@ namespace Discord.Rest
|
|||||||
var args = new MessageProperties();
|
var args = new MessageProperties();
|
||||||
func(args);
|
func(args);
|
||||||
|
|
||||||
|
bool hasText = args.Content.IsSpecified ? !string.IsNullOrEmpty(args.Content.Value) : !string.IsNullOrEmpty(msg.Content);
|
||||||
|
bool hasEmbed = args.Embed.IsSpecified ? args.Embed.Value != null : msg.Embeds.Any();
|
||||||
|
if (!hasText && !hasEmbed)
|
||||||
|
Preconditions.NotNullOrEmpty(args.Content.IsSpecified ? args.Content.Value : string.Empty, nameof(args.Content));
|
||||||
|
|
||||||
var apiArgs = new API.Rest.ModifyMessageParams
|
var apiArgs = new API.Rest.ModifyMessageParams
|
||||||
{
|
{
|
||||||
Content = args.Content,
|
Content = args.Content,
|
||||||
|
|||||||
Reference in New Issue
Block a user