Added missing ToString and DebuggerDisplays
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
using Model = Discord.API.User;
|
||||
using System.Diagnostics;
|
||||
using Model = Discord.API.User;
|
||||
|
||||
namespace Discord.WebSocket
|
||||
{
|
||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
|
||||
internal class SocketGlobalUser : SocketUser
|
||||
{
|
||||
public override bool IsBot { get; internal set; }
|
||||
|
||||
@@ -3,12 +3,14 @@ using Discord.Rest;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Model = Discord.API.GuildMember;
|
||||
using PresenceModel = Discord.API.Presence;
|
||||
|
||||
namespace Discord.WebSocket
|
||||
{
|
||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
|
||||
public class SocketGuildUser : SocketUser, IGuildUser
|
||||
{
|
||||
private long? _joinedAtTicks;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using Model = Discord.API.Presence;
|
||||
using System.Diagnostics;
|
||||
using Model = Discord.API.Presence;
|
||||
|
||||
namespace Discord.WebSocket
|
||||
{
|
||||
//TODO: C#7 Candidate for record type
|
||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
|
||||
public struct SocketPresence : IPresence
|
||||
{
|
||||
public Game? Game { get; }
|
||||
@@ -18,6 +20,9 @@ namespace Discord.WebSocket
|
||||
return new SocketPresence(model.Game != null ? Discord.Game.Create(model.Game) : (Game?)null, model.Status);
|
||||
}
|
||||
|
||||
public override string ToString() => Status.ToString();
|
||||
internal string DebuggerDisplay => $"{Status}{(Game != null ? $", {Game.Value.Name} ({Game.Value.StreamType})" : "")}";
|
||||
|
||||
internal SocketPresence Clone() => this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
using Discord.API.Rest;
|
||||
using Discord.Rest;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Model = Discord.API.User;
|
||||
|
||||
namespace Discord.WebSocket
|
||||
{
|
||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
|
||||
public class SocketSelfUser : SocketUser, ISelfUser
|
||||
{
|
||||
public string Email { get; private set; }
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Model = Discord.API.User;
|
||||
using PresenceModel = Discord.API.Presence;
|
||||
|
||||
namespace Discord.WebSocket
|
||||
{
|
||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
|
||||
public class SocketSimpleUser : SocketUser
|
||||
{
|
||||
public override bool IsBot { get; internal set; }
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Discord.WebSocket
|
||||
=> UserHelper.CreateDMChannelAsync(this, Discord);
|
||||
|
||||
public override string ToString() => $"{Username}#{Discriminator}";
|
||||
private string DebuggerDisplay => $"{Username}#{Discriminator} (Id{(IsBot ? ", Bot" : "")})";
|
||||
internal string DebuggerDisplay => $"{Username}#{Discriminator} (Id{(IsBot ? ", Bot" : "")})";
|
||||
internal SocketUser Clone() => MemberwiseClone() as SocketUser;
|
||||
|
||||
//IUser
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Model = Discord.API.VoiceState;
|
||||
|
||||
namespace Discord.WebSocket
|
||||
{
|
||||
//TODO: C#7 Candidate for record type
|
||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
|
||||
public struct SocketVoiceState : IVoiceState
|
||||
{
|
||||
[Flags]
|
||||
private enum Flags : byte
|
||||
{
|
||||
None = 0x00,
|
||||
Normal = 0x00,
|
||||
Suppressed = 0x01,
|
||||
Muted = 0x02,
|
||||
Deafened = 0x04,
|
||||
@@ -33,7 +35,7 @@ namespace Discord.WebSocket
|
||||
VoiceChannel = voiceChannel;
|
||||
VoiceSessionId = sessionId;
|
||||
|
||||
Flags voiceStates = Flags.None;
|
||||
Flags voiceStates = Flags.Normal;
|
||||
if (isSelfMuted)
|
||||
voiceStates |= Flags.SelfMuted;
|
||||
if (isSelfDeafened)
|
||||
@@ -47,6 +49,8 @@ namespace Discord.WebSocket
|
||||
return new SocketVoiceState(voiceChannel, model.SessionId, model.SelfMute, model.SelfDeaf, model.Suppress);
|
||||
}
|
||||
|
||||
public override string ToString() => VoiceChannel?.Name ?? "Unknown";
|
||||
internal string DebuggerDisplay => $"{VoiceChannel?.Name ?? "Unknown"} ({_voiceStates})";
|
||||
internal SocketVoiceState Clone() => this;
|
||||
|
||||
IVoiceChannel IVoiceState.VoiceChannel => VoiceChannel;
|
||||
|
||||
Reference in New Issue
Block a user