feature: Remove DM cache and fix references (#1851)

* Remove DM cache and fix references

* Move line back to where it was
This commit is contained in:
Paulo
2021-05-26 17:35:49 -03:00
committed by GitHub
parent 95bae786b8
commit 7a201e9ff1
10 changed files with 68 additions and 73 deletions

View File

@@ -87,7 +87,7 @@ namespace Discord
UserProperties? PublicFlags { get; }
/// <summary>
/// Gets the direct message channel of this user, or create one if it does not already exist.
/// Creates the direct message channel of this user.
/// </summary>
/// <remarks>
/// This method is used to obtain or create a channel used to send a direct message.
@@ -102,7 +102,7 @@ namespace Discord
/// <example>
/// <para>The following example attempts to send a direct message to the target user and logs the incident should
/// it fail.</para>
/// <code region="GetOrCreateDMChannelAsync" language="cs"
/// <code region="CreateDMChannelAsync" language="cs"
/// source="../../../Discord.Net.Examples/Core/Entities/Users/IUser.Examples.cs"/>
/// </example>
/// <param name="options">The options to be used when sending the request.</param>
@@ -110,6 +110,6 @@ namespace Discord
/// A task that represents the asynchronous operation for getting or creating a DM channel. The task result
/// contains the DM channel associated with this user.
/// </returns>
Task<IDMChannel> GetOrCreateDMChannelAsync(RequestOptions options = null);
Task<IDMChannel> CreateDMChannelAsync(RequestOptions options = null);
}
}

View File

@@ -42,7 +42,7 @@ namespace Discord
RequestOptions options = null,
AllowedMentions allowedMentions = null)
{
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendMessageAsync(text, isTTS, embed, options, allowedMentions).ConfigureAwait(false);
return await (await user.CreateDMChannelAsync().ConfigureAwait(false)).SendMessageAsync(text, isTTS, embed, options, allowedMentions).ConfigureAwait(false);
}
/// <summary>
@@ -94,7 +94,7 @@ namespace Discord
RequestOptions options = null
)
{
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(stream, filename, text, isTTS, embed, options).ConfigureAwait(false);
return await (await user.CreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(stream, filename, text, isTTS, embed, options).ConfigureAwait(false);
}
/// <summary>
@@ -149,7 +149,7 @@ namespace Discord
Embed embed = null,
RequestOptions options = null)
{
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(filePath, text, isTTS, embed, options).ConfigureAwait(false);
return await (await user.CreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(filePath, text, isTTS, embed, options).ConfigureAwait(false);
}
/// <summary>