|
@@ -18,6 +18,9 @@ namespace Discord.WebSocket |
|
|
/// see the derived classes of <see cref="SocketChannel"/> for more details. |
|
|
/// see the derived classes of <see cref="SocketChannel"/> for more details. |
|
|
/// </para> |
|
|
/// </para> |
|
|
/// </remarks> |
|
|
/// </remarks> |
|
|
|
|
|
/// <example> |
|
|
|
|
|
/// <code source="..\Discord.Net.Examples\WebSocket\BaseSocketClient.Events.Examples.cs" region="ChannelCreated"></code> |
|
|
|
|
|
/// </example> |
|
|
public event Func<SocketChannel, Task> ChannelCreated |
|
|
public event Func<SocketChannel, Task> ChannelCreated |
|
|
{ |
|
|
{ |
|
|
add { _channelCreatedEvent.Add(value); } |
|
|
add { _channelCreatedEvent.Add(value); } |
|
@@ -36,6 +39,9 @@ namespace Discord.WebSocket |
|
|
/// see the derived classes of <see cref="SocketChannel"/> for more details. |
|
|
/// see the derived classes of <see cref="SocketChannel"/> for more details. |
|
|
/// </para> |
|
|
/// </para> |
|
|
/// </remarks> |
|
|
/// </remarks> |
|
|
|
|
|
/// <example> |
|
|
|
|
|
/// <code source="..\Discord.Net.Examples\WebSocket\BaseSocketClient.Events.Examples.cs" region="ChannelDestroyed"></code> |
|
|
|
|
|
/// </example> |
|
|
public event Func<SocketChannel, Task> ChannelDestroyed { |
|
|
public event Func<SocketChannel, Task> ChannelDestroyed { |
|
|
add { _channelDestroyedEvent.Add(value); } |
|
|
add { _channelDestroyedEvent.Add(value); } |
|
|
remove { _channelDestroyedEvent.Remove(value); } |
|
|
remove { _channelDestroyedEvent.Remove(value); } |
|
@@ -54,6 +60,9 @@ namespace Discord.WebSocket |
|
|
/// <see cref="SocketChannel"/> for more details. |
|
|
/// <see cref="SocketChannel"/> for more details. |
|
|
/// </para> |
|
|
/// </para> |
|
|
/// </remarks> |
|
|
/// </remarks> |
|
|
|
|
|
/// <example> |
|
|
|
|
|
/// <code source="..\Discord.Net.Examples\WebSocket\BaseSocketClient.Events.Examples.cs" region="ChannelUpdated"></code> |
|
|
|
|
|
/// </example> |
|
|
public event Func<SocketChannel, SocketChannel, Task> ChannelUpdated { |
|
|
public event Func<SocketChannel, SocketChannel, Task> ChannelUpdated { |
|
|
add { _channelUpdatedEvent.Add(value); } |
|
|
add { _channelUpdatedEvent.Add(value); } |
|
|
remove { _channelUpdatedEvent.Remove(value); } |
|
|
remove { _channelUpdatedEvent.Remove(value); } |
|
@@ -74,6 +83,10 @@ namespace Discord.WebSocket |
|
|
/// derived classes of <see cref="SocketMessage"/> for more details. |
|
|
/// derived classes of <see cref="SocketMessage"/> for more details. |
|
|
/// </para> |
|
|
/// </para> |
|
|
/// </remarks> |
|
|
/// </remarks> |
|
|
|
|
|
/// <example> |
|
|
|
|
|
/// The example below checks if the newly received message contains the target user. |
|
|
|
|
|
/// <code source="..\Discord.Net.Examples\WebSocket\BaseSocketClient.Events.Examples.cs" region="MessageReceived"></code> |
|
|
|
|
|
/// </example> |
|
|
public event Func<SocketMessage, Task> MessageReceived { |
|
|
public event Func<SocketMessage, Task> MessageReceived { |
|
|
add { _messageReceivedEvent.Add(value); } |
|
|
add { _messageReceivedEvent.Add(value); } |
|
|
remove { _messageReceivedEvent.Remove(value); } |
|
|
remove { _messageReceivedEvent.Remove(value); } |
|
@@ -102,6 +115,9 @@ namespace Discord.WebSocket |
|
|
/// <see cref="ISocketMessageChannel"/> parameter. |
|
|
/// <see cref="ISocketMessageChannel"/> parameter. |
|
|
/// </para> |
|
|
/// </para> |
|
|
/// </remarks> |
|
|
/// </remarks> |
|
|
|
|
|
/// <example> |
|
|
|
|
|
/// <code source="..\Discord.Net.Examples\WebSocket\BaseSocketClient.Events.Examples.cs" region="MessageDeleted"></code> |
|
|
|
|
|
/// </example> |
|
|
public event Func<Cacheable<IMessage, ulong>, ISocketMessageChannel, Task> MessageDeleted { |
|
|
public event Func<Cacheable<IMessage, ulong>, ISocketMessageChannel, Task> MessageDeleted { |
|
|
add { _messageDeletedEvent.Add(value); } |
|
|
add { _messageDeletedEvent.Add(value); } |
|
|
remove { _messageDeletedEvent.Remove(value); } |
|
|
remove { _messageDeletedEvent.Remove(value); } |
|
@@ -134,6 +150,34 @@ namespace Discord.WebSocket |
|
|
} |
|
|
} |
|
|
internal readonly AsyncEvent<Func<Cacheable<IMessage, ulong>, SocketMessage, ISocketMessageChannel, Task>> _messageUpdatedEvent = new AsyncEvent<Func<Cacheable<IMessage, ulong>, SocketMessage, ISocketMessageChannel, Task>>(); |
|
|
internal readonly AsyncEvent<Func<Cacheable<IMessage, ulong>, SocketMessage, ISocketMessageChannel, Task>> _messageUpdatedEvent = new AsyncEvent<Func<Cacheable<IMessage, ulong>, SocketMessage, ISocketMessageChannel, Task>>(); |
|
|
/// <summary> Fired when a reaction is added to a message. </summary> |
|
|
/// <summary> Fired when a reaction is added to a message. </summary> |
|
|
|
|
|
/// <remarks> |
|
|
|
|
|
/// <para> |
|
|
|
|
|
/// This event is fired when a reaction is added to a user message. The event handler must return a |
|
|
|
|
|
/// <see cref="Task"/> and accept a <see cref="Cacheable{TEntity,TId}"/>, an |
|
|
|
|
|
/// <see cref="ISocketMessageChannel"/>, and a <see cref="SocketReaction"/> as its parameter. |
|
|
|
|
|
/// </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 source channel of the reaction addition will be passed into the |
|
|
|
|
|
/// <see cref="ISocketMessageChannel"/> parameter. |
|
|
|
|
|
/// </para> |
|
|
|
|
|
/// <para> |
|
|
|
|
|
/// The reaction that was added will be passed into the <see cref="SocketReaction"/> parameter. |
|
|
|
|
|
/// </para> |
|
|
|
|
|
/// <note> |
|
|
|
|
|
/// When fetching the reaction from this event, a user may not be provided under |
|
|
|
|
|
/// <see cref="SocketReaction.User"/>. Please see the documentation of the property for more |
|
|
|
|
|
/// information. |
|
|
|
|
|
/// </note> |
|
|
|
|
|
/// </remarks> |
|
|
|
|
|
/// <example> |
|
|
|
|
|
/// <code source="..\Discord.Net.Examples\WebSocket\BaseSocketClient.Events.Examples.cs" region="ReactionAdded"></code> |
|
|
|
|
|
/// </example> |
|
|
public event Func<Cacheable<IUserMessage, ulong>, ISocketMessageChannel, SocketReaction, Task> ReactionAdded { |
|
|
public event Func<Cacheable<IUserMessage, ulong>, ISocketMessageChannel, SocketReaction, Task> ReactionAdded { |
|
|
add { _reactionAddedEvent.Add(value); } |
|
|
add { _reactionAddedEvent.Add(value); } |
|
|
remove { _reactionAddedEvent.Remove(value); } |
|
|
remove { _reactionAddedEvent.Remove(value); } |
|
|