You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

SocketGroupUser.cs 2.7 kB

8 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
7 years ago
8 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using System.Diagnostics;
  2. using Model = Discord.API.User;
  3. namespace Discord.WebSocket
  4. {
  5. [DebuggerDisplay("{DebuggerDisplay,nq}")]
  6. public class SocketGroupUser : SocketUser, IGroupUser
  7. {
  8. /// <summary>
  9. /// Gets the group channel of the user.
  10. /// </summary>
  11. /// <returns>
  12. /// A <see cref="SocketGroupChannel" /> representing the channel of which the user belongs to.
  13. /// </returns>
  14. public SocketGroupChannel Channel { get; }
  15. /// <inheritdoc />
  16. internal override SocketGlobalUser GlobalUser { get; }
  17. /// <inheritdoc />
  18. public override bool IsBot { get { return GlobalUser.IsBot; } internal set { GlobalUser.IsBot = value; } }
  19. /// <inheritdoc />
  20. public override string Username { get { return GlobalUser.Username; } internal set { GlobalUser.Username = value; } }
  21. /// <inheritdoc />
  22. public override ushort DiscriminatorValue { get { return GlobalUser.DiscriminatorValue; } internal set { GlobalUser.DiscriminatorValue = value; } }
  23. /// <inheritdoc />
  24. public override string AvatarId { get { return GlobalUser.AvatarId; } internal set { GlobalUser.AvatarId = value; } }
  25. /// <inheritdoc />
  26. internal override SocketPresence Presence { get { return GlobalUser.Presence; } set { GlobalUser.Presence = value; } }
  27. /// <inheritdoc />
  28. public override bool IsWebhook => false;
  29. internal SocketGroupUser(SocketGroupChannel channel, SocketGlobalUser globalUser)
  30. : base(channel.Discord, globalUser.Id)
  31. {
  32. Channel = channel;
  33. GlobalUser = globalUser;
  34. }
  35. internal static SocketGroupUser Create(SocketGroupChannel channel, ClientState state, Model model)
  36. {
  37. var entity = new SocketGroupUser(channel, channel.Discord.GetOrCreateUser(state, model));
  38. entity.Update(state, model);
  39. return entity;
  40. }
  41. private string DebuggerDisplay => $"{Username}#{Discriminator} ({Id}{(IsBot ? ", Bot" : "")}, Group)";
  42. internal new SocketGroupUser Clone() => MemberwiseClone() as SocketGroupUser;
  43. //IVoiceState
  44. /// <inheritdoc />
  45. bool IVoiceState.IsDeafened => false;
  46. /// <inheritdoc />
  47. bool IVoiceState.IsMuted => false;
  48. /// <inheritdoc />
  49. bool IVoiceState.IsSelfDeafened => false;
  50. /// <inheritdoc />
  51. bool IVoiceState.IsSelfMuted => false;
  52. /// <inheritdoc />
  53. bool IVoiceState.IsSuppressed => false;
  54. /// <inheritdoc />
  55. IVoiceChannel IVoiceState.VoiceChannel => null;
  56. /// <inheritdoc />
  57. string IVoiceState.VoiceSessionId => null;
  58. }
  59. }