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.

RpcSystemMessage.cs 1.1 KiB

123456789101112131415161718192021222324252627282930313233
  1. using Discord.Rest;
  2. using System.Diagnostics;
  3. using Model = Discord.API.Rpc.Message;
  4. namespace Discord.Rpc
  5. {
  6. [DebuggerDisplay(@"{DebuggerDisplay,nq}")]
  7. public class RpcSystemMessage : RpcMessage, ISystemMessage
  8. {
  9. public MessageType Type { get; private set; }
  10. internal RpcSystemMessage(DiscordRpcClient discord, ulong id, RestVirtualMessageChannel channel, RpcUser author)
  11. : base(discord, id, channel, author, MessageSource.System)
  12. {
  13. }
  14. internal new static RpcSystemMessage Create(DiscordRpcClient discord, ulong channelId, Model model)
  15. {
  16. var entity = new RpcSystemMessage(discord, model.Id,
  17. RestVirtualMessageChannel.Create(discord, channelId),
  18. RpcUser.Create(discord, model.Author.Value, model.WebhookId.ToNullable()));
  19. entity.Update(model);
  20. return entity;
  21. }
  22. internal override void Update(Model model)
  23. {
  24. base.Update(model);
  25. Type = model.Type;
  26. }
  27. private string DebuggerDisplay => $"{Author}: {Content} ({Id}, {Type})";
  28. }
  29. }