Remove support for TokenType.User (#958)
* Set usage of TokenType.User as an error rather than a warning. * Remove commented sections and #pragma's Additionally, changes use of ReadMessages to ViewChannel since that Obsolete was also suppressed by the pragma
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
#pragma warning disable CS0618
|
||||
using Discord.API;
|
||||
using Discord.API.Gateway;
|
||||
using Discord.Logging;
|
||||
@@ -446,7 +445,7 @@ namespace Discord.WebSocket
|
||||
{
|
||||
var model = data.Guilds[i];
|
||||
var guild = AddGuild(model, state);
|
||||
if (!guild.IsAvailable || ApiClient.AuthTokenType == TokenType.User)
|
||||
if (!guild.IsAvailable)
|
||||
unavailableGuilds++;
|
||||
else
|
||||
await GuildAvailableAsync(guild).ConfigureAwait(false);
|
||||
@@ -465,9 +464,6 @@ namespace Discord.WebSocket
|
||||
return;
|
||||
}
|
||||
|
||||
if (ApiClient.AuthTokenType == TokenType.User)
|
||||
await SyncGuildsAsync().ConfigureAwait(false);
|
||||
|
||||
_lastGuildAvailableTime = Environment.TickCount;
|
||||
_guildDownloadTask = WaitForGuildsAsync(_connection.CancelToken, _gatewayLogger)
|
||||
.ContinueWith(async x =>
|
||||
@@ -542,8 +538,6 @@ namespace Discord.WebSocket
|
||||
var guild = AddGuild(data, State);
|
||||
if (guild != null)
|
||||
{
|
||||
if (ApiClient.AuthTokenType == TokenType.User)
|
||||
await SyncGuildsAsync().ConfigureAwait(false);
|
||||
await TimedInvokeAsync(_joinedGuildEvent, nameof(JoinedGuild), guild).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#pragma warning disable CS0618
|
||||
using Discord.Audio;
|
||||
using Discord.Rest;
|
||||
using System;
|
||||
@@ -64,7 +63,7 @@ namespace Discord.WebSocket
|
||||
public Task DownloaderPromise => _downloaderPromise.Task;
|
||||
public IAudioClient AudioClient => _audioClient;
|
||||
public SocketTextChannel DefaultChannel => TextChannels
|
||||
.Where(c => CurrentUser.GetPermissions(c).ReadMessages)
|
||||
.Where(c => CurrentUser.GetPermissions(c).ViewChannel)
|
||||
.OrderBy(c => c.Position)
|
||||
.FirstOrDefault();
|
||||
public SocketVoiceChannel AFKChannel
|
||||
@@ -192,12 +191,9 @@ namespace Discord.WebSocket
|
||||
|
||||
_syncPromise = new TaskCompletionSource<bool>();
|
||||
_downloaderPromise = new TaskCompletionSource<bool>();
|
||||
if (Discord.ApiClient.AuthTokenType != TokenType.User)
|
||||
{
|
||||
var _ = _syncPromise.TrySetResultAsync(true);
|
||||
/*if (!model.Large)
|
||||
_ = _downloaderPromise.TrySetResultAsync(true);*/
|
||||
}
|
||||
var _ = _syncPromise.TrySetResultAsync(true);
|
||||
/*if (!model.Large)
|
||||
_ = _downloaderPromise.TrySetResultAsync(true);*/
|
||||
}
|
||||
internal void Update(ClientState state, Model model)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user