Browse Source

Add documentation for new API version & few events

pull/1161/head
Still Hsu 7 years ago
parent
commit
17a4af71ee
No known key found for this signature in database GPG Key ID: 8601A145FDA95209
2 changed files with 34 additions and 7 deletions
  1. +8
    -1
      src/Discord.Net.Core/DiscordConfig.cs
  2. +26
    -6
      src/Discord.Net.WebSocket/BaseSocketClient.Events.cs

+ 8
- 1
src/Discord.Net.Core/DiscordConfig.cs View File

@@ -11,12 +11,19 @@ namespace Discord
/// Returns the API version Discord.Net uses. /// Returns the API version Discord.Net uses.
/// </summary> /// </summary>
/// <returns> /// <returns>
/// A 32-bit integer representing the API version that Discord.Net uses to communicate with Discord.
/// An <see cref="int"/> representing the API version that Discord.Net uses to communicate with Discord.
/// <para>A list of available API version can be seen on the official /// <para>A list of available API version can be seen on the official
/// <see href="https://discordapp.com/developers/docs/reference#api-versioning">Discord API documentation</see> /// <see href="https://discordapp.com/developers/docs/reference#api-versioning">Discord API documentation</see>
/// .</para> /// .</para>
/// </returns> /// </returns>
public const int APIVersion = 6; public const int APIVersion = 6;
/// <summary>
/// Returns the Voice API version Discord.Net uses.
/// </summary>
/// <returns>
/// An <see cref="int"/> representing the API version that Discord.Net uses to communicate with Discord's
/// voice server.
/// </returns>
public const int VoiceAPIVersion = 3; public const int VoiceAPIVersion = 3;
/// <summary> /// <summary>
/// Gets the Discord.Net version, including the build number. /// Gets the Discord.Net version, including the build number.


+ 26
- 6
src/Discord.Net.WebSocket/BaseSocketClient.Events.cs View File

@@ -10,7 +10,7 @@ namespace Discord.WebSocket
/// <remarks> /// <remarks>
/// <para> /// <para>
/// This event is fired when a generic channel has been created. The event handler must return a /// This event is fired when a generic channel has been created. The event handler must return a
/// <see cref="Task"/>.
/// <see cref="Task"/> and accept a <see cref="SocketChannel"/> as its parameter.
/// </para> /// </para>
/// <para> /// <para>
/// The newly created channel is passed into the event handler parameter. The given channel type may /// The newly created channel is passed into the event handler parameter. The given channel type may
@@ -28,7 +28,7 @@ namespace Discord.WebSocket
/// <remarks> /// <remarks>
/// <para> /// <para>
/// This event is fired when a generic channel has been destroyed. The event handler must return a /// This event is fired when a generic channel has been destroyed. The event handler must return a
/// <see cref="Task"/>.
/// <see cref="Task"/> and accept a <see cref="SocketChannel"/> as its parameter.
/// </para> /// </para>
/// <para> /// <para>
/// The destroyed channel is passed into the event handler parameter. The given channel type may /// The destroyed channel is passed into the event handler parameter. The given channel type may
@@ -45,7 +45,7 @@ namespace Discord.WebSocket
/// <remarks> /// <remarks>
/// <para> /// <para>
/// This event is fired when a generic channel has been destroyed. The event handler must return a /// This event is fired when a generic channel has been destroyed. The event handler must return a
/// <see cref="Task"/>.
/// <see cref="Task"/> and accept 2 <see cref="SocketChannel"/> as its parameters.
/// </para> /// </para>
/// <para> /// <para>
/// The original (prior to update) channel is passed into the first <see cref="SocketChannel"/>, while /// The original (prior to update) channel is passed into the first <see cref="SocketChannel"/>, while
@@ -65,13 +65,13 @@ namespace Discord.WebSocket
/// <remarks> /// <remarks>
/// <para> /// <para>
/// This event is fired when a message is received. The event handler must return a /// This event is fired when a message is received. The event handler must return a
/// <see cref="Task"/>.
/// <see cref="Task"/> and accept a <see cref="SocketMessage"/> as its parameter.
/// </para> /// </para>
/// <para> /// <para>
/// The message that is sent to the client is passed into the event handler parameter as /// The message that is sent to the client is passed into the event handler parameter as
/// <see cref="SocketMessage"/>. This message may be a system message (i.e. /// <see cref="SocketMessage"/>. This message may be a system message (i.e.
/// <see cref="SocketSystemMessage"/>) or a user message (i.e. <see cref="SocketUserMessage"/>. See
/// the derived clsases of <see cref="SocketMessage"/> for more details.
/// <see cref="SocketSystemMessage"/>) or a user message (i.e. <see cref="SocketUserMessage"/>. See the
/// derived clsases of <see cref="SocketMessage"/> for more details.
/// </para> /// </para>
/// </remarks> /// </remarks>
public event Func<SocketMessage, Task> MessageReceived { public event Func<SocketMessage, Task> MessageReceived {
@@ -108,6 +108,26 @@ namespace Discord.WebSocket
} }
internal readonly AsyncEvent<Func<Cacheable<IMessage, ulong>, ISocketMessageChannel, Task>> _messageDeletedEvent = new AsyncEvent<Func<Cacheable<IMessage, ulong>, ISocketMessageChannel, Task>>(); internal readonly AsyncEvent<Func<Cacheable<IMessage, ulong>, ISocketMessageChannel, Task>> _messageDeletedEvent = new AsyncEvent<Func<Cacheable<IMessage, ulong>, ISocketMessageChannel, Task>>();
/// <summary> Fired when a message is updated. </summary> /// <summary> Fired when a message is updated. </summary>
/// <remarks>
/// <para>
/// This event is fired when a message is updated. The event handler must return a
/// <see cref="Task"/> and accept a <see cref="Cacheable{TEntity,TId}"/>, <see cref="SocketMessage"/>,
/// and <see cref="ISocketMessageChannel"/> as its parameters.
/// </para>
/// <para>
/// If caching is enabled via <see cref="DiscordSocketConfig"/>, the
/// <see cref="Cacheable{TEntity,TId}"/> entity will contain the original message; otherwise, in event
/// that the message cannot be retrieved, the snowflake ID of the message is preserved in the
/// <see cref="ulong"/>.
/// </para>
/// <para>
/// The updated message will be passed into the <see cref="SocketMessage"/> parameter.
/// </para>
/// <para>
/// The source channel of the updated message will be passed into the
/// <see cref="ISocketMessageChannel"/> parameter.
/// </para>
/// </remarks>
public event Func<Cacheable<IMessage, ulong>, SocketMessage, ISocketMessageChannel, Task> MessageUpdated { public event Func<Cacheable<IMessage, ulong>, SocketMessage, ISocketMessageChannel, Task> MessageUpdated {
add { _messageUpdatedEvent.Add(value); } add { _messageUpdatedEvent.Add(value); }
remove { _messageUpdatedEvent.Remove(value); } remove { _messageUpdatedEvent.Remove(value); }


Loading…
Cancel
Save