@@ -245,7 +245,7 @@ namespace Discord
=> SendMessage(channel?.Id, text, mentions);
=> SendMessage(channel?.Id, text, mentions);
/// <summary> Sends a message to the provided channel, mentioning certain users. </summary>
/// <summary> Sends a message to the provided channel, mentioning certain users. </summary>
/// <remarks> While not required, it is recommended to include a mention reference in the text (see User.Mention). </remarks>
/// <remarks> While not required, it is recommended to include a mention reference in the text (see User.Mention). </remarks>
public async Task<Message[]> SendMessage(string channelId, string text, string[] mentions)
public async Task<Message[]> SendMessage(string channelId, string text, string[] mentions, bool isTextToSpeech = false )
{
{
CheckReady();
CheckReady();
if (channelId == null) throw new ArgumentNullException(nameof(channelId));
if (channelId == null) throw new ArgumentNullException(nameof(channelId));
@@ -267,7 +267,8 @@ namespace Discord
Content = blockText,
Content = blockText,
Timestamp = DateTime.UtcNow,
Timestamp = DateTime.UtcNow,
Author = new UserReference { Avatar = _currentUser.AvatarId, Discriminator = _currentUser.Discriminator, Id = _currentUser.Id, Username = _currentUser.Name },
Author = new UserReference { Avatar = _currentUser.AvatarId, Discriminator = _currentUser.Discriminator, Id = _currentUser.Id, Username = _currentUser.Name },
ChannelId = channelId
ChannelId = channelId,
IsTextToSpeech = isTextToSpeech
});
});
msg.IsQueued = true;
msg.IsQueued = true;
msg.Nonce = nonce;
msg.Nonce = nonce;
@@ -276,11 +277,11 @@ namespace Discord
}
}
else
else
{
{
var model = await _api.SendMessage(channelId, blockText, mentions, nonce).ConfigureAwait(false);
var model = await _api.SendMessage(channelId, blockText, mentions, nonce, isTextToSpeech ).ConfigureAwait(false);
var msg = _messages.GetOrAdd(model.Id, channelId, model.Author.Id);
var msg = _messages.GetOrAdd(model.Id, channelId, model.Author.Id);
msg.Update(model);
msg.Update(model);
RaiseMessageSent(msg);
RaiseMessageSent(msg);
}
}
await Task.Delay(1000).ConfigureAwait(false);
await Task.Delay(1000).ConfigureAwait(false);
}
}
return result;
return result;