public static async Task <IInvite> FetchInviteAsync(this IRestClient client,
                                                            string code, bool?withCounts = null, bool?withExpiration = null,
                                                            IRestRequestOptions options  = null, CancellationToken cancellationToken = default)
        {
            var model = await client.ApiClient.FetchInviteAsync(code, withCounts, withExpiration, options, cancellationToken).ConfigureAwait(false);

            return(TransientInvite.Create(client, model));
        }
Esempio n. 2
0
        public override ValueTask <InviteCreatedEventArgs> HandleDispatchAsync(IGatewayApiClient shard, InviteCreateJsonModel model)
        {
            var invite = new TransientInvite(Client, new InviteJsonModel
            {
                Code      = model.Code,
                Inviter   = model.Inviter,
                MaxUses   = model.MaxUses,
                MaxAge    = model.MaxAge,
                Temporary = model.Temporary,
                CreatedAt = model.CreatedAt,
                Channel   = new ChannelJsonModel
                {
                    Id = model.ChannelId
                }
            });
            var e = new InviteCreatedEventArgs(model.GuildId, invite);

            return(new(e));
        }