/// <inheritdoc /> public virtual async Task <IChannel> GetChannelAsync(ulong id) { var model = await ApiClient.GetChannelAsync(id).ConfigureAwait(false); if (model != null) { if (model.GuildId.IsSpecified) { var guildModel = await ApiClient.GetGuildAsync(model.GuildId.Value).ConfigureAwait(false); if (guildModel != null) { var guild = new Guild(this, guildModel); return(guild.ToChannel(model)); } } else if (model.Type == ChannelType.DM) { return(new DMChannel(this, new User(model.Recipients.Value[0]), model)); } else if (model.Type == ChannelType.Group) { var channel = new GroupChannel(this, model); channel.UpdateUsers(model.Recipients.Value, UpdateSource.Creation); return(channel); } else { throw new InvalidOperationException($"Unexpected channel type: {model.Type}"); } } return(null); }
public GroupUser(GroupChannel channel, User user) { Channel = channel; User = user; }