Browse Source

renamed SendMessage's mentions parameter to mentionedUserIds

tags/docs-0.9
RogueException 9 years ago
parent
commit
a154075a50
2 changed files with 13 additions and 13 deletions
  1. +2
    -2
      src/Discord.Net/DiscordAPIClient.cs
  2. +11
    -11
      src/Discord.Net/DiscordClient.API.cs

+ 2
- 2
src/Discord.Net/DiscordAPIClient.cs View File

@@ -173,12 +173,12 @@ namespace Discord
} }


//Messages //Messages
public Task<SendMessageResponse> SendMessage(string channelId, string message, string[] mentions = null, string nonce = null, bool isTTS = false)
public Task<SendMessageResponse> SendMessage(string channelId, string message, string[] mentionedUserIds = null, string nonce = null, bool isTTS = false)
{ {
if (channelId == null) throw new ArgumentNullException(nameof(channelId)); if (channelId == null) throw new ArgumentNullException(nameof(channelId));
if (message == null) throw new ArgumentNullException(nameof(message)); if (message == null) throw new ArgumentNullException(nameof(message));


var request = new SendMessageRequest { Content = message, Mentions = mentions ?? new string[0], Nonce = nonce, IsTTS = isTTS ? true : false };
var request = new SendMessageRequest { Content = message, Mentions = mentionedUserIds ?? new string[0], Nonce = nonce, IsTTS = isTTS ? true : false };
return _rest.Post<SendMessageResponse>(Endpoints.ChannelMessages(channelId), request); return _rest.Post<SendMessageResponse>(Endpoints.ChannelMessages(channelId), request);
} }
public Task<SendMessageResponse> SendFile(string channelId, string filePath) public Task<SendMessageResponse> SendFile(string channelId, string filePath)


+ 11
- 11
src/Discord.Net/DiscordClient.API.cs View File

@@ -297,28 +297,28 @@ namespace Discord
//Messages //Messages
/// <summary> Sends a message to the provided channel, optionally mentioning certain users. </summary> /// <summary> Sends a message to the provided channel, optionally 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 Task<Message[]> SendMessage(Channel channel, string text, params string[] mentions)
=> SendMessage(channel, text, mentions, false);
public Task<Message[]> SendMessage(Channel channel, string text, params string[] mentionedUserIds)
=> SendMessage(channel, text, mentionedUserIds, false);
/// <summary> Sends a message to the provided channel, optionally mentioning certain users. </summary> /// <summary> Sends a message to the provided channel, optionally 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 Task<Message[]> SendMessage(string channelId, string text, params string[] mentions)
=> SendMessage(_channels[channelId], text, mentions, false);
public Task<Message[]> SendMessage(string channelId, string text, params string[] mentionedUserIds)
=> SendMessage(_channels[channelId], text, mentionedUserIds, false);
/// <summary> Sends a message to the provided channel, optionally mentioning certain users. </summary> /// <summary> Sends a message to the provided channel, optionally 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 Task<Message[]> SendTTSMessage(Channel channel, string text, params string[] mentions)
=> SendMessage(channel, text, mentions, true);
public Task<Message[]> SendTTSMessage(Channel channel, string text, params string[] mentionedUserIds)
=> SendMessage(channel, text, mentionedUserIds, true);
/// <summary> Sends a message to the provided channel, optionally mentioning certain users. </summary> /// <summary> Sends a message to the provided channel, optionally 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 Task<Message[]> SendTTSMessage(string channelId, string text, params string[] mentions)
=> SendMessage(_channels[channelId], text, mentions, true);
public Task<Message[]> SendTTSMessage(string channelId, string text, params string[] mentionedUserIds)
=> SendMessage(_channels[channelId], text, mentionedUserIds, true);
/// <summary> Sends a message to the provided channel, optionally mentioning certain users. </summary> /// <summary> Sends a message to the provided channel, optionally 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>
private async Task<Message[]> SendMessage(Channel channel, string text, string[] mentions, bool isTextToSpeech)
private async Task<Message[]> SendMessage(Channel channel, string text, string[] mentionedUserIds, bool isTextToSpeech)
{ {
CheckReady(); CheckReady();
if (channel == null) throw new ArgumentNullException(nameof(channel)); if (channel == null) throw new ArgumentNullException(nameof(channel));
if (text == null) throw new ArgumentNullException(nameof(text)); if (text == null) throw new ArgumentNullException(nameof(text));
mentions = mentions ?? new string[0];
mentionedUserIds = mentionedUserIds ?? new string[0];


int blockCount = (int)Math.Ceiling(text.Length / (double)MaxMessageSize); int blockCount = (int)Math.Ceiling(text.Length / (double)MaxMessageSize);
Message[] result = new Message[blockCount]; Message[] result = new Message[blockCount];
@@ -346,7 +346,7 @@ namespace Discord
} }
else else
{ {
var model = await _api.SendMessage(channel.Id, blockText, mentions, nonce, isTextToSpeech).ConfigureAwait(false);
var model = await _api.SendMessage(channel.Id, blockText, mentionedUserIds, nonce, isTextToSpeech).ConfigureAwait(false);
var msg = _messages.GetOrAdd(model.Id, channel.Id, model.Author.Id); var msg = _messages.GetOrAdd(model.Id, channel.Id, model.Author.Id);
msg.Update(model); msg.Update(model);
RaiseMessageSent(msg); RaiseMessageSent(msg);


Loading…
Cancel
Save