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.

DiscordSocketClient.Events.cs 1.7 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Threading.Tasks;
  3. namespace Discord.WebSocket
  4. {
  5. //TODO: Add event docstrings
  6. public partial class DiscordSocketClient
  7. {
  8. //General
  9. /// <summary>
  10. /// Fired when connected to the Discord gateway.
  11. /// </summary>
  12. public event Func<Task> Connected
  13. {
  14. add { _connectedEvent.Add(value); }
  15. remove { _connectedEvent.Remove(value); }
  16. }
  17. private readonly AsyncEvent<Func<Task>> _connectedEvent = new AsyncEvent<Func<Task>>();
  18. /// <summary>
  19. /// Fired when disconnected to the Discord gateway.
  20. /// </summary>
  21. public event Func<Exception, Task> Disconnected
  22. {
  23. add { _disconnectedEvent.Add(value); }
  24. remove { _disconnectedEvent.Remove(value); }
  25. }
  26. private readonly AsyncEvent<Func<Exception, Task>> _disconnectedEvent = new AsyncEvent<Func<Exception, Task>>();
  27. /// <summary>
  28. /// Fired when guild data has finished downloading.
  29. /// </summary>
  30. public event Func<Task> Ready
  31. {
  32. add { _readyEvent.Add(value); }
  33. remove { _readyEvent.Remove(value); }
  34. }
  35. private readonly AsyncEvent<Func<Task>> _readyEvent = new AsyncEvent<Func<Task>>();
  36. /// <summary>
  37. /// Fired when a heartbeat is received from the Discord gateway.
  38. /// </summary>
  39. public event Func<int, int, Task> LatencyUpdated
  40. {
  41. add { _latencyUpdatedEvent.Add(value); }
  42. remove { _latencyUpdatedEvent.Remove(value); }
  43. }
  44. private readonly AsyncEvent<Func<int, int, Task>> _latencyUpdatedEvent = new AsyncEvent<Func<int, int, Task>>();
  45. }
  46. }