RPC's Authorize should not try to authenticate
This commit is contained in:
@@ -155,13 +155,13 @@ namespace Discord.Commands
|
||||
var args = GenerateArgs(argList, paramList);
|
||||
switch (RunMode)
|
||||
{
|
||||
case RunMode.Sync:
|
||||
case RunMode.Sync: //Always sync
|
||||
await _action(context, args).ConfigureAwait(false);
|
||||
break;
|
||||
case RunMode.Mixed:
|
||||
case RunMode.Mixed: //Sync until first await statement
|
||||
var t1 = _action(context, args);
|
||||
break;
|
||||
case RunMode.Async:
|
||||
case RunMode.Async: //Always async
|
||||
var t2 = Task.Run(() => _action(context, args));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -385,25 +385,33 @@ namespace Discord.Rpc
|
||||
//CancellationToken = _cancelToken //TODO: Implement
|
||||
};
|
||||
|
||||
var _ = Task.Run(async () =>
|
||||
if (ApiClient.LoginState == LoginState.LoggedIn)
|
||||
{
|
||||
try
|
||||
var _ = Task.Run(async () =>
|
||||
{
|
||||
var response = await ApiClient.SendAuthenticateAsync(options).ConfigureAwait(false);
|
||||
CurrentUser = RestSelfUser.Create(this, response.User);
|
||||
CurrentApplication = RestApplication.Create(this, response.Application);
|
||||
Scopes = response.Scopes;
|
||||
TokenExpiresAt = response.Expires;
|
||||
try
|
||||
{
|
||||
var response = await ApiClient.SendAuthenticateAsync(options).ConfigureAwait(false);
|
||||
CurrentUser = RestSelfUser.Create(this, response.User);
|
||||
CurrentApplication = RestApplication.Create(this, response.Application);
|
||||
Scopes = response.Scopes;
|
||||
TokenExpiresAt = response.Expires;
|
||||
|
||||
var __ = _connectTask.TrySetResultAsync(true); //Signal the .Connect() call to complete
|
||||
await _rpcLogger.InfoAsync("Ready").ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _rpcLogger.ErrorAsync($"Error handling {cmd}{(evnt.IsSpecified ? $" ({evnt})" : "")}", ex).ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
});
|
||||
var __ = _connectTask.TrySetResultAsync(true); //Signal the .Connect() call to complete
|
||||
await _rpcLogger.InfoAsync("Ready").ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _rpcLogger.ErrorAsync($"Error handling {cmd}{(evnt.IsSpecified ? $" ({evnt})" : "")}", ex).ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
var _ = _connectTask.TrySetResultAsync(true); //Signal the .Connect() call to complete
|
||||
await _rpcLogger.InfoAsync("Ready").ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user