Changed Guild#DefaultChannel to resolve the first accessible channel (#777)
* Changed Guild#DefaultChannel to resolve the first accessible channel Resolves #776 This change is inline with hammerandchisel/discord-api-docs#329 RestGuild#DefaultChannelId is now obsolete and will throw a NotSupportedException. * RestGuild#DefaultChannelId will fall back to the guild ID Adding an exception here would be a breaking change, so this was agreed to fall back to the previous behavior, which would just return the guild ID.
This commit is contained in:
@@ -54,7 +54,6 @@ namespace Discord.WebSocket
|
||||
public string SplashId { get; private set; }
|
||||
|
||||
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
|
||||
public SocketTextChannel DefaultChannel => GetTextChannel(Id);
|
||||
public string IconUrl => CDN.GetGuildIconUrl(Id, IconId);
|
||||
public string SplashUrl => CDN.GetGuildSplashUrl(Id, SplashId);
|
||||
public bool HasAllMembers => MemberCount == DownloadedMemberCount;// _downloaderPromise.Task.IsCompleted;
|
||||
@@ -62,6 +61,10 @@ namespace Discord.WebSocket
|
||||
public Task SyncPromise => _syncPromise.Task;
|
||||
public Task DownloaderPromise => _downloaderPromise.Task;
|
||||
public IAudioClient AudioClient => _audioClient;
|
||||
public SocketTextChannel DefaultChannel => TextChannels
|
||||
.Where(c => CurrentUser.GetPermissions(c).ReadMessages)
|
||||
.OrderBy(c => c.Position)
|
||||
.FirstOrDefault();
|
||||
public SocketVoiceChannel AFKChannel
|
||||
{
|
||||
get
|
||||
@@ -606,7 +609,7 @@ namespace Discord.WebSocket
|
||||
ulong? IGuild.AFKChannelId => AFKChannelId;
|
||||
IAudioClient IGuild.AudioClient => null;
|
||||
bool IGuild.Available => true;
|
||||
ulong IGuild.DefaultChannelId => Id;
|
||||
ulong IGuild.DefaultChannelId => DefaultChannel?.Id ?? 0;
|
||||
ulong? IGuild.EmbedChannelId => EmbedChannelId;
|
||||
IRole IGuild.EveryoneRole => EveryoneRole;
|
||||
IReadOnlyCollection<IRole> IGuild.Roles => Roles;
|
||||
|
||||
Reference in New Issue
Block a user