feature: Add INVITE_CREATE and INVITE_DELETE events (#1491)

* Add invite events (create and delete)

* Removed unused using

* Fixing IInviteMetadata properties

* Add two new fields to the gateway event

* Better event summary and remarks

* Change how to assign to target variable

Co-Authored-By: Joe4evr <jii.geugten@gmail.com>

* Applying suggested changes to TargetUserType

* Renaming NotDefined to Undefined

* Fixing xml docs

* Changed the summary style format

Co-authored-by: Joe4evr <jii.geugten@gmail.com>
This commit is contained in:
Paulo
2020-11-08 17:33:37 -03:00
committed by GitHub
parent a2af9857ca
commit 1ab670b3fc
7 changed files with 305 additions and 0 deletions

View File

@@ -389,5 +389,47 @@ namespace Discord.WebSocket
remove { _recipientRemovedEvent.Remove(value); }
}
internal readonly AsyncEvent<Func<SocketGroupUser, Task>> _recipientRemovedEvent = new AsyncEvent<Func<SocketGroupUser, Task>>();
//Invites
/// <summary>
/// Fired when an invite is created.
/// </summary>
/// <remarks>
/// <para>
/// This event is fired when an invite is created. The event handler must return a
/// <see cref="Task"/> and accept a <see cref="SocketInvite"/> as its parameter.
/// </para>
/// <para>
/// The invite created will be passed into the <see cref="SocketInvite"/> parameter.
/// </para>
/// </remarks>
public event Func<SocketInvite, Task> InviteCreated
{
add { _inviteCreatedEvent.Add(value); }
remove { _inviteCreatedEvent.Remove(value); }
}
internal readonly AsyncEvent<Func<SocketInvite, Task>> _inviteCreatedEvent = new AsyncEvent<Func<SocketInvite, Task>>();
/// <summary>
/// Fired when an invite is deleted.
/// </summary>
/// <remarks>
/// <para>
/// This event is fired when an invite is deleted. The event handler must return
/// a <see cref="Task"/> and accept a <see cref="SocketGuildChannel"/> and
/// <see cref="string"/> as its parameter.
/// </para>
/// <para>
/// The channel where this invite was created will be passed into the <see cref="SocketGuildChannel"/> parameter.
/// </para>
/// <para>
/// The code of the deleted invite will be passed into the <see cref="string"/> parameter.
/// </para>
/// </remarks>
public event Func<SocketGuildChannel, string, Task> InviteDeleted
{
add { _inviteDeletedEvent.Add(value); }
remove { _inviteDeletedEvent.Remove(value); }
}
internal readonly AsyncEvent<Func<SocketGuildChannel, string, Task>> _inviteDeletedEvent = new AsyncEvent<Func<SocketGuildChannel, string, Task>>();
}
}