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.

DiscordRpcClient.Events.cs 4.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. using System;
  2. using System.Threading.Tasks;
  3. namespace Discord.Rpc
  4. {
  5. public partial class DiscordRpcClient
  6. {
  7. //General
  8. public event Func<Task> Connected
  9. {
  10. add { _connectedEvent.Add(value); }
  11. remove { _connectedEvent.Remove(value); }
  12. }
  13. private readonly AsyncEvent<Func<Task>> _connectedEvent = new AsyncEvent<Func<Task>>();
  14. public event Func<Exception, Task> Disconnected
  15. {
  16. add { _disconnectedEvent.Add(value); }
  17. remove { _disconnectedEvent.Remove(value); }
  18. }
  19. private readonly AsyncEvent<Func<Exception, Task>> _disconnectedEvent = new AsyncEvent<Func<Exception, Task>>();
  20. public event Func<Task> Ready
  21. {
  22. add { _readyEvent.Add(value); }
  23. remove { _readyEvent.Remove(value); }
  24. }
  25. private readonly AsyncEvent<Func<Task>> _readyEvent = new AsyncEvent<Func<Task>>();
  26. //Channel
  27. public event Func<RpcChannelSummary, Task> ChannelCreated
  28. {
  29. add { _channelCreatedEvent.Add(value); }
  30. remove { _channelCreatedEvent.Remove(value); }
  31. }
  32. private readonly AsyncEvent<Func<RpcChannelSummary, Task>> _channelCreatedEvent = new AsyncEvent<Func<RpcChannelSummary, Task>>();
  33. //Guild
  34. public event Func<RpcGuildSummary, Task> GuildCreated
  35. {
  36. add { _guildCreatedEvent.Add(value); }
  37. remove { _guildCreatedEvent.Remove(value); }
  38. }
  39. private readonly AsyncEvent<Func<RpcGuildSummary, Task>> _guildCreatedEvent = new AsyncEvent<Func<RpcGuildSummary, Task>>();
  40. public event Func<RpcGuildStatus, Task> GuildStatusUpdated
  41. {
  42. add { _guildStatusUpdatedEvent.Add(value); }
  43. remove { _guildStatusUpdatedEvent.Remove(value); }
  44. }
  45. private readonly AsyncEvent<Func<RpcGuildStatus, Task>> _guildStatusUpdatedEvent = new AsyncEvent<Func<RpcGuildStatus, Task>>();
  46. //Voice
  47. public event Func<RpcVoiceState, Task> VoiceStateCreated
  48. {
  49. add { _voiceStateCreatedEvent.Add(value); }
  50. remove { _voiceStateCreatedEvent.Remove(value); }
  51. }
  52. private readonly AsyncEvent<Func<RpcVoiceState, Task>> _voiceStateCreatedEvent = new AsyncEvent<Func<RpcVoiceState, Task>>();
  53. public event Func<RpcVoiceState, Task> VoiceStateUpdated
  54. {
  55. add { _voiceStateUpdatedEvent.Add(value); }
  56. remove { _voiceStateUpdatedEvent.Remove(value); }
  57. }
  58. private readonly AsyncEvent<Func<RpcVoiceState, Task>> _voiceStateUpdatedEvent = new AsyncEvent<Func<RpcVoiceState, Task>>();
  59. public event Func<RpcVoiceState, Task> VoiceStateDeleted
  60. {
  61. add { _voiceStateDeletedEvent.Add(value); }
  62. remove { _voiceStateDeletedEvent.Remove(value); }
  63. }
  64. private readonly AsyncEvent<Func<RpcVoiceState, Task>> _voiceStateDeletedEvent = new AsyncEvent<Func<RpcVoiceState, Task>>();
  65. public event Func<ulong, Task> SpeakingStarted
  66. {
  67. add { _speakingStartedEvent.Add(value); }
  68. remove { _speakingStartedEvent.Remove(value); }
  69. }
  70. private readonly AsyncEvent<Func<ulong, Task>> _speakingStartedEvent = new AsyncEvent<Func<ulong, Task>>();
  71. public event Func<ulong, Task> SpeakingStopped
  72. {
  73. add { _speakingStoppedEvent.Add(value); }
  74. remove { _speakingStoppedEvent.Remove(value); }
  75. }
  76. private readonly AsyncEvent<Func<ulong, Task>> _speakingStoppedEvent = new AsyncEvent<Func<ulong, Task>>();
  77. public event Func<VoiceSettings, Task> VoiceSettingsUpdated
  78. {
  79. add { _voiceSettingsUpdated.Add(value); }
  80. remove { _voiceSettingsUpdated.Remove(value); }
  81. }
  82. private readonly AsyncEvent<Func<VoiceSettings, Task>> _voiceSettingsUpdated = new AsyncEvent<Func<VoiceSettings, Task>>();
  83. //Messages
  84. public event Func<RpcMessage, Task> MessageReceived
  85. {
  86. add { _messageReceivedEvent.Add(value); }
  87. remove { _messageReceivedEvent.Remove(value); }
  88. }
  89. private readonly AsyncEvent<Func<RpcMessage, Task>> _messageReceivedEvent = new AsyncEvent<Func<RpcMessage, Task>>();
  90. public event Func<RpcMessage, Task> MessageUpdated
  91. {
  92. add { _messageUpdatedEvent.Add(value); }
  93. remove { _messageUpdatedEvent.Remove(value); }
  94. }
  95. private readonly AsyncEvent<Func<RpcMessage, Task>> _messageUpdatedEvent = new AsyncEvent<Func<RpcMessage, Task>>();
  96. public event Func<ulong, ulong, Task> MessageDeleted
  97. {
  98. add { _messageDeletedEvent.Add(value); }
  99. remove { _messageDeletedEvent.Remove(value); }
  100. }
  101. private readonly AsyncEvent<Func<ulong, ulong, Task>> _messageDeletedEvent = new AsyncEvent<Func<ulong, ulong, Task>>();
  102. }
  103. }