Esempio n. 1
0
 internal RestBan(RestDiscordClient client, BanModel model, Snowflake guildId) : base(client)
 {
     GuildId = guildId;
     Guild   = new RestDownloadable <RestGuild>(options => Client.GetGuildAsync(guildId, options));
     User    = new RestUser(client, model.User);
     Reason  = model.Reason;
 }
Esempio n. 2
0
        internal RestApplication(RestDiscordClient client, ApplicationModel model) : base(client, model.Id)
        {
            Name        = model.Name;
            IconHash    = model.Icon;
            Description = model.Description;
            RpcOrigins  = RpcOrigins != null
                ? model.RpcOrigins.ToImmutableArray()
                : ImmutableArray <string> .Empty;

            IsBotPublic          = model.BotPublic;
            BotRequiresCodeGrant = model.BotRequireCodeGrant;

            if (model.Owner != null)
            {
                Owner = new RestUser(Client, model.Owner);
            }

            Summary   = model.Summary;
            VerifyKey = model.VerifyKey;

            GuildId = model.GuildId;
            Guild   = new RestDownloadable <RestGuild>(options => Client.GetGuildAsync(GuildId, options));

            PrimarySkuId   = model.PrimarySkuId;
            SlugUrl        = model.Slug;
            CoverImageHash = model.CoverImage;
        }
Esempio n. 3
0
 internal RestWebhook(RestDiscordClient client, WebhookModel model) : base(client, model.Id)
 {
     Token   = model.Token;
     GuildId = model.GuildId;
     Guild   = new RestDownloadable <RestGuild>(options => Client.GetGuildAsync(GuildId, options));
     Channel = new RestDownloadable <RestTextChannel>(async options => await client.GetChannelAsync(ChannelId, options).ConfigureAwait(false) as RestTextChannel);
 }
Esempio n. 4
0
 internal RestOverwrite(RestDiscordClient client, OverwriteModel model, Snowflake channelId) : base(client)
 {
     ChannelId   = channelId;
     Channel     = new RestDownloadable <RestGuildChannel>(options => Client.GetChannelAsync <RestGuildChannel>(channelId, options));
     TargetId    = model.Id;
     Permissions = (model.Allow, model.Deny);
     TargetType  = model.Type;
 }
Esempio n. 5
0
 internal RestGuildEmoji(RestDiscordClient client, EmojiModel model, ulong guildId) : base(client, model.Id.Value)
 {
     GuildId        = guildId;
     Guild          = new RestDownloadable <RestGuild>(options => Client.GetGuildAsync(GuildId, options));
     RequiresColons = model.RequireColons;
     IsManaged      = model.Managed;
     IsAnimated     = model.Animated;
     Update(model);
 }
Esempio n. 6
0
 internal RestMember(RestDiscordClient client, MemberModel model, Snowflake guildId) : base(client, model.User)
 {
     GuildId    = guildId;
     Guild      = new RestDownloadable <RestGuild>(options => Client.GetGuildAsync(GuildId, options));
     JoinedAt   = model.JoinedAt;
     IsMuted    = model.Mute;
     IsDeafened = model.Deaf;
     Update(model);
 }
Esempio n. 7
0
 private RestWebhookClient(ILogger logger, IJsonSerializer serializer)
 {
     Webhook = new RestDownloadable <RestWebhook>(options => _client.GetWebhookWithTokenAsync(Id, Token, options));
     _client = RestDiscordClient.CreateWithoutAuthorization(logger, serializer);
 }
Esempio n. 8
0
 internal RestWidget(RestDiscordClient client, WidgetModel model, Snowflake guildId) : base(client)
 {
     GuildId = guildId;
     Guild   = new RestDownloadable <RestGuild>(options => Client.GetGuildAsync(GuildId, options));
     Update(model);
 }
Esempio n. 9
0
 internal RestGuildChannel(RestDiscordClient client, ChannelModel model) : base(client, model)
 {
     GuildId = model.GuildId.Value;
     Guild   = new RestDownloadable <RestGuild>(options => Client.GetGuildAsync(GuildId, options));
 }
Esempio n. 10
0
 internal RestRole(RestDiscordClient client, RoleModel model, ulong guildId) : base(client, model.Id)
 {
     GuildId = guildId;
     Guild   = new RestDownloadable <RestGuild>(options => Client.GetGuildAsync(GuildId, options));
     Update(model);
 }
Esempio n. 11
0
 internal RestGuildVoiceRegion(RestDiscordClient client, VoiceRegionModel model, Snowflake guildId) : base(client, model)
 {
     GuildId = guildId;
     Guild   = new RestDownloadable <RestGuild>(options => Client.GetGuildAsync(GuildId, options));
 }