yippee (#3021)
This commit is contained in:
@@ -8,6 +8,11 @@ namespace Discord
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IChannel : ISnowflakeEntity
|
public interface IChannel : ISnowflakeEntity
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Get the type of this channel.
|
||||||
|
/// </summary>
|
||||||
|
ChannelType ChannelType { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name of this channel.
|
/// Gets the name of this channel.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ namespace Discord.Rest
|
|||||||
public class RestChannel : RestEntity<ulong>, IChannel, IUpdateable
|
public class RestChannel : RestEntity<ulong>, IChannel, IUpdateable
|
||||||
{
|
{
|
||||||
#region RestChannel
|
#region RestChannel
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public ChannelType ChannelType { get; internal set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
|
public virtual DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
|
||||||
|
|
||||||
@@ -68,7 +72,11 @@ namespace Discord.Rest
|
|||||||
_ => throw new InvalidOperationException($"Unexpected channel type: {model.Type}"),
|
_ => throw new InvalidOperationException($"Unexpected channel type: {model.Type}"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
internal virtual void Update(Model model) { }
|
|
||||||
|
internal virtual void Update(Model model)
|
||||||
|
{
|
||||||
|
ChannelType = model.Type;
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual Task UpdateAsync(RequestOptions options = null) => Task.Delay(0);
|
public virtual Task UpdateAsync(RequestOptions options = null) => Task.Delay(0);
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ namespace Discord.Rest
|
|||||||
}
|
}
|
||||||
internal override void Update(Model model)
|
internal override void Update(Model model)
|
||||||
{
|
{
|
||||||
|
base.Update(model);
|
||||||
|
|
||||||
if(model.Recipients.IsSpecified)
|
if(model.Recipients.IsSpecified)
|
||||||
Recipient?.Update(model.Recipients.Value[0]);
|
Recipient?.Update(model.Recipients.Value[0]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ namespace Discord.Rest
|
|||||||
}
|
}
|
||||||
internal override void Update(Model model)
|
internal override void Update(Model model)
|
||||||
{
|
{
|
||||||
|
base.Update(model);
|
||||||
if (model.Name.IsSpecified)
|
if (model.Name.IsSpecified)
|
||||||
Name = model.Name.Value;
|
Name = model.Name.Value;
|
||||||
if (model.Icon.IsSpecified)
|
if (model.Icon.IsSpecified)
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ namespace Discord.Rest
|
|||||||
}
|
}
|
||||||
internal override void Update(Model model)
|
internal override void Update(Model model)
|
||||||
{
|
{
|
||||||
|
base.Update(model);
|
||||||
Name = model.Name.Value;
|
Name = model.Name.Value;
|
||||||
|
|
||||||
if (model.Position.IsSpecified)
|
if (model.Position.IsSpecified)
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ namespace Discord.WebSocket
|
|||||||
public abstract class SocketChannel : SocketEntity<ulong>, IChannel
|
public abstract class SocketChannel : SocketEntity<ulong>, IChannel
|
||||||
{
|
{
|
||||||
#region SocketChannel
|
#region SocketChannel
|
||||||
|
/// <inheritdoc />
|
||||||
|
public ChannelType ChannelType { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets when the channel is created.
|
/// Gets when the channel is created.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -38,7 +41,11 @@ namespace Discord.WebSocket
|
|||||||
_ => throw new InvalidOperationException($"Unexpected channel type: {model.Type}"),
|
_ => throw new InvalidOperationException($"Unexpected channel type: {model.Type}"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
internal abstract void Update(ClientState state, Model model);
|
|
||||||
|
internal virtual void Update(ClientState state, Model model)
|
||||||
|
{
|
||||||
|
ChannelType = model.Type;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region User
|
#region User
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ namespace Discord.WebSocket
|
|||||||
internal override void Update(ClientState state, Model model)
|
internal override void Update(ClientState state, Model model)
|
||||||
{
|
{
|
||||||
Recipient.Update(state, model.Recipients.Value[0]);
|
Recipient.Update(state, model.Recipients.Value[0]);
|
||||||
|
base.Update(state, model);
|
||||||
}
|
}
|
||||||
internal static SocketDMChannel Create(DiscordSocketClient discord, ClientState state, ulong channelId, API.User recipient)
|
internal static SocketDMChannel Create(DiscordSocketClient discord, ClientState state, ulong channelId, API.User recipient)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ namespace Discord.WebSocket
|
|||||||
}
|
}
|
||||||
internal override void Update(ClientState state, Model model)
|
internal override void Update(ClientState state, Model model)
|
||||||
{
|
{
|
||||||
|
base.Update(state, model);
|
||||||
if (model.Name.IsSpecified)
|
if (model.Name.IsSpecified)
|
||||||
Name = model.Name.Value;
|
Name = model.Name.Value;
|
||||||
if (model.Icon.IsSpecified)
|
if (model.Icon.IsSpecified)
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ namespace Discord.WebSocket
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
internal override void Update(ClientState state, Model model)
|
internal override void Update(ClientState state, Model model)
|
||||||
{
|
{
|
||||||
|
base.Update(state, model);
|
||||||
Name = model.Name.Value;
|
Name = model.Name.Value;
|
||||||
Position = model.Position.GetValueOrDefault(0);
|
Position = model.Position.GetValueOrDefault(0);
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ namespace Discord
|
|||||||
{
|
{
|
||||||
internal sealed class MockedCategoryChannel : ICategoryChannel
|
internal sealed class MockedCategoryChannel : ICategoryChannel
|
||||||
{
|
{
|
||||||
|
public ChannelType ChannelType => ChannelType.Category;
|
||||||
public int Position => throw new NotImplementedException();
|
public int Position => throw new NotImplementedException();
|
||||||
|
|
||||||
public IGuild Guild => throw new NotImplementedException();
|
public IGuild Guild => throw new NotImplementedException();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ namespace Discord
|
|||||||
{
|
{
|
||||||
internal sealed class MockedDMChannel : IDMChannel
|
internal sealed class MockedDMChannel : IDMChannel
|
||||||
{
|
{
|
||||||
|
public ChannelType ChannelType => ChannelType.DM;
|
||||||
public IUser Recipient => throw new NotImplementedException();
|
public IUser Recipient => throw new NotImplementedException();
|
||||||
|
|
||||||
public IReadOnlyCollection<IUser> Recipients => throw new NotImplementedException();
|
public IReadOnlyCollection<IUser> Recipients => throw new NotImplementedException();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ namespace Discord
|
|||||||
{
|
{
|
||||||
internal sealed class MockedGroupChannel : IGroupChannel
|
internal sealed class MockedGroupChannel : IGroupChannel
|
||||||
{
|
{
|
||||||
|
public ChannelType ChannelType => ChannelType.Group;
|
||||||
public IReadOnlyCollection<IUser> Recipients => throw new NotImplementedException();
|
public IReadOnlyCollection<IUser> Recipients => throw new NotImplementedException();
|
||||||
|
|
||||||
public string Name => throw new NotImplementedException();
|
public string Name => throw new NotImplementedException();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ namespace Discord
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class MockedInvalidChannel : IChannel
|
internal sealed class MockedInvalidChannel : IChannel
|
||||||
{
|
{
|
||||||
|
public ChannelType ChannelType => ChannelType.Text;
|
||||||
public string Name => throw new NotImplementedException();
|
public string Name => throw new NotImplementedException();
|
||||||
|
|
||||||
public DateTimeOffset CreatedAt => throw new NotImplementedException();
|
public DateTimeOffset CreatedAt => throw new NotImplementedException();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ namespace Discord
|
|||||||
{
|
{
|
||||||
internal sealed class MockedTextChannel : ITextChannel
|
internal sealed class MockedTextChannel : ITextChannel
|
||||||
{
|
{
|
||||||
|
public ChannelType ChannelType => ChannelType.Text;
|
||||||
public bool IsNsfw => throw new NotImplementedException();
|
public bool IsNsfw => throw new NotImplementedException();
|
||||||
|
|
||||||
public int DefaultSlowModeInterval => throw new NotImplementedException();
|
public int DefaultSlowModeInterval => throw new NotImplementedException();
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ namespace Discord
|
|||||||
{
|
{
|
||||||
internal sealed class MockedVoiceChannel : IVoiceChannel
|
internal sealed class MockedVoiceChannel : IVoiceChannel
|
||||||
{
|
{
|
||||||
|
public ChannelType ChannelType => ChannelType.Voice;
|
||||||
|
|
||||||
public int DefaultSlowModeInterval => throw new NotImplementedException();
|
public int DefaultSlowModeInterval => throw new NotImplementedException();
|
||||||
|
|
||||||
public int Bitrate => throw new NotImplementedException();
|
public int Bitrate => throw new NotImplementedException();
|
||||||
|
|||||||
Reference in New Issue
Block a user