Added missing ConfigureAwaits
This commit is contained in:
@@ -103,7 +103,7 @@ namespace Discord.Rpc
|
||||
//Abort connection on timeout
|
||||
var _ = Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(ConnectionTimeout);
|
||||
await Task.Delay(ConnectionTimeout).ConfigureAwait(false);
|
||||
connectTask.TrySetException(new TimeoutException());
|
||||
});
|
||||
|
||||
@@ -231,27 +231,27 @@ namespace Discord.Rpc
|
||||
|
||||
public async Task SubscribeGlobal(RpcGlobalEvent evnt, RequestOptions options = null)
|
||||
{
|
||||
await ApiClient.SendGlobalSubscribeAsync(GetEventName(evnt), options);
|
||||
await ApiClient.SendGlobalSubscribeAsync(GetEventName(evnt), options).ConfigureAwait(false);
|
||||
}
|
||||
public async Task UnsubscribeGlobal(RpcGlobalEvent evnt, RequestOptions options = null)
|
||||
{
|
||||
await ApiClient.SendGlobalUnsubscribeAsync(GetEventName(evnt), options);
|
||||
await ApiClient.SendGlobalUnsubscribeAsync(GetEventName(evnt), options).ConfigureAwait(false);
|
||||
}
|
||||
public async Task SubscribeGuild(ulong guildId, RpcChannelEvent evnt, RequestOptions options = null)
|
||||
{
|
||||
await ApiClient.SendGuildSubscribeAsync(GetEventName(evnt), guildId, options);
|
||||
await ApiClient.SendGuildSubscribeAsync(GetEventName(evnt), guildId, options).ConfigureAwait(false);
|
||||
}
|
||||
public async Task UnsubscribeGuild(ulong guildId, RpcChannelEvent evnt, RequestOptions options = null)
|
||||
{
|
||||
await ApiClient.SendGuildUnsubscribeAsync(GetEventName(evnt), guildId, options);
|
||||
await ApiClient.SendGuildUnsubscribeAsync(GetEventName(evnt), guildId, options).ConfigureAwait(false);
|
||||
}
|
||||
public async Task SubscribeChannel(ulong channelId, RpcChannelEvent evnt, RequestOptions options = null)
|
||||
{
|
||||
await ApiClient.SendChannelSubscribeAsync(GetEventName(evnt), channelId);
|
||||
await ApiClient.SendChannelSubscribeAsync(GetEventName(evnt), channelId).ConfigureAwait(false);
|
||||
}
|
||||
public async Task UnsubscribeChannel(ulong channelId, RpcChannelEvent evnt, RequestOptions options = null)
|
||||
{
|
||||
await ApiClient.SendChannelUnsubscribeAsync(GetEventName(evnt), channelId);
|
||||
await ApiClient.SendChannelUnsubscribeAsync(GetEventName(evnt), channelId).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<RpcGuild> GetRpcGuildAsync(ulong id, RequestOptions options = null)
|
||||
|
||||
@@ -72,14 +72,14 @@ namespace Discord.Rpc
|
||||
async Task<IMessage> IMessageChannel.GetMessageAsync(ulong id, CacheMode mode, RequestOptions options)
|
||||
{
|
||||
if (mode == CacheMode.AllowDownload)
|
||||
return await GetMessageAsync(id, options);
|
||||
return await GetMessageAsync(id, options).ConfigureAwait(false);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(int limit, CacheMode mode, RequestOptions options)
|
||||
{
|
||||
if (mode == CacheMode.AllowDownload)
|
||||
return GetMessagesAsync(limit, options);
|
||||
return GetMessagesAsync(limit, options).ConfigureAwait(false);
|
||||
else
|
||||
return AsyncEnumerable.Empty<IReadOnlyCollection<IMessage>>();
|
||||
}
|
||||
@@ -98,14 +98,14 @@ namespace Discord.Rpc
|
||||
return AsyncEnumerable.Empty<IReadOnlyCollection<IMessage>>();
|
||||
}
|
||||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options)
|
||||
=> await GetPinnedMessagesAsync(options);
|
||||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false);
|
||||
|
||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, RequestOptions options)
|
||||
=> await SendFileAsync(filePath, text, isTTS, options);
|
||||
=> await SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false);
|
||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options)
|
||||
=> await SendFileAsync(stream, filename, text, isTTS, options);
|
||||
=> await SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false);
|
||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, RequestOptions options)
|
||||
=> await SendMessageAsync(text, isTTS, options);
|
||||
=> await SendMessageAsync(text, isTTS, options).ConfigureAwait(false);
|
||||
IDisposable IMessageChannel.EnterTypingState(RequestOptions options)
|
||||
=> EnterTypingState(options);
|
||||
|
||||
|
||||
@@ -71,14 +71,14 @@ namespace Discord.Rpc
|
||||
async Task<IMessage> IMessageChannel.GetMessageAsync(ulong id, CacheMode mode, RequestOptions options)
|
||||
{
|
||||
if (mode == CacheMode.AllowDownload)
|
||||
return await GetMessageAsync(id, options);
|
||||
return await GetMessageAsync(id, options).ConfigureAwait(false);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
IAsyncEnumerable<IReadOnlyCollection<IMessage>> IMessageChannel.GetMessagesAsync(int limit, CacheMode mode, RequestOptions options)
|
||||
{
|
||||
if (mode == CacheMode.AllowDownload)
|
||||
return GetMessagesAsync(limit, options);
|
||||
return GetMessagesAsync(limit, options).ConfigureAwait(false);
|
||||
else
|
||||
return AsyncEnumerable.Empty<IReadOnlyCollection<IMessage>>();
|
||||
}
|
||||
@@ -97,14 +97,14 @@ namespace Discord.Rpc
|
||||
return AsyncEnumerable.Empty<IReadOnlyCollection<IMessage>>();
|
||||
}
|
||||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options)
|
||||
=> await GetPinnedMessagesAsync(options);
|
||||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false);
|
||||
|
||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, RequestOptions options)
|
||||
=> await SendFileAsync(filePath, text, isTTS, options);
|
||||
=> await SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false);
|
||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options)
|
||||
=> await SendFileAsync(stream, filename, text, isTTS, options);
|
||||
=> await SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false);
|
||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, RequestOptions options)
|
||||
=> await SendMessageAsync(text, isTTS, options);
|
||||
=> await SendMessageAsync(text, isTTS, options).ConfigureAwait(false);
|
||||
IDisposable IMessageChannel.EnterTypingState(RequestOptions options)
|
||||
=> EnterTypingState(options);
|
||||
|
||||
|
||||
@@ -51,17 +51,17 @@ namespace Discord.Rpc
|
||||
=> ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, role, options);
|
||||
|
||||
public async Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null)
|
||||
=> await ChannelHelper.GetInvitesAsync(this, Discord, options);
|
||||
=> await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false);
|
||||
public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 3600, int? maxUses = null, bool isTemporary = true, RequestOptions options = null)
|
||||
=> await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, options);
|
||||
=> await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, options).ConfigureAwait(false);
|
||||
|
||||
public override string ToString() => Name;
|
||||
|
||||
//IGuildChannel
|
||||
async Task<IReadOnlyCollection<IInviteMetadata>> IGuildChannel.GetInvitesAsync(RequestOptions options)
|
||||
=> await GetInvitesAsync(options);
|
||||
=> await GetInvitesAsync(options).ConfigureAwait(false);
|
||||
async Task<IInviteMetadata> IGuildChannel.CreateInviteAsync(int? maxAge, int? maxUses, bool isTemporary, RequestOptions options)
|
||||
=> await CreateInviteAsync(maxAge, maxUses, isTemporary, options);
|
||||
=> await CreateInviteAsync(maxAge, maxUses, isTemporary, options).ConfigureAwait(false);
|
||||
|
||||
IReadOnlyCollection<Overwrite> IGuildChannel.PermissionOverwrites { get { throw new NotSupportedException(); } }
|
||||
OverwritePermissions? IGuildChannel.GetPermissionOverwrite(IUser user)
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace Discord.Rpc
|
||||
async Task<IMessage> IMessageChannel.GetMessageAsync(ulong id, CacheMode mode, RequestOptions options)
|
||||
{
|
||||
if (mode == CacheMode.AllowDownload)
|
||||
return await GetMessageAsync(id, options);
|
||||
return await GetMessageAsync(id, options).ConfigureAwait(false);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
@@ -99,14 +99,14 @@ namespace Discord.Rpc
|
||||
return AsyncEnumerable.Empty<IReadOnlyCollection<IMessage>>();
|
||||
}
|
||||
async Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options)
|
||||
=> await GetPinnedMessagesAsync(options);
|
||||
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false);
|
||||
|
||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, RequestOptions options)
|
||||
=> await SendFileAsync(filePath, text, isTTS, options);
|
||||
=> await SendFileAsync(filePath, text, isTTS, options).ConfigureAwait(false);
|
||||
async Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, RequestOptions options)
|
||||
=> await SendFileAsync(stream, filename, text, isTTS, options);
|
||||
=> await SendFileAsync(stream, filename, text, isTTS, options).ConfigureAwait(false);
|
||||
async Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, RequestOptions options)
|
||||
=> await SendMessageAsync(text, isTTS, options);
|
||||
=> await SendMessageAsync(text, isTTS, options).ConfigureAwait(false);
|
||||
IDisposable IMessageChannel.EnterTypingState(RequestOptions options)
|
||||
=> EnterTypingState(options);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,6 @@ namespace Discord.Rpc
|
||||
Task<IDMChannel> IUser.GetDMChannelAsync(CacheMode mode, RequestOptions options)
|
||||
=> Task.FromResult<IDMChannel>(null);
|
||||
async Task<IDMChannel> IUser.CreateDMChannelAsync(RequestOptions options)
|
||||
=> await CreateDMChannelAsync(options);
|
||||
=> await CreateDMChannelAsync(options).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user