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.

RpcChannelSummary.cs 864 B

1234567891011121314151617181920212223242526272829303132
  1. using System.Diagnostics;
  2. using Model = Discord.API.Rpc.ChannelSummary;
  3. namespace Discord.Rpc
  4. {
  5. [DebuggerDisplay(@"{DebuggerDisplay,nq}")]
  6. public class RpcChannelSummary
  7. {
  8. public ulong Id { get; }
  9. public string Name { get; private set; }
  10. public ChannelType Type { get; private set; }
  11. internal RpcChannelSummary(ulong id)
  12. {
  13. Id = id;
  14. }
  15. internal static RpcChannelSummary Create(Model model)
  16. {
  17. var entity = new RpcChannelSummary(model.Id);
  18. entity.Update(model);
  19. return entity;
  20. }
  21. internal void Update(Model model)
  22. {
  23. Name = model.Name;
  24. Type = model.Type;
  25. }
  26. public override string ToString() => Name;
  27. private string DebuggerDisplay => $"{Name} ({Id}, {Type})";
  28. }
  29. }