public TransientGuildEventAuditLogData(IClient client, AuditLogEntryJsonModel model, bool isCreated) { var changes = new TransientGuildEventAuditLogChanges(client, model); if (isCreated) { ChannelId = changes.ChannelId.NewValue; Name = changes.Name.NewValue; Description = changes.Description.NewValue; TargetType = changes.TargetType.NewValue; Location = changes.Location.NewValue; PrivacyLevel = changes.PrivacyLevel.NewValue; Status = changes.Status.NewValue; } else { ChannelId = changes.ChannelId.OldValue; Name = changes.Name.OldValue; Description = changes.Description.OldValue; TargetType = changes.TargetType.OldValue; Location = changes.Location.OldValue; PrivacyLevel = changes.PrivacyLevel.OldValue; Status = changes.Status.OldValue; } }
public TransientInviteAuditLogData(IClient client, AuditLogEntryJsonModel model, bool isCreated) { var changes = new TransientInviteAuditLogChanges(client, model); if (isCreated) { Code = changes.Code.NewValue; ChannelId = changes.ChannelId.NewValue; InviterId = changes.InviterId.NewValue; MaxUses = changes.MaxUses.NewValue; Uses = changes.Uses.NewValue; IsTemporary = changes.IsTemporary.NewValue; MaxAge = changes.MaxAge.NewValue; } else { Code = changes.Code.OldValue; ChannelId = changes.ChannelId.OldValue; InviterId = changes.InviterId.OldValue; MaxUses = changes.MaxUses.OldValue; Uses = changes.Uses.OldValue; IsTemporary = changes.IsTemporary.OldValue; MaxAge = changes.MaxAge.OldValue; } }
public TransientRoleAuditLogData(IClient client, AuditLogEntryJsonModel model, bool isCreated) { var changes = new TransientRoleAuditLogChanges(client, model); if (isCreated) { Name = changes.Name.NewValue; Permissions = changes.Permissions.NewValue; Color = changes.Color.NewValue; IsHoisted = changes.IsHoisted.NewValue; IconHash = changes.IconHash.NewValue; IsMentionable = changes.IsMentionable.NewValue; UnicodeEmoji = changes.UnicodeEmoji.NewValue; } else { Name = changes.Name.OldValue; Permissions = changes.Permissions.OldValue; Color = changes.Color.OldValue; IsHoisted = changes.IsHoisted.OldValue; IconHash = changes.IconHash.OldValue; IsMentionable = changes.IsMentionable.OldValue; UnicodeEmoji = changes.UnicodeEmoji.OldValue; } }
public TransientStageAuditLogChanges(IClient client, AuditLogEntryJsonModel model) { for (var i = 0; i < model.Changes.Value.Length; i++) { var change = model.Changes.Value[i]; switch (change.Key) { case "topic": { Topic = AuditLogChange <string> .Convert(change); break; } case "privacy_level": { PrivacyLevel = AuditLogChange <PrivacyLevel> .Convert(change); break; } default: { client.Logger.LogDebug("Unknown key {0} for {1}", change.Key, this); break; } } } }
public TransientChannelAuditLogData(IClient client, AuditLogEntryJsonModel model, bool isCreated) { var changes = new TransientChannelAuditLogChanges(client, model); if (isCreated) { Name = changes.Name.NewValue; Topic = changes.Topic.NewValue; Bitrate = changes.Bitrate.NewValue; Overwrites = changes.Overwrites.NewValue; IsNsfw = changes.IsNsfw.NewValue; Slowmode = changes.Slowmode.NewValue; Type = changes.Type.NewValue; Region = changes.Region.NewValue; } else { Name = changes.Name.OldValue; Topic = changes.Topic.OldValue; Bitrate = changes.Bitrate.OldValue; Overwrites = changes.Overwrites.OldValue; IsNsfw = changes.IsNsfw.OldValue; Slowmode = changes.Slowmode.OldValue; Type = changes.Type.OldValue; Region = changes.Region.OldValue; } }
public TransientThreadAuditLogChanges(IClient client, AuditLogEntryJsonModel model) { for (var i = 0; i < model.Changes.Value.Length; i++) { var change = model.Changes.Value[i]; switch (change.Key) { case "name": { Name = AuditLogChange <string> .Convert(change); break; } case "archived": { IsArchived = AuditLogChange <bool> .Convert(change); break; } case "locked": { IsLocked = AuditLogChange <bool> .Convert(change); break; } case "auto_archive_duration": { AutomaticArchiveDuration = AuditLogChange <TimeSpan> .Convert <int>(change, x => TimeSpan.FromMinutes(x)); break; } case "rate_limit_per_user": { Slowmode = AuditLogChange <TimeSpan> .Convert <int>(change, x => TimeSpan.FromSeconds(x)); break; } case "type": { Type = AuditLogChange <ChannelType> .Convert(change); break; } default: { client.Logger.LogDebug("Unknown key {0} for {1}", change.Key, this); break; } } } }
public TransientStickerAuditLogChanges(IClient client, AuditLogEntryJsonModel model) { for (var i = 0; i < model.Changes.Value.Length; i++) { var change = model.Changes.Value[i]; switch (change.Key) { case "name": { Name = AuditLogChange <string> .Convert(change); break; } case "description": { Description = AuditLogChange <string> .Convert(change); break; } case "tags": { Tags = AuditLogChange <string> .Convert(change); break; } case "format_type": { FormatType = AuditLogChange <StickerFormatType> .Convert(change); break; } case "available": { IsAvailable = AuditLogChange <bool> .Convert(change); break; } case "guild_id": { GuildId = AuditLogChange <Snowflake> .Convert(change); break; } default: { client.Logger.LogDebug("Unknown key {0} for {1}", change.Key, this); break; } } } }
public TransientEmojiAuditLogData(IClient client, AuditLogEntryJsonModel model, bool isCreated) { var changes = new TransientEmojiAuditLogChanges(client, model); if (isCreated) { Name = changes.Name.NewValue; } else { Name = changes.Name.OldValue; } }
public TransientWebhookAuditLogChanges(IClient client, AuditLogEntryJsonModel model) { for (var i = 0; i < model.Changes.Value.Length; i++) { var change = model.Changes.Value[i]; switch (change.Key) { case "name": { Name = AuditLogChange <string> .Convert(change); break; } case "type": { Type = AuditLogChange <WebhookType> .Convert(change); break; } case "avatar_hash": { AvatarHash = AuditLogChange <string> .Convert(change); break; } case "channel_id": { ChannelId = AuditLogChange <Snowflake> .Convert(change); break; } case "application_id": { ApplicationId = AuditLogChange <Snowflake?> .Convert(change); break; } default: { client.Logger.LogDebug("Unknown key {0} for {1}", change.Key, this); break; } } } }
public TransientRoleAuditLogChanges(IClient client, AuditLogEntryJsonModel model) { for (var i = 0; i < model.Changes.Value.Length; i++) { var change = model.Changes.Value[i]; switch (change.Key) { case "name": { Name = AuditLogChange <string> .Convert(change); break; } case "permissions": { Permissions = AuditLogChange <GuildPermissions> .Convert <ulong>(change, x => x); break; } case "color": { Color = AuditLogChange <Color?> .Convert <int>(change, x => x != 0?x : null); break; } case "hoist": { IsHoisted = AuditLogChange <bool> .Convert(change); break; } case "mentionable": { IsMentionable = AuditLogChange <bool> .Convert(change); break; } default: { client.Logger.LogDebug("Unknown key {0} for {1}", change.Key, this); break; } } } }
public TransientStageAuditLogData(IClient client, AuditLogEntryJsonModel model, bool isCreated) { var changes = new TransientStageAuditLogChanges(client, model); if (isCreated) { Topic = changes.Topic.NewValue; PrivacyLevel = changes.PrivacyLevel.NewValue; } else { Topic = changes.Topic.OldValue; PrivacyLevel = changes.PrivacyLevel.OldValue; } }
public TransientIntegrationAuditLogData(IClient client, AuditLogEntryJsonModel model, bool isCreated) { var changes = new TransientIntegrationAuditLogChanges(client, model); if (isCreated) { EnablesEmojis = changes.EnablesEmojis.NewValue; ExpireBehavior = changes.ExpireBehavior.NewValue; ExpireGracePeriod = changes.ExpireGracePeriod.NewValue; } else { EnablesEmojis = changes.EnablesEmojis.OldValue; ExpireBehavior = changes.ExpireBehavior.OldValue; ExpireGracePeriod = changes.ExpireGracePeriod.OldValue; } }
public TransientOverwriteAuditLogData(IClient client, AuditLogEntryJsonModel model, bool isCreated) { var changes = new TransientOverwriteAuditLogChanges(client, model); if (isCreated) { TargetId = changes.TargetId.NewValue; TargetType = changes.TargetType.NewValue; Allowed = changes.Allowed.NewValue; Denied = changes.Denied.NewValue; } else { TargetId = changes.TargetId.OldValue; TargetType = changes.TargetType.OldValue; Allowed = changes.Allowed.OldValue; Denied = changes.Denied.OldValue; } }
public TransientMemberAuditLogChanges(IClient client, AuditLogEntryJsonModel model) { for (var i = 0; i < model.Changes.Value.Length; i++) { var change = model.Changes.Value[i]; switch (change.Key) { case "nick": { Nick = AuditLogChange <string> .Convert(change); break; } case "mute": { IsMuted = AuditLogChange <bool> .Convert(change); break; } case "deaf": { IsDeafened = AuditLogChange <bool> .Convert(change); break; } case "communication_disabled_until": { TimedOutUntil = AuditLogChange <DateTimeOffset> .Convert(change); break; } default: { client.Logger.LogDebug("Unknown key {0} for {1}", change.Key, this); break; } } } }
public TransientOverwriteAuditLogChanges(IClient client, AuditLogEntryJsonModel model) { for (var i = 0; i < model.Changes.Value.Length; i++) { var change = model.Changes.Value[i]; switch (change.Key) { case "id": { TargetId = AuditLogChange <Snowflake> .Convert(change); break; } case "type": { TargetType = AuditLogChange <OverwriteTargetType> .Convert(change); break; } case "allow": { Allowed = AuditLogChange <ChannelPermissions> .Convert <ulong>(change, x => x); break; } case "deny": { Denied = AuditLogChange <ChannelPermissions> .Convert <ulong>(change, x => x); break; } default: { client.Logger.LogDebug("Unknown key {0} for {1}", change.Key, this); break; } } } }
public TransientWebhookAuditLogData(IClient client, AuditLogEntryJsonModel model, bool isCreated) { var changes = new TransientWebhookAuditLogChanges(client, model); if (isCreated) { Name = changes.Name.NewValue; Type = changes.Type.NewValue; AvatarHash = changes.AvatarHash.NewValue; ChannelId = changes.ChannelId.NewValue; ApplicationId = changes.ApplicationId.NewValue; } else { Name = changes.Name.OldValue; Type = changes.Type.OldValue; AvatarHash = changes.AvatarHash.OldValue; ChannelId = changes.ChannelId.OldValue; ApplicationId = changes.ApplicationId.OldValue; } }
public TransientEmojiAuditLogChanges(IClient client, AuditLogEntryJsonModel model) { for (var i = 0; i < model.Changes.Value.Length; i++) { var change = model.Changes.Value[i]; switch (change.Key) { case "name": { Name = AuditLogChange <string> .Convert(change); break; } default: { client.Logger.LogDebug("Unknown key {0} for {1}", change.Key, this); break; } } } }
public TransientThreadAuditLogData(IClient client, AuditLogEntryJsonModel model, bool isCreated) { var changes = new TransientThreadAuditLogChanges(client, model); if (isCreated) { Name = changes.Name.NewValue; IsArchived = changes.IsArchived.NewValue; IsLocked = changes.IsLocked.NewValue; AutomaticArchiveDuration = changes.AutomaticArchiveDuration.NewValue; Slowmode = changes.Slowmode.NewValue; Type = changes.Type.NewValue; } else { Name = changes.Name.OldValue; IsArchived = changes.IsArchived.OldValue; IsLocked = changes.IsLocked.OldValue; AutomaticArchiveDuration = changes.AutomaticArchiveDuration.OldValue; Slowmode = changes.Slowmode.OldValue; Type = changes.Type.OldValue; } }
public TransientStickerAuditLogData(IClient client, AuditLogEntryJsonModel model, bool isCreated) { var changes = new TransientStickerAuditLogChanges(client, model); if (isCreated) { Name = changes.Name.NewValue; Description = changes.Description.NewValue; Tags = changes.Tags.NewValue; FormatType = changes.FormatType.NewValue; IsAvailable = changes.IsAvailable.NewValue; GuildId = changes.GuildId.NewValue; } else { Name = changes.Name.OldValue; Description = changes.Description.OldValue; Tags = changes.Tags.OldValue; FormatType = changes.FormatType.OldValue; IsAvailable = changes.IsAvailable.OldValue; GuildId = changes.GuildId.OldValue; } }
public TransientIntegrationAuditLogChanges(IClient client, AuditLogEntryJsonModel model) { for (var i = 0; i < model.Changes.Value.Length; i++) { var change = model.Changes.Value[i]; switch (change.Key) { case "enable_emoticons": { EnablesEmojis = AuditLogChange <bool> .Convert(change); break; } case "expire_behavior": { ExpireBehavior = AuditLogChange <IntegrationExpirationBehavior> .Convert(change); break; } case "expire_grace_period": { ExpireGracePeriod = AuditLogChange <TimeSpan> .Convert <int>(change, x => TimeSpan.FromDays(x)); break; } default: { client.Logger.LogDebug("Unknown key {0} for {1}", change.Key, this); break; } } } }
public TransientInviteDeletedAuditLog(IClient client, Snowflake guildId, AuditLogJsonModel auditLogJsonModel, AuditLogEntryJsonModel model) : base(client, guildId, auditLogJsonModel, model) { Data = new TransientInviteAuditLogData(client, model, false); }
public TransientMembersPrunedAuditLog(IClient client, Snowflake guildId, AuditLogJsonModel auditLogJsonModel, AuditLogEntryJsonModel model) : base(client, guildId, auditLogJsonModel, model) { }
public TransientStageCreatedAuditLog(IClient client, Snowflake guildId, AuditLogJsonModel auditLogJsonModel, AuditLogEntryJsonModel model) : base(client, guildId, auditLogJsonModel, model) { Data = new TransientStageAuditLogData(client, model, true); }
public TransientChannelAuditLogChanges(IClient client, AuditLogEntryJsonModel model) { for (var i = 0; i < model.Changes.Value.Length; i++) { var change = model.Changes.Value[i]; switch (change.Key) { case "name": { Name = AuditLogChange <string> .Convert(change); break; } case "topic": { Topic = AuditLogChange <string> .Convert(change); break; } case "bitrate": { Bitrate = AuditLogChange <int> .Convert(change); break; } case "user_limit": { MemberLimit = AuditLogChange <int> .Convert(change); break; } case "permission_overwrites": { Overwrites = AuditLogChange <IReadOnlyList <IOverwrite> > .Convert(change, (client, model.TargetId.Value), (OverwriteJsonModel[] x, (IClient, Snowflake)tuple) => x.ToReadOnlyList(tuple, (x, tuple) => { var(client, channelId) = tuple; return(new TransientOverwrite(client, channelId, x)); })); break; } case "nsfw": { IsNsfw = AuditLogChange <bool> .Convert(change); break; } case "rate_limit_per_user": { Slowmode = AuditLogChange <TimeSpan> .Convert <int>(change, x => TimeSpan.FromSeconds(x)); break; } case "type": { Type = AuditLogChange <ChannelType> .Convert(change); break; } case "rtc_region": { Region = AuditLogChange <string> .Convert(change); break; } default: { client.Logger.LogDebug("Unknown key {0} for {1}", change.Key, this); break; } } } }
public TransientMemberRolesUpdatedAuditLog(IClient client, Snowflake guildId, AuditLogJsonModel auditLogJsonModel, AuditLogEntryJsonModel model) : base(client, guildId, auditLogJsonModel, model) { for (var i = 0; i < model.Changes.Value.Length; i++) { var change = model.Changes.Value[i]; switch (change.Key) { case "$add": { RolesGranted = Optional.Convert(change.NewValue, x => { var models = x.ToType <RoleJsonModel[]>(); return(models.ToReadOnlyDictionary(x => x.Id, x => x.Name)); }); break; } case "$remove": { RolesRevoked = Optional.Convert(change.NewValue, x => { var models = x.ToType <RoleJsonModel[]>(); return(models.ToReadOnlyDictionary(x => x.Id, x => x.Name)); }); break; } default: { client.Logger.LogDebug("Unknown key {0} for {1}", change.Key, this); break; } } } }
public TransientGuildAuditLogChanges(IClient client, AuditLogJsonModel auditLogJsonModel, AuditLogEntryJsonModel model) { for (var i = 0; i < model.Changes.Value.Length; i++) { var change = model.Changes.Value[i]; switch (change.Key) { case "name": { Name = AuditLogChange <string> .Convert(change); break; } case "description": { Description = AuditLogChange <string> .Convert(change); break; } case "icon_hash": { IconHash = AuditLogChange <string> .Convert(change); break; } case "splash_hash": { SplashHash = AuditLogChange <string> .Convert(change); break; } case "discovery_splash_hash": { DiscoverySplashHash = AuditLogChange <string> .Convert(change); break; } case "banner_hash": { BannerHash = AuditLogChange <string> .Convert(change); break; } case "owner_id": { OwnerId = AuditLogChange <Snowflake> .Convert(change); IUser oldOwner = null; var oldOwnerModel = Array.Find(auditLogJsonModel.Users, x => x.Id == OwnerId.OldValue.Value); if (oldOwnerModel != null) { oldOwner = new TransientUser(client, oldOwnerModel); } IUser newOwner = null; var newOwnerModel = Array.Find(auditLogJsonModel.Users, x => x.Id == OwnerId.NewValue.Value); if (newOwnerModel != null) { newOwner = new TransientUser(client, newOwnerModel); } Owner = new AuditLogChange <Optional <IUser> >(Optional.FromNullable(oldOwner), Optional.FromNullable(newOwner)); break; } case "region": { VoiceRegion = AuditLogChange <string> .Convert(change); break; } case "preferred_locale": { PreferredLocale = AuditLogChange <CultureInfo> .Convert <string>(change, Discord.Internal.GetLocale); break; } case "afk_channel_id": { AfkChannelId = AuditLogChange <Snowflake?> .Convert(change); break; } case "afk_timeout": { AfkTimeout = AuditLogChange <int> .Convert(change); break; } case "rules_channel_id": { RulesChannelId = AuditLogChange <Snowflake?> .Convert(change); break; } case "public_updates_channel_id": { PublicUpdatesChannelId = AuditLogChange <Snowflake?> .Convert(change); break; } case "mfa_level": { MfaLevel = AuditLogChange <GuildMfaLevel> .Convert(change); break; } case "verification_level": { VerificationLevel = AuditLogChange <GuildVerificationLevel> .Convert(change); break; } case "explicit_content_filter": { ContentFilterLevel = AuditLogChange <GuildContentFilterLevel> .Convert(change); break; } case "default_message_notifications": { DefaultNotificationLevel = AuditLogChange <GuildNotificationLevel> .Convert(change); break; } case "vanity_url_code": { VanityUrlCode = AuditLogChange <string> .Convert(change); break; } case "prune_days": { PruneDays = AuditLogChange <int?> .Convert(change); break; } case "widget_enabled": { IsWidgetEnabled = AuditLogChange <bool> .Convert(change); break; } case "widget_channel_id": { WidgetChannelId = AuditLogChange <Snowflake?> .Convert(change); break; } case "system_channel_id": { SystemChannelId = AuditLogChange <Snowflake?> .Convert(change); break; } default: { client.Logger.LogDebug("Unknown key {0} for {1}", change.Key, this); break; } } } }
public TransientInviteAuditLogChanges(IClient client, AuditLogEntryJsonModel model) { for (var i = 0; i < model.Changes.Value.Length; i++) { var change = model.Changes.Value[i]; switch (change.Key) { case "code": { Code = AuditLogChange <string> .Convert(change); break; } case "channel_id": { ChannelId = AuditLogChange <Snowflake> .Convert(change); break; } case "inviter_id": { InviterId = AuditLogChange <Snowflake> .Convert(change); break; } case "max_uses": { MaxUses = AuditLogChange <int> .Convert(change); break; } case "uses": { Uses = AuditLogChange <int> .Convert(change); break; } case "temporary": { IsTemporary = AuditLogChange <bool> .Convert(change); break; } case "max_age": { MaxAge = AuditLogChange <TimeSpan> .Convert <int>(change, x => TimeSpan.FromSeconds(x)); break; } default: { client.Logger.LogDebug("Unknown key {0} for {1}", change.Key, this); break; } } } }
public TransientThreadUpdatedAuditLog(IClient client, Snowflake guildId, AuditLogJsonModel auditLogJsonModel, AuditLogEntryJsonModel model) : base(client, guildId, auditLogJsonModel, model) { Changes = new TransientThreadAuditLogChanges(client, model); }
public TransientMessagesBulkDeletedAuditLog(IClient client, Snowflake guildId, AuditLogJsonModel auditLogJsonModel, AuditLogEntryJsonModel model) : base(client, guildId, auditLogJsonModel, model) { }
public TransientUnknownAuditLog(IClient client, Snowflake guildId, AuditLogJsonModel auditLogJsonModel, AuditLogEntryJsonModel model) : base(client, guildId, auditLogJsonModel, model) { }