Browse Source

Implement

pull/2055/head
Armano den Boef 3 years ago
parent
commit
4ea150b626
3 changed files with 28 additions and 13 deletions
  1. +17
    -0
      src/Discord.Net.Core/Entities/Users/IThreadUser.cs
  2. +5
    -9
      src/Discord.Net.Rest/Entities/Users/RestThreadUser.cs
  3. +6
    -4
      src/Discord.Net.WebSocket/Entities/Users/SocketThreadUser.cs

+ 17
- 0
src/Discord.Net.Core/Entities/Users/IThreadUser.cs View File

@@ -0,0 +1,17 @@
using System;

namespace Discord
{
public interface IThreadUser
{
/// <summary>
/// Gets the <see cref="IThreadChannel"/> this user is in.
/// </summary>
IThreadChannel Thread { get; }

/// <summary>
/// Gets the timestamp for when this user joined this thread.
/// </summary>
DateTimeOffset ThreadJoinedAt { get; }
}
}

+ 5
- 9
src/Discord.Net.Rest/Entities/Users/RestThreadUser.cs View File

@@ -7,17 +7,13 @@ namespace Discord.Rest
/// <summary>
/// Represents a thread user received over the REST api.
/// </summary>
public class RestThreadUser : RestEntity<ulong>
public class RestThreadUser : RestEntity<ulong>, IThreadUser
{
/// <summary>
/// Gets the <see cref="RestThreadChannel"/> this user is in.
/// </summary>
/// <inheritdoc />
public IThreadChannel Thread { get; }

/// <summary>
/// Gets the timestamp for when this user joined this thread.
/// </summary>
public DateTimeOffset JoinedAt { get; private set; }
/// <inheritdoc />
public DateTimeOffset ThreadJoinedAt { get; private set; }

/// <summary>
/// Gets the guild this user is in.
@@ -40,7 +36,7 @@ namespace Discord.Rest

internal void Update(Model model)
{
JoinedAt = model.JoinTimestamp;
ThreadJoinedAt = model.JoinTimestamp;
}

/// <summary>


+ 6
- 4
src/Discord.Net.WebSocket/Entities/Users/SocketThreadUser.cs View File

@@ -10,16 +10,14 @@ namespace Discord.WebSocket
/// <summary>
/// Represents a thread user received over the gateway.
/// </summary>
public class SocketThreadUser : SocketUser, IGuildUser
public class SocketThreadUser : SocketUser, IThreadUser, IGuildUser
{
/// <summary>
/// Gets the <see cref="SocketThreadChannel"/> this user is in.
/// </summary>
public SocketThreadChannel Thread { get; private set; }

/// <summary>
/// Gets the timestamp for when this user joined this thread.
/// </summary>
/// <inheritdoc/>
public DateTimeOffset ThreadJoinedAt { get; private set; }

/// <summary>
@@ -180,6 +178,10 @@ namespace Discord.WebSocket

/// <inheritdoc/>
public Task RemoveTimeOutAsync(RequestOptions options = null) => GuildUser.RemoveTimeOutAsync(options);

/// <inheritdoc />
IThreadChannel IThreadUser.Thread => Thread;

/// <inheritdoc/>
GuildPermissions IGuildUser.GuildPermissions => GuildUser.GuildPermissions;



Loading…
Cancel
Save