Add IUser#SendMessageAsync extension (#706)
* Add IUser#SendMessageAsync extension * Add ConfigureAwait
This commit is contained in:
committed by
RogueException
parent
cce572c600
commit
fb0a056d76
16
src/Discord.Net.Core/Extensions/UserExtensions.cs
Normal file
16
src/Discord.Net.Core/Extensions/UserExtensions.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
public static class UserExtensions
|
||||
{
|
||||
public static async Task<IUserMessage> SendMessageAsync(this IUser user,
|
||||
string text,
|
||||
bool isTTS = false,
|
||||
Embed embed = null,
|
||||
RequestOptions options = null)
|
||||
{
|
||||
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user