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.

DiscordShardedClient.Events.cs 1.9 KiB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Threading.Tasks;
  3. namespace Discord.WebSocket
  4. {
  5. public partial class DiscordShardedClient
  6. {
  7. //General
  8. /// <summary> Fired when a shard is connected to the Discord gateway. </summary>
  9. public event Func<DiscordSocketClient, Task> ShardConnected
  10. {
  11. add { _shardConnectedEvent.Add(value); }
  12. remove { _shardConnectedEvent.Remove(value); }
  13. }
  14. private readonly AsyncEvent<Func<DiscordSocketClient, Task>> _shardConnectedEvent = new AsyncEvent<Func<DiscordSocketClient, Task>>();
  15. /// <summary> Fired when a shard is disconnected from the Discord gateway. </summary>
  16. public event Func<Exception, DiscordSocketClient, Task> ShardDisconnected
  17. {
  18. add { _shardDisconnectedEvent.Add(value); }
  19. remove { _shardDisconnectedEvent.Remove(value); }
  20. }
  21. private readonly AsyncEvent<Func<Exception, DiscordSocketClient, Task>> _shardDisconnectedEvent = new AsyncEvent<Func<Exception, DiscordSocketClient, Task>>();
  22. /// <summary> Fired when a guild data for a shard has finished downloading. </summary>
  23. public event Func<DiscordSocketClient, Task> ShardReady
  24. {
  25. add { _shardReadyEvent.Add(value); }
  26. remove { _shardReadyEvent.Remove(value); }
  27. }
  28. private readonly AsyncEvent<Func<DiscordSocketClient, Task>> _shardReadyEvent = new AsyncEvent<Func<DiscordSocketClient, Task>>();
  29. /// <summary> Fired when a shard receives a heartbeat from the Discord gateway. </summary>
  30. public event Func<int, int, DiscordSocketClient, Task> ShardLatencyUpdated
  31. {
  32. add { _shardLatencyUpdatedEvent.Add(value); }
  33. remove { _shardLatencyUpdatedEvent.Remove(value); }
  34. }
  35. private readonly AsyncEvent<Func<int, int, DiscordSocketClient, Task>> _shardLatencyUpdatedEvent = new AsyncEvent<Func<int, int, DiscordSocketClient, Task>>();
  36. }
  37. }