Added support for group channel icons
This commit is contained in:
@@ -8,5 +8,7 @@
|
||||
=> iconId != null ? $"{DiscordConfig.ClientAPIUrl}guilds/{guildId}/icons/{iconId}.jpg" : null;
|
||||
public static string GetGuildSplashUrl(ulong guildId, string splashId)
|
||||
=> splashId != null ? $"{DiscordConfig.ClientAPIUrl}guilds/{guildId}/splashes/{splashId}.jpg" : null;
|
||||
public static string GetChannelIconUrl(ulong channelId, string iconId)
|
||||
=> iconId != null ? $"{DiscordConfig.ClientAPIUrl}channel-icons/{channelId}/{iconId}.jpg" : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,8 +35,12 @@ namespace Discord.API
|
||||
[JsonProperty("user_limit")]
|
||||
public Optional<int> UserLimit { get; set; }
|
||||
|
||||
//DMChannel
|
||||
//PrivateChannel
|
||||
[JsonProperty("recipients")]
|
||||
public Optional<User[]> Recipients { get; set; }
|
||||
|
||||
//GroupChannel
|
||||
[JsonProperty("icon")]
|
||||
public Optional<string> Icon { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,12 +16,14 @@ namespace Discord
|
||||
internal class GroupChannel : SnowflakeEntity, IGroupChannel
|
||||
{
|
||||
protected ConcurrentDictionary<ulong, IUser> _users;
|
||||
private string _iconId;
|
||||
|
||||
public override DiscordClient Discord { get; }
|
||||
public string Name { get; private set; }
|
||||
|
||||
public IReadOnlyCollection<IUser> Recipients => _users.ToReadOnlyCollection();
|
||||
public virtual IReadOnlyCollection<IMessage> CachedMessages => ImmutableArray.Create<IMessage>();
|
||||
public string IconUrl => API.CDN.GetChannelIconUrl(Id, _iconId);
|
||||
|
||||
public GroupChannel(DiscordClient discord, ConcurrentDictionary<ulong, IUser> recipients, Model model)
|
||||
: base(model.Id)
|
||||
@@ -37,6 +39,8 @@ namespace Discord
|
||||
|
||||
if (model.Name.IsSpecified)
|
||||
Name = model.Name.Value;
|
||||
if (model.Icon.IsSpecified)
|
||||
_iconId = model.Icon.Value;
|
||||
|
||||
if (source != UpdateSource.Creation && model.Recipients.IsSpecified)
|
||||
UpdateUsers(model.Recipients.Value, source);
|
||||
|
||||
Reference in New Issue
Block a user