/
RestBan.cs
48 lines (44 loc) · 1.33 KB
/
RestBan.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System.Diagnostics;
using Model = Discord.API.Ban;
namespace Discord.Rest
{
/// <summary>
/// Represents a REST-based ban object.
/// </summary>
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class RestBan : IBan
{
#region RestBan
/// <summary>
/// Gets the banned user.
/// </summary>
/// <returns>
/// A generic <see cref="RestUser"/> object that was banned.
/// </returns>
public RestUser User { get; }
/// <inheritdoc />
public string Reason { get; }
internal RestBan(RestUser user, string reason)
{
User = user;
Reason = reason;
}
internal static RestBan Create(BaseDiscordClient client, Model model)
{
return new RestBan(RestUser.Create(client, model.User), model.Reason);
}
/// <summary>
/// Gets the name of the banned user.
/// </summary>
/// <returns>
/// A string containing the name of the user that was banned.
/// </returns>
public override string ToString() => User.ToString();
private string DebuggerDisplay => $"{User}: {Reason}";
#endregion
#region IBan
/// <inheritdoc />
IUser IBan.User => User;
#endregion
}
}