From cc60bb8b15f39f9a62bbb0f466c3c4d80e0416f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20=C3=98en=20Fylling?= Date: Sun, 17 Jan 2021 14:47:22 +0100 Subject: [PATCH] deprecated Update(..) in favour of UpdateBuilder(..) + avoid breaking change with deprecate note --- channel.go | 5 +- deprecated.go | 54 +++ emoji.go | 7 +- guild.go | 23 +- iface_copier_gen.go | 974 ++++++++++++++++++++-------------------- iface_deepcopier_gen.go | 214 ++++----- iface_reseter_gen.go | 228 +++++----- member.go | 7 +- message.go | 14 +- rest_nop_query_impl.go | 6 +- role.go | 7 +- user.go | 5 +- voice.go | 3 + webhook.go | 22 +- 14 files changed, 828 insertions(+), 741 deletions(-) create mode 100644 deprecated.go diff --git a/channel.go b/channel.go index 2fa2d1be..d9653ff7 100644 --- a/channel.go +++ b/channel.go @@ -253,6 +253,9 @@ type ChannelQueryBuilder interface { // a channel on success, and a 400 BAD REQUEST on invalid parameters. Fires a Channel Update Gateway event. If // modifying a category, individual Channel Update events will fire for each child channel that also changes. // For the PATCH method, all the JSON Params are optional. + UpdateBuilder(flags ...Flag) *updateChannelBuilder + + // Deprecated: use UpdateBuilder Update(flags ...Flag) *updateChannelBuilder // DeleteChannel Delete a channel, or close a private message. Requires the 'MANAGE_CHANNELS' permission for @@ -373,7 +376,7 @@ func (c channelQueryBuilder) Get(flags ...Flag) (*Channel, error) { // Discord documentation https://discord.com/developers/docs/resources/channel#modify-channel // Reviewed 2018-06-07 // Comment andersfylling: only implemented the patch method, as its parameters are optional. -func (c channelQueryBuilder) Update(flags ...Flag) (builder *updateChannelBuilder) { +func (c channelQueryBuilder) UpdateBuilder(flags ...Flag) (builder *updateChannelBuilder) { builder = &updateChannelBuilder{} builder.r.itemFactory = func() interface{} { return c.client.pool.channel.Get() diff --git a/deprecated.go b/deprecated.go new file mode 100644 index 00000000..dbe8ec2e --- /dev/null +++ b/deprecated.go @@ -0,0 +1,54 @@ +package disgord + +// Deprecated: use UpdateBuilder +func (m messageQueryBuilder) Update(flags ...Flag) (builder *updateMessageBuilder) { + return m.UpdateBuilder(flags...) +} + +// Deprecated: use UpdateBuilder +func (g guildMemberQueryBuilder) Update(flags ...Flag) UpdateGuildMemberBuilder { + return g.UpdateBuilder(flags...) +} + +// Deprecated: use UpdateBuilder +func (g guildQueryBuilder) Update(flags ...Flag) UpdateGuildBuilder { return g.UpdateBuilder(flags...) } + +// Deprecated: use UpdateBuilder +func (g guildEmojiQueryBuilder) Update(flags ...Flag) UpdateGuildEmojiBuilder { + return g.UpdateBuilder(flags...) +} + +// Deprecated: use UpdateBuilder +func (c channelQueryBuilder) Update(flags ...Flag) (builder *updateChannelBuilder) { + return c.UpdateBuilder(flags...) +} + +// Deprecated: use UpdateBuilder +func (guildQueryBuilderNop) Update(flags ...Flag) UpdateGuildBuilder { + return nil +} + +// Deprecated: use UpdateBuilder +func (currentUserQueryBuilderNop) Update(_ ...Flag) UpdateCurrentUserBuilder { + return nil +} + +// Deprecated: use UpdateBuilder +func (g guildRoleQueryBuilder) Update(flags ...Flag) UpdateGuildRoleBuilder { + return g.UpdateBuilder(flags...) +} + +// Deprecated: use UpdateBuilder +func (c currentUserQueryBuilder) Update(flags ...Flag) UpdateCurrentUserBuilder { + return c.UpdateBuilder(flags...) +} + +// Deprecated: use UpdateBuilder +func (w webhookQueryBuilder) Update(flags ...Flag) (builder *updateWebhookBuilder) { + return w.UpdateBuilder(flags...) +} + +// Deprecated: use UpdateBuilder +func (w webhookWithTokenQueryBuilder) Update(flags ...Flag) (builder *updateWebhookBuilder) { + return w.UpdateBuilder(flags...) +} diff --git a/emoji.go b/emoji.go index ce518866..8de93c1b 100644 --- a/emoji.go +++ b/emoji.go @@ -70,8 +70,11 @@ type GuildEmojiQueryBuilder interface { WithContext(ctx context.Context) GuildEmojiQueryBuilder Get(flags ...Flag) (*Emoji, error) - Update(flags ...Flag) UpdateGuildEmojiBuilder + UpdateBuilder(flags ...Flag) UpdateGuildEmojiBuilder Delete(flags ...Flag) error + + // Deprecated: use UpdateBuilder + Update(flags ...Flag) UpdateGuildEmojiBuilder } func (g guildQueryBuilder) Emoji(emojiID Snowflake) GuildEmojiQueryBuilder { @@ -111,7 +114,7 @@ func (g guildEmojiQueryBuilder) Get(flags ...Flag) (*Emoji, error) { // UpdateEmoji Modify the given emoji. Requires the 'MANAGE_EMOJIS' permission. // Returns the updated emoji object on success. Fires a Guild Emojis Update Gateway event. -func (g guildEmojiQueryBuilder) Update(flags ...Flag) UpdateGuildEmojiBuilder { +func (g guildEmojiQueryBuilder) UpdateBuilder(flags ...Flag) UpdateGuildEmojiBuilder { builder := &updateGuildEmojiBuilder{} builder.r.itemFactory = func() interface{} { return &Emoji{} diff --git a/guild.go b/guild.go index dee0e3de..2c31970b 100644 --- a/guild.go +++ b/guild.go @@ -539,11 +539,8 @@ type GuildQueryBuilderCaller interface { } func (m *Member) UpdateNick(ctx context.Context, client GuildQueryBuilderCaller, nickname string, flags ...Flag) error { - return client. - Guild(m.GuildID). - Member(m.UserID). - WithContext(ctx). - Update(flags...). + builder := client.Guild(m.GuildID).Member(m.UserID).WithContext(ctx).UpdateBuilder(flags...) + return builder. SetNick(nickname). Execute() } @@ -670,9 +667,12 @@ type GuildQueryBuilder interface { // TODO: For GetMembers, it might sense to have the option for a function to filter before each member ends up deep copied. // TODO-2: This could be much more performant in larger guilds where this is needed. GetMembers(params *GetMembersParams, flags ...Flag) ([]*Member, error) - Update(flags ...Flag) UpdateGuildBuilder + UpdateBuilder(flags ...Flag) UpdateGuildBuilder Delete(flags ...Flag) error + // Deprecated: Use UpdateBuilder + Update(flags ...Flag) UpdateGuildBuilder + CreateChannel(name string, params *CreateGuildChannelParams, flags ...Flag) (*Channel, error) UpdateChannelPositions(params []UpdateGuildChannelPositionsParams, flags ...Flag) error CreateMember(userID Snowflake, accessToken string, params *AddGuildMemberParams, flags ...Flag) (*Member, error) @@ -703,7 +703,7 @@ type GuildQueryBuilder interface { SyncIntegration(integrationID Snowflake, flags ...Flag) error GetEmbed(flags ...Flag) (*GuildEmbed, error) - UpdateEmbed(flags ...Flag) UpdateGuildEmbedBuilder + UpdateEmbedBuilder(flags ...Flag) UpdateGuildEmbedBuilder GetVanityURL(flags ...Flag) (*PartialInvite, error) GetAuditLogs(flags ...Flag) GuildAuditLogsBuilder @@ -756,7 +756,7 @@ func (g guildQueryBuilder) Get(flags ...Flag) (guild *Guild, err error) { } // Update is used to create a guild update builder. -func (g guildQueryBuilder) Update(flags ...Flag) UpdateGuildBuilder { +func (g guildQueryBuilder) UpdateBuilder(flags ...Flag) UpdateGuildBuilder { builder := &updateGuildBuilder{} builder.r.itemFactory = func() interface{} { return &Guild{} @@ -1292,7 +1292,7 @@ func (g guildQueryBuilder) GetEmbed(flags ...Flag) (*GuildEmbed, error) { // UpdateEmbed Modify a guild embed object for the guild. All attributes may be passed in with JSON and // modified. Requires the 'MANAGE_GUILD' permission. Returns the updated guild embed object. -func (g guildQueryBuilder) UpdateEmbed(flags ...Flag) UpdateGuildEmbedBuilder { +func (g guildQueryBuilder) UpdateEmbedBuilder(flags ...Flag) UpdateGuildEmbedBuilder { builder := &updateGuildEmbedBuilder{} builder.r.itemFactory = func() interface{} { return &GuildEmbed{} @@ -1409,7 +1409,10 @@ func (g guildQueryBuilder) CreateEmoji(params *CreateGuildEmojiParams, flags ... // KickVoiceParticipant is used to kick someone from voice. func (g guildQueryBuilder) KickVoiceParticipant(userID Snowflake) error { - return g.Member(userID).WithContext(g.ctx).Update().KickFromVoice().Execute() + builder := g.Member(userID).WithContext(g.ctx).UpdateBuilder() + return builder. + KickFromVoice(). + Execute() } // GetWebhooks Returns a list of guild webhook objects. Requires the 'MANAGE_WEBHOOKS' permission. diff --git a/iface_copier_gen.go b/iface_copier_gen.go index e8808828..4726964a 100644 --- a/iface_copier_gen.go +++ b/iface_copier_gen.go @@ -2,102 +2,6 @@ package disgord -func (m *MentionChannel) copyOverTo(other interface{}) error { - var dest *MentionChannel - var valid bool - if dest, valid = other.(*MentionChannel); !valid { - return newErrorUnsupportedType("argument given is not a *MentionChannel type") - } - dest.ID = m.ID - dest.GuildID = m.GuildID - dest.Type = m.Type - dest.Name = m.Name - - return nil -} - -func (g *Guild) copyOverTo(other interface{}) error { - var dest *Guild - var valid bool - if dest, valid = other.(*Guild); !valid { - return newErrorUnsupportedType("argument given is not a *Guild type") - } - dest.ID = g.ID - dest.ApplicationID = g.ApplicationID - dest.Name = g.Name - dest.Icon = g.Icon - dest.Splash = g.Splash - dest.Owner = g.Owner - dest.OwnerID = g.OwnerID - dest.Permissions = g.Permissions - dest.Region = g.Region - dest.AfkChannelID = g.AfkChannelID - dest.AfkTimeout = g.AfkTimeout - dest.VerificationLevel = g.VerificationLevel - dest.DefaultMessageNotifications = g.DefaultMessageNotifications - dest.ExplicitContentFilter = g.ExplicitContentFilter - dest.Roles = make([]*Role, len(g.Roles)) - for i := 0; i < len(g.Roles); i++ { - dest.Roles[i] = DeepCopy(g.Roles[i]).(*Role) - } - dest.Emojis = make([]*Emoji, len(g.Emojis)) - for i := 0; i < len(g.Emojis); i++ { - dest.Emojis[i] = DeepCopy(g.Emojis[i]).(*Emoji) - } - dest.Features = make([]string, len(g.Features)) - copy(dest.Features, g.Features) - dest.MFALevel = g.MFALevel - dest.WidgetEnabled = g.WidgetEnabled - dest.WidgetChannelID = g.WidgetChannelID - dest.SystemChannelID = g.SystemChannelID - dest.JoinedAt = g.JoinedAt - dest.Large = g.Large - dest.Unavailable = g.Unavailable - dest.MemberCount = g.MemberCount - dest.VoiceStates = make([]*VoiceState, len(g.VoiceStates)) - for i := 0; i < len(g.VoiceStates); i++ { - dest.VoiceStates[i] = DeepCopy(g.VoiceStates[i]).(*VoiceState) - } - dest.Members = make([]*Member, len(g.Members)) - for i := 0; i < len(g.Members); i++ { - dest.Members[i] = DeepCopy(g.Members[i]).(*Member) - } - dest.Channels = make([]*Channel, len(g.Channels)) - for i := 0; i < len(g.Channels); i++ { - dest.Channels[i] = DeepCopy(g.Channels[i]).(*Channel) - } - dest.Presences = make([]*UserPresence, len(g.Presences)) - for i := 0; i < len(g.Presences); i++ { - dest.Presences[i] = DeepCopy(g.Presences[i]).(*UserPresence) - } - - return nil -} - -func (a *Activity) copyOverTo(other interface{}) error { - var dest *Activity - var valid bool - if dest, valid = other.(*Activity); !valid { - return newErrorUnsupportedType("argument given is not a *Activity type") - } - dest.Name = a.Name - dest.Type = a.Type - dest.URL = a.URL - dest.CreatedAt = a.CreatedAt - dest.Timestamps = a.Timestamps - dest.ApplicationID = a.ApplicationID - dest.Details = a.Details - dest.State = a.State - dest.Emoji = a.Emoji - dest.Party = a.Party - dest.Assets = a.Assets - dest.Secrets = a.Secrets - dest.Instance = a.Instance - dest.Flags = a.Flags - - return nil -} - func (v *VoiceRegion) copyOverTo(other interface{}) error { var dest *VoiceRegion var valid bool @@ -116,6 +20,18 @@ func (v *VoiceRegion) copyOverTo(other interface{}) error { return nil } +func (e *EmbedProvider) copyOverTo(other interface{}) error { + var dest *EmbedProvider + var valid bool + if dest, valid = other.(*EmbedProvider); !valid { + return newErrorUnsupportedType("argument given is not a *EmbedProvider type") + } + dest.Name = e.Name + dest.URL = e.URL + + return nil +} + func (e *EmbedVideo) copyOverTo(other interface{}) error { var dest *EmbedVideo var valid bool @@ -129,50 +45,92 @@ func (e *EmbedVideo) copyOverTo(other interface{}) error { return nil } -func (e *EmbedField) copyOverTo(other interface{}) error { - var dest *EmbedField +func (e *Embed) copyOverTo(other interface{}) error { + var dest *Embed var valid bool - if dest, valid = other.(*EmbedField); !valid { - return newErrorUnsupportedType("argument given is not a *EmbedField type") + if dest, valid = other.(*Embed); !valid { + return newErrorUnsupportedType("argument given is not a *Embed type") + } + dest.Title = e.Title + dest.Type = e.Type + dest.Description = e.Description + dest.URL = e.URL + dest.Timestamp = e.Timestamp + dest.Color = e.Color + dest.Footer = e.Footer + dest.Image = e.Image + dest.Thumbnail = e.Thumbnail + dest.Video = e.Video + dest.Provider = e.Provider + dest.Author = e.Author + dest.Fields = make([]*EmbedField, len(e.Fields)) + for i := 0; i < len(e.Fields); i++ { + dest.Fields[i] = DeepCopy(e.Fields[i]).(*EmbedField) } - dest.Name = e.Name - dest.Value = e.Value - dest.Inline = e.Inline return nil } -func (e *EmbedImage) copyOverTo(other interface{}) error { - var dest *EmbedImage +func (i *Integration) copyOverTo(other interface{}) error { + var dest *Integration var valid bool - if dest, valid = other.(*EmbedImage); !valid { - return newErrorUnsupportedType("argument given is not a *EmbedImage type") + if dest, valid = other.(*Integration); !valid { + return newErrorUnsupportedType("argument given is not a *Integration type") } - dest.URL = e.URL - dest.ProxyURL = e.ProxyURL - dest.Height = e.Height - dest.Width = e.Width + dest.ID = i.ID + dest.Name = i.Name + dest.Type = i.Type + dest.Enabled = i.Enabled + dest.Syncing = i.Syncing + dest.RoleID = i.RoleID + dest.ExpireBehavior = i.ExpireBehavior + dest.ExpireGracePeriod = i.ExpireGracePeriod + dest.User = i.User + dest.Account = i.Account return nil } -func (m *Member) copyOverTo(other interface{}) error { - var dest *Member +func (b *Ban) copyOverTo(other interface{}) error { + var dest *Ban var valid bool - if dest, valid = other.(*Member); !valid { - return newErrorUnsupportedType("argument given is not a *Member type") + if dest, valid = other.(*Ban); !valid { + return newErrorUnsupportedType("argument given is not a *Ban type") } - dest.GuildID = m.GuildID - dest.User = m.User - dest.Nick = m.Nick - dest.Roles = make([]Snowflake, len(m.Roles)) - copy(dest.Roles, m.Roles) - dest.JoinedAt = m.JoinedAt - dest.PremiumSince = m.PremiumSince - dest.Deaf = m.Deaf - dest.Mute = m.Mute - dest.Pending = m.Pending - dest.UserID = m.UserID + dest.Reason = b.Reason + dest.User = b.User + + return nil +} + +func (c *Channel) copyOverTo(other interface{}) error { + var dest *Channel + var valid bool + if dest, valid = other.(*Channel); !valid { + return newErrorUnsupportedType("argument given is not a *Channel type") + } + dest.ID = c.ID + dest.Type = c.Type + dest.GuildID = c.GuildID + dest.Position = c.Position + dest.PermissionOverwrites = make([]PermissionOverwrite, len(c.PermissionOverwrites)) + copy(dest.PermissionOverwrites, c.PermissionOverwrites) + dest.Name = c.Name + dest.Topic = c.Topic + dest.NSFW = c.NSFW + dest.LastMessageID = c.LastMessageID + dest.Bitrate = c.Bitrate + dest.UserLimit = c.UserLimit + dest.RateLimitPerUser = c.RateLimitPerUser + dest.Recipients = make([]*User, len(c.Recipients)) + for i := 0; i < len(c.Recipients); i++ { + dest.Recipients[i] = DeepCopy(c.Recipients[i]).(*User) + } + dest.Icon = c.Icon + dest.OwnerID = c.OwnerID + dest.ApplicationID = c.ApplicationID + dest.ParentID = c.ParentID + dest.LastPinTimestamp = c.LastPinTimestamp return nil } @@ -194,205 +152,156 @@ func (a *AuditLogOption) copyOverTo(other interface{}) error { return nil } -func (e *Emoji) copyOverTo(other interface{}) error { - var dest *Emoji +func (a *Activity) copyOverTo(other interface{}) error { + var dest *Activity var valid bool - if dest, valid = other.(*Emoji); !valid { - return newErrorUnsupportedType("argument given is not a *Emoji type") + if dest, valid = other.(*Activity); !valid { + return newErrorUnsupportedType("argument given is not a *Activity type") } - dest.ID = e.ID - dest.Name = e.Name - dest.Roles = make([]Snowflake, len(e.Roles)) - copy(dest.Roles, e.Roles) - dest.User = e.User - dest.RequireColons = e.RequireColons - dest.Managed = e.Managed - dest.Animated = e.Animated + dest.Name = a.Name + dest.Type = a.Type + dest.URL = a.URL + dest.CreatedAt = a.CreatedAt + dest.Timestamps = a.Timestamps + dest.ApplicationID = a.ApplicationID + dest.Details = a.Details + dest.State = a.State + dest.Emoji = a.Emoji + dest.Party = a.Party + dest.Assets = a.Assets + dest.Secrets = a.Secrets + dest.Instance = a.Instance + dest.Flags = a.Flags return nil } -func (a *ActivityTimestamp) copyOverTo(other interface{}) error { - var dest *ActivityTimestamp +func (m *Message) copyOverTo(other interface{}) error { + var dest *Message var valid bool - if dest, valid = other.(*ActivityTimestamp); !valid { - return newErrorUnsupportedType("argument given is not a *ActivityTimestamp type") + if dest, valid = other.(*Message); !valid { + return newErrorUnsupportedType("argument given is not a *Message type") } - dest.Start = a.Start - dest.End = a.End - - return nil -} - -func (b *Ban) copyOverTo(other interface{}) error { - var dest *Ban - var valid bool - if dest, valid = other.(*Ban); !valid { - return newErrorUnsupportedType("argument given is not a *Ban type") - } - dest.Reason = b.Reason - dest.User = b.User - - return nil -} - -func (a *AuditLog) copyOverTo(other interface{}) error { - var dest *AuditLog - var valid bool - if dest, valid = other.(*AuditLog); !valid { - return newErrorUnsupportedType("argument given is not a *AuditLog type") + dest.ID = m.ID + dest.ChannelID = m.ChannelID + dest.GuildID = m.GuildID + dest.Author = m.Author + dest.Member = m.Member + dest.Content = m.Content + dest.Timestamp = m.Timestamp + dest.EditedTimestamp = m.EditedTimestamp + dest.Tts = m.Tts + dest.MentionEveryone = m.MentionEveryone + dest.Mentions = make([]*User, len(m.Mentions)) + for i := 0; i < len(m.Mentions); i++ { + dest.Mentions[i] = DeepCopy(m.Mentions[i]).(*User) } - dest.Webhooks = make([]*Webhook, len(a.Webhooks)) - for i := 0; i < len(a.Webhooks); i++ { - dest.Webhooks[i] = DeepCopy(a.Webhooks[i]).(*Webhook) + dest.MentionRoles = make([]Snowflake, len(m.MentionRoles)) + copy(dest.MentionRoles, m.MentionRoles) + dest.MentionChannels = make([]*MentionChannel, len(m.MentionChannels)) + for i := 0; i < len(m.MentionChannels); i++ { + dest.MentionChannels[i] = DeepCopy(m.MentionChannels[i]).(*MentionChannel) } - dest.Users = make([]*User, len(a.Users)) - for i := 0; i < len(a.Users); i++ { - dest.Users[i] = DeepCopy(a.Users[i]).(*User) + dest.Attachments = make([]*Attachment, len(m.Attachments)) + for i := 0; i < len(m.Attachments); i++ { + dest.Attachments[i] = DeepCopy(m.Attachments[i]).(*Attachment) } - dest.AuditLogEntries = make([]*AuditLogEntry, len(a.AuditLogEntries)) - for i := 0; i < len(a.AuditLogEntries); i++ { - dest.AuditLogEntries[i] = DeepCopy(a.AuditLogEntries[i]).(*AuditLogEntry) + dest.Embeds = make([]*Embed, len(m.Embeds)) + for i := 0; i < len(m.Embeds); i++ { + dest.Embeds[i] = DeepCopy(m.Embeds[i]).(*Embed) } - - return nil -} - -func (i *Integration) copyOverTo(other interface{}) error { - var dest *Integration - var valid bool - if dest, valid = other.(*Integration); !valid { - return newErrorUnsupportedType("argument given is not a *Integration type") + dest.Reactions = make([]*Reaction, len(m.Reactions)) + for i := 0; i < len(m.Reactions); i++ { + dest.Reactions[i] = DeepCopy(m.Reactions[i]).(*Reaction) } - dest.ID = i.ID - dest.Name = i.Name - dest.Type = i.Type - dest.Enabled = i.Enabled - dest.Syncing = i.Syncing - dest.RoleID = i.RoleID - dest.ExpireBehavior = i.ExpireBehavior - dest.ExpireGracePeriod = i.ExpireGracePeriod - dest.User = i.User - dest.Account = i.Account - - return nil -} - -func (a *ActivitySecrets) copyOverTo(other interface{}) error { - var dest *ActivitySecrets - var valid bool - if dest, valid = other.(*ActivitySecrets); !valid { - return newErrorUnsupportedType("argument given is not a *ActivitySecrets type") + dest.Nonce = m.Nonce + dest.Pinned = m.Pinned + dest.WebhookID = m.WebhookID + dest.Type = m.Type + dest.Activity = m.Activity + dest.Application = m.Application + dest.MessageReference = m.MessageReference + dest.ReferencedMessage = m.ReferencedMessage + dest.Flags = m.Flags + dest.Stickers = make([]*MessageSticker, len(m.Stickers)) + for i := 0; i < len(m.Stickers); i++ { + dest.Stickers[i] = DeepCopy(m.Stickers[i]).(*MessageSticker) } - dest.Join = a.Join - dest.Spectate = a.Spectate - dest.Match = a.Match + dest.SpoilerTagContent = m.SpoilerTagContent + dest.SpoilerTagAllAttachments = m.SpoilerTagAllAttachments + dest.HasSpoilerImage = m.HasSpoilerImage return nil } -func (e *Embed) copyOverTo(other interface{}) error { - var dest *Embed +func (g *Guild) copyOverTo(other interface{}) error { + var dest *Guild var valid bool - if dest, valid = other.(*Embed); !valid { - return newErrorUnsupportedType("argument given is not a *Embed type") + if dest, valid = other.(*Guild); !valid { + return newErrorUnsupportedType("argument given is not a *Guild type") } - dest.Title = e.Title - dest.Type = e.Type - dest.Description = e.Description - dest.URL = e.URL - dest.Timestamp = e.Timestamp - dest.Color = e.Color - dest.Footer = e.Footer - dest.Image = e.Image - dest.Thumbnail = e.Thumbnail - dest.Video = e.Video - dest.Provider = e.Provider - dest.Author = e.Author - dest.Fields = make([]*EmbedField, len(e.Fields)) - for i := 0; i < len(e.Fields); i++ { - dest.Fields[i] = DeepCopy(e.Fields[i]).(*EmbedField) + dest.ID = g.ID + dest.ApplicationID = g.ApplicationID + dest.Name = g.Name + dest.Icon = g.Icon + dest.Splash = g.Splash + dest.Owner = g.Owner + dest.OwnerID = g.OwnerID + dest.Permissions = g.Permissions + dest.Region = g.Region + dest.AfkChannelID = g.AfkChannelID + dest.AfkTimeout = g.AfkTimeout + dest.VerificationLevel = g.VerificationLevel + dest.DefaultMessageNotifications = g.DefaultMessageNotifications + dest.ExplicitContentFilter = g.ExplicitContentFilter + dest.Roles = make([]*Role, len(g.Roles)) + for i := 0; i < len(g.Roles); i++ { + dest.Roles[i] = DeepCopy(g.Roles[i]).(*Role) } - - return nil -} - -func (i *InviteMetadata) copyOverTo(other interface{}) error { - var dest *InviteMetadata - var valid bool - if dest, valid = other.(*InviteMetadata); !valid { - return newErrorUnsupportedType("argument given is not a *InviteMetadata type") + dest.Emojis = make([]*Emoji, len(g.Emojis)) + for i := 0; i < len(g.Emojis); i++ { + dest.Emojis[i] = DeepCopy(g.Emojis[i]).(*Emoji) } - dest.Inviter = i.Inviter - dest.Uses = i.Uses - dest.MaxUses = i.MaxUses - dest.MaxAge = i.MaxAge - dest.Temporary = i.Temporary - dest.CreatedAt = i.CreatedAt - dest.Revoked = i.Revoked - - return nil -} - -func (a *AuditLogEntry) copyOverTo(other interface{}) error { - var dest *AuditLogEntry - var valid bool - if dest, valid = other.(*AuditLogEntry); !valid { - return newErrorUnsupportedType("argument given is not a *AuditLogEntry type") + dest.Features = make([]string, len(g.Features)) + copy(dest.Features, g.Features) + dest.MFALevel = g.MFALevel + dest.WidgetEnabled = g.WidgetEnabled + dest.WidgetChannelID = g.WidgetChannelID + dest.SystemChannelID = g.SystemChannelID + dest.JoinedAt = g.JoinedAt + dest.Large = g.Large + dest.Unavailable = g.Unavailable + dest.MemberCount = g.MemberCount + dest.VoiceStates = make([]*VoiceState, len(g.VoiceStates)) + for i := 0; i < len(g.VoiceStates); i++ { + dest.VoiceStates[i] = DeepCopy(g.VoiceStates[i]).(*VoiceState) } - dest.TargetID = a.TargetID - dest.Changes = make([]*AuditLogChanges, len(a.Changes)) - for i := 0; i < len(a.Changes); i++ { - dest.Changes[i] = DeepCopy(a.Changes[i]).(*AuditLogChanges) + dest.Members = make([]*Member, len(g.Members)) + for i := 0; i < len(g.Members); i++ { + dest.Members[i] = DeepCopy(g.Members[i]).(*Member) } - dest.UserID = a.UserID - dest.ID = a.ID - dest.Event = a.Event - dest.Options = a.Options - dest.Reason = a.Reason - - return nil -} - -func (i *IntegrationAccount) copyOverTo(other interface{}) error { - var dest *IntegrationAccount - var valid bool - if dest, valid = other.(*IntegrationAccount); !valid { - return newErrorUnsupportedType("argument given is not a *IntegrationAccount type") + dest.Channels = make([]*Channel, len(g.Channels)) + for i := 0; i < len(g.Channels); i++ { + dest.Channels[i] = DeepCopy(g.Channels[i]).(*Channel) } - dest.ID = i.ID - dest.Name = i.Name - - return nil -} - -func (a *Attachment) copyOverTo(other interface{}) error { - var dest *Attachment - var valid bool - if dest, valid = other.(*Attachment); !valid { - return newErrorUnsupportedType("argument given is not a *Attachment type") + dest.Presences = make([]*UserPresence, len(g.Presences)) + for i := 0; i < len(g.Presences); i++ { + dest.Presences[i] = DeepCopy(g.Presences[i]).(*UserPresence) } - dest.ID = a.ID - dest.Filename = a.Filename - dest.Size = a.Size - dest.URL = a.URL - dest.ProxyURL = a.ProxyURL - dest.Height = a.Height - dest.Width = a.Width - dest.SpoilerTag = a.SpoilerTag return nil } -func (a *ActivityParty) copyOverTo(other interface{}) error { - var dest *ActivityParty +func (e *EmbedImage) copyOverTo(other interface{}) error { + var dest *EmbedImage var valid bool - if dest, valid = other.(*ActivityParty); !valid { - return newErrorUnsupportedType("argument given is not a *ActivityParty type") + if dest, valid = other.(*EmbedImage); !valid { + return newErrorUnsupportedType("argument given is not a *EmbedImage type") } - dest.ID = a.ID - dest.Size = make([]int, len(a.Size)) - copy(dest.Size, a.Size) + dest.URL = e.URL + dest.ProxyURL = e.ProxyURL + dest.Height = e.Height + dest.Width = e.Width return nil } @@ -410,33 +319,28 @@ func (r *Reaction) copyOverTo(other interface{}) error { return nil } -func (w *Webhook) copyOverTo(other interface{}) error { - var dest *Webhook +func (a *ActivityAssets) copyOverTo(other interface{}) error { + var dest *ActivityAssets var valid bool - if dest, valid = other.(*Webhook); !valid { - return newErrorUnsupportedType("argument given is not a *Webhook type") + if dest, valid = other.(*ActivityAssets); !valid { + return newErrorUnsupportedType("argument given is not a *ActivityAssets type") } - dest.ID = w.ID - dest.GuildID = w.GuildID - dest.ChannelID = w.ChannelID - dest.User = w.User - dest.Name = w.Name - dest.Avatar = w.Avatar - dest.Token = w.Token + dest.LargeImage = a.LargeImage + dest.LargeText = a.LargeText + dest.SmallImage = a.SmallImage + dest.SmallText = a.SmallText return nil } -func (e *EmbedAuthor) copyOverTo(other interface{}) error { - var dest *EmbedAuthor +func (i *IntegrationAccount) copyOverTo(other interface{}) error { + var dest *IntegrationAccount var valid bool - if dest, valid = other.(*EmbedAuthor); !valid { - return newErrorUnsupportedType("argument given is not a *EmbedAuthor type") + if dest, valid = other.(*IntegrationAccount); !valid { + return newErrorUnsupportedType("argument given is not a *IntegrationAccount type") } - dest.Name = e.Name - dest.URL = e.URL - dest.IconURL = e.IconURL - dest.ProxyIconURL = e.ProxyIconURL + dest.ID = i.ID + dest.Name = i.Name return nil } @@ -460,28 +364,65 @@ func (r *Role) copyOverTo(other interface{}) error { return nil } -func (a *ActivityAssets) copyOverTo(other interface{}) error { - var dest *ActivityAssets +func (i *InviteMetadata) copyOverTo(other interface{}) error { + var dest *InviteMetadata var valid bool - if dest, valid = other.(*ActivityAssets); !valid { - return newErrorUnsupportedType("argument given is not a *ActivityAssets type") + if dest, valid = other.(*InviteMetadata); !valid { + return newErrorUnsupportedType("argument given is not a *InviteMetadata type") } - dest.LargeImage = a.LargeImage - dest.LargeText = a.LargeText - dest.SmallImage = a.SmallImage - dest.SmallText = a.SmallText + dest.Inviter = i.Inviter + dest.Uses = i.Uses + dest.MaxUses = i.MaxUses + dest.MaxAge = i.MaxAge + dest.Temporary = i.Temporary + dest.CreatedAt = i.CreatedAt + dest.Revoked = i.Revoked return nil } -func (e *EmbedProvider) copyOverTo(other interface{}) error { - var dest *EmbedProvider +func (e *Emoji) copyOverTo(other interface{}) error { + var dest *Emoji var valid bool - if dest, valid = other.(*EmbedProvider); !valid { - return newErrorUnsupportedType("argument given is not a *EmbedProvider type") + if dest, valid = other.(*Emoji); !valid { + return newErrorUnsupportedType("argument given is not a *Emoji type") + } + dest.ID = e.ID + dest.Name = e.Name + dest.Roles = make([]Snowflake, len(e.Roles)) + copy(dest.Roles, e.Roles) + dest.User = e.User + dest.RequireColons = e.RequireColons + dest.Managed = e.Managed + dest.Animated = e.Animated + + return nil +} + +func (e *EmbedThumbnail) copyOverTo(other interface{}) error { + var dest *EmbedThumbnail + var valid bool + if dest, valid = other.(*EmbedThumbnail); !valid { + return newErrorUnsupportedType("argument given is not a *EmbedThumbnail type") + } + dest.URL = e.URL + dest.ProxyURL = e.ProxyURL + dest.Height = e.Height + dest.Width = e.Width + + return nil +} + +func (e *EmbedAuthor) copyOverTo(other interface{}) error { + var dest *EmbedAuthor + var valid bool + if dest, valid = other.(*EmbedAuthor); !valid { + return newErrorUnsupportedType("argument given is not a *EmbedAuthor type") } dest.Name = e.Name dest.URL = e.URL + dest.IconURL = e.IconURL + dest.ProxyIconURL = e.ProxyIconURL return nil } @@ -504,149 +445,129 @@ func (u *UserConnection) copyOverTo(other interface{}) error { return nil } -func (e *EmbedThumbnail) copyOverTo(other interface{}) error { - var dest *EmbedThumbnail +func (a *AuditLog) copyOverTo(other interface{}) error { + var dest *AuditLog var valid bool - if dest, valid = other.(*EmbedThumbnail); !valid { - return newErrorUnsupportedType("argument given is not a *EmbedThumbnail type") + if dest, valid = other.(*AuditLog); !valid { + return newErrorUnsupportedType("argument given is not a *AuditLog type") } - dest.URL = e.URL - dest.ProxyURL = e.ProxyURL - dest.Height = e.Height - dest.Width = e.Width - - return nil -} - -func (m *MessageSticker) copyOverTo(other interface{}) error { - var dest *MessageSticker - var valid bool - if dest, valid = other.(*MessageSticker); !valid { - return newErrorUnsupportedType("argument given is not a *MessageSticker type") + dest.Webhooks = make([]*Webhook, len(a.Webhooks)) + for i := 0; i < len(a.Webhooks); i++ { + dest.Webhooks[i] = DeepCopy(a.Webhooks[i]).(*Webhook) + } + dest.Users = make([]*User, len(a.Users)) + for i := 0; i < len(a.Users); i++ { + dest.Users[i] = DeepCopy(a.Users[i]).(*User) + } + dest.AuditLogEntries = make([]*AuditLogEntry, len(a.AuditLogEntries)) + for i := 0; i < len(a.AuditLogEntries); i++ { + dest.AuditLogEntries[i] = DeepCopy(a.AuditLogEntries[i]).(*AuditLogEntry) } - dest.ID = m.ID - dest.PackID = m.PackID - dest.Name = m.Name - dest.Description = m.Description - dest.Tags = m.Tags - dest.Asset = m.Asset - dest.PreviewAsset = m.PreviewAsset - dest.FormatType = m.FormatType return nil } -func (g *GuildEmbed) copyOverTo(other interface{}) error { - var dest *GuildEmbed +func (i *Invite) copyOverTo(other interface{}) error { + var dest *Invite var valid bool - if dest, valid = other.(*GuildEmbed); !valid { - return newErrorUnsupportedType("argument given is not a *GuildEmbed type") + if dest, valid = other.(*Invite); !valid { + return newErrorUnsupportedType("argument given is not a *Invite type") } - dest.Enabled = g.Enabled - dest.ChannelID = g.ChannelID + dest.Code = i.Code + dest.Guild = i.Guild + dest.Channel = i.Channel + dest.Inviter = i.Inviter + dest.CreatedAt = i.CreatedAt + dest.MaxAge = i.MaxAge + dest.MaxUses = i.MaxUses + dest.Temporary = i.Temporary + dest.Uses = i.Uses + dest.Revoked = i.Revoked + dest.Unique = i.Unique + dest.ApproximatePresenceCount = i.ApproximatePresenceCount + dest.ApproximateMemberCount = i.ApproximateMemberCount return nil } -func (a *ActivityEmoji) copyOverTo(other interface{}) error { - var dest *ActivityEmoji +func (a *ActivitySecrets) copyOverTo(other interface{}) error { + var dest *ActivitySecrets var valid bool - if dest, valid = other.(*ActivityEmoji); !valid { - return newErrorUnsupportedType("argument given is not a *ActivityEmoji type") + if dest, valid = other.(*ActivitySecrets); !valid { + return newErrorUnsupportedType("argument given is not a *ActivitySecrets type") } - dest.Name = a.Name - dest.ID = a.ID - dest.Animated = a.Animated + dest.Join = a.Join + dest.Spectate = a.Spectate + dest.Match = a.Match return nil -} - -func (m *Message) copyOverTo(other interface{}) error { - var dest *Message - var valid bool - if dest, valid = other.(*Message); !valid { - return newErrorUnsupportedType("argument given is not a *Message type") - } - dest.ID = m.ID - dest.ChannelID = m.ChannelID - dest.GuildID = m.GuildID - dest.Author = m.Author - dest.Member = m.Member - dest.Content = m.Content - dest.Timestamp = m.Timestamp - dest.EditedTimestamp = m.EditedTimestamp - dest.Tts = m.Tts - dest.MentionEveryone = m.MentionEveryone - dest.Mentions = make([]*User, len(m.Mentions)) - for i := 0; i < len(m.Mentions); i++ { - dest.Mentions[i] = DeepCopy(m.Mentions[i]).(*User) - } - dest.MentionRoles = make([]Snowflake, len(m.MentionRoles)) - copy(dest.MentionRoles, m.MentionRoles) - dest.MentionChannels = make([]*MentionChannel, len(m.MentionChannels)) - for i := 0; i < len(m.MentionChannels); i++ { - dest.MentionChannels[i] = DeepCopy(m.MentionChannels[i]).(*MentionChannel) - } - dest.Attachments = make([]*Attachment, len(m.Attachments)) - for i := 0; i < len(m.Attachments); i++ { - dest.Attachments[i] = DeepCopy(m.Attachments[i]).(*Attachment) - } - dest.Embeds = make([]*Embed, len(m.Embeds)) - for i := 0; i < len(m.Embeds); i++ { - dest.Embeds[i] = DeepCopy(m.Embeds[i]).(*Embed) - } - dest.Reactions = make([]*Reaction, len(m.Reactions)) - for i := 0; i < len(m.Reactions); i++ { - dest.Reactions[i] = DeepCopy(m.Reactions[i]).(*Reaction) - } - dest.Nonce = m.Nonce - dest.Pinned = m.Pinned - dest.WebhookID = m.WebhookID - dest.Type = m.Type - dest.Activity = m.Activity - dest.Application = m.Application - dest.MessageReference = m.MessageReference - dest.ReferencedMessage = m.ReferencedMessage - dest.Flags = m.Flags - dest.Stickers = make([]*MessageSticker, len(m.Stickers)) - for i := 0; i < len(m.Stickers); i++ { - dest.Stickers[i] = DeepCopy(m.Stickers[i]).(*MessageSticker) +} + +func (a *Attachment) copyOverTo(other interface{}) error { + var dest *Attachment + var valid bool + if dest, valid = other.(*Attachment); !valid { + return newErrorUnsupportedType("argument given is not a *Attachment type") } - dest.SpoilerTagContent = m.SpoilerTagContent - dest.SpoilerTagAllAttachments = m.SpoilerTagAllAttachments - dest.HasSpoilerImage = m.HasSpoilerImage + dest.ID = a.ID + dest.Filename = a.Filename + dest.Size = a.Size + dest.URL = a.URL + dest.ProxyURL = a.ProxyURL + dest.Height = a.Height + dest.Width = a.Width + dest.SpoilerTag = a.SpoilerTag return nil } -func (c *Channel) copyOverTo(other interface{}) error { - var dest *Channel +func (v *VoiceState) copyOverTo(other interface{}) error { + var dest *VoiceState var valid bool - if dest, valid = other.(*Channel); !valid { - return newErrorUnsupportedType("argument given is not a *Channel type") + if dest, valid = other.(*VoiceState); !valid { + return newErrorUnsupportedType("argument given is not a *VoiceState type") } - dest.ID = c.ID - dest.Type = c.Type - dest.GuildID = c.GuildID - dest.Position = c.Position - dest.PermissionOverwrites = make([]PermissionOverwrite, len(c.PermissionOverwrites)) - copy(dest.PermissionOverwrites, c.PermissionOverwrites) - dest.Name = c.Name - dest.Topic = c.Topic - dest.NSFW = c.NSFW - dest.LastMessageID = c.LastMessageID - dest.Bitrate = c.Bitrate - dest.UserLimit = c.UserLimit - dest.RateLimitPerUser = c.RateLimitPerUser - dest.Recipients = make([]*User, len(c.Recipients)) - for i := 0; i < len(c.Recipients); i++ { - dest.Recipients[i] = DeepCopy(c.Recipients[i]).(*User) + dest.GuildID = v.GuildID + dest.ChannelID = v.ChannelID + dest.UserID = v.UserID + dest.Member = v.Member + dest.SessionID = v.SessionID + dest.Deaf = v.Deaf + dest.Mute = v.Mute + dest.SelfDeaf = v.SelfDeaf + dest.SelfMute = v.SelfMute + dest.Suppress = v.Suppress + + return nil +} + +func (m *MessageSticker) copyOverTo(other interface{}) error { + var dest *MessageSticker + var valid bool + if dest, valid = other.(*MessageSticker); !valid { + return newErrorUnsupportedType("argument given is not a *MessageSticker type") } - dest.Icon = c.Icon - dest.OwnerID = c.OwnerID - dest.ApplicationID = c.ApplicationID - dest.ParentID = c.ParentID - dest.LastPinTimestamp = c.LastPinTimestamp + dest.ID = m.ID + dest.PackID = m.PackID + dest.Name = m.Name + dest.Description = m.Description + dest.Tags = m.Tags + dest.Asset = m.Asset + dest.PreviewAsset = m.PreviewAsset + dest.FormatType = m.FormatType + + return nil +} + +func (e *EmbedField) copyOverTo(other interface{}) error { + var dest *EmbedField + var valid bool + if dest, valid = other.(*EmbedField); !valid { + return newErrorUnsupportedType("argument given is not a *EmbedField type") + } + dest.Name = e.Name + dest.Value = e.Value + dest.Inline = e.Inline return nil } @@ -668,48 +589,56 @@ func (u *UserPresence) copyOverTo(other interface{}) error { return nil } -func (a *AuditLogChanges) copyOverTo(other interface{}) error { - var dest *AuditLogChanges +func (w *Webhook) copyOverTo(other interface{}) error { + var dest *Webhook var valid bool - if dest, valid = other.(*AuditLogChanges); !valid { - return newErrorUnsupportedType("argument given is not a *AuditLogChanges type") + if dest, valid = other.(*Webhook); !valid { + return newErrorUnsupportedType("argument given is not a *Webhook type") } - dest.NewValue = a.NewValue - dest.OldValue = a.OldValue - dest.Key = a.Key + dest.ID = w.ID + dest.GuildID = w.GuildID + dest.ChannelID = w.ChannelID + dest.User = w.User + dest.Name = w.Name + dest.Avatar = w.Avatar + dest.Token = w.Token return nil } -func (v *VoiceState) copyOverTo(other interface{}) error { - var dest *VoiceState +func (g *GuildEmbed) copyOverTo(other interface{}) error { + var dest *GuildEmbed var valid bool - if dest, valid = other.(*VoiceState); !valid { - return newErrorUnsupportedType("argument given is not a *VoiceState type") + if dest, valid = other.(*GuildEmbed); !valid { + return newErrorUnsupportedType("argument given is not a *GuildEmbed type") } - dest.GuildID = v.GuildID - dest.ChannelID = v.ChannelID - dest.UserID = v.UserID - dest.Member = v.Member - dest.SessionID = v.SessionID - dest.Deaf = v.Deaf - dest.Mute = v.Mute - dest.SelfDeaf = v.SelfDeaf - dest.SelfMute = v.SelfMute - dest.Suppress = v.Suppress + dest.Enabled = g.Enabled + dest.ChannelID = g.ChannelID return nil } -func (e *EmbedFooter) copyOverTo(other interface{}) error { - var dest *EmbedFooter +func (a *ActivityParty) copyOverTo(other interface{}) error { + var dest *ActivityParty var valid bool - if dest, valid = other.(*EmbedFooter); !valid { - return newErrorUnsupportedType("argument given is not a *EmbedFooter type") + if dest, valid = other.(*ActivityParty); !valid { + return newErrorUnsupportedType("argument given is not a *ActivityParty type") } - dest.Text = e.Text - dest.IconURL = e.IconURL - dest.ProxyIconURL = e.ProxyIconURL + dest.ID = a.ID + dest.Size = make([]int, len(a.Size)) + copy(dest.Size, a.Size) + + return nil +} + +func (a *ActivityTimestamp) copyOverTo(other interface{}) error { + var dest *ActivityTimestamp + var valid bool + if dest, valid = other.(*ActivityTimestamp); !valid { + return newErrorUnsupportedType("argument given is not a *ActivityTimestamp type") + } + dest.Start = a.Start + dest.End = a.End return nil } @@ -738,25 +667,96 @@ func (u *User) copyOverTo(other interface{}) error { return nil } -func (i *Invite) copyOverTo(other interface{}) error { - var dest *Invite +func (m *Member) copyOverTo(other interface{}) error { + var dest *Member var valid bool - if dest, valid = other.(*Invite); !valid { - return newErrorUnsupportedType("argument given is not a *Invite type") + if dest, valid = other.(*Member); !valid { + return newErrorUnsupportedType("argument given is not a *Member type") } - dest.Code = i.Code - dest.Guild = i.Guild - dest.Channel = i.Channel - dest.Inviter = i.Inviter - dest.CreatedAt = i.CreatedAt - dest.MaxAge = i.MaxAge - dest.MaxUses = i.MaxUses - dest.Temporary = i.Temporary - dest.Uses = i.Uses - dest.Revoked = i.Revoked - dest.Unique = i.Unique - dest.ApproximatePresenceCount = i.ApproximatePresenceCount - dest.ApproximateMemberCount = i.ApproximateMemberCount + dest.GuildID = m.GuildID + dest.User = m.User + dest.Nick = m.Nick + dest.Roles = make([]Snowflake, len(m.Roles)) + copy(dest.Roles, m.Roles) + dest.JoinedAt = m.JoinedAt + dest.PremiumSince = m.PremiumSince + dest.Deaf = m.Deaf + dest.Mute = m.Mute + dest.Pending = m.Pending + dest.UserID = m.UserID + + return nil +} + +func (m *MentionChannel) copyOverTo(other interface{}) error { + var dest *MentionChannel + var valid bool + if dest, valid = other.(*MentionChannel); !valid { + return newErrorUnsupportedType("argument given is not a *MentionChannel type") + } + dest.ID = m.ID + dest.GuildID = m.GuildID + dest.Type = m.Type + dest.Name = m.Name + + return nil +} + +func (a *AuditLogEntry) copyOverTo(other interface{}) error { + var dest *AuditLogEntry + var valid bool + if dest, valid = other.(*AuditLogEntry); !valid { + return newErrorUnsupportedType("argument given is not a *AuditLogEntry type") + } + dest.TargetID = a.TargetID + dest.Changes = make([]*AuditLogChanges, len(a.Changes)) + for i := 0; i < len(a.Changes); i++ { + dest.Changes[i] = DeepCopy(a.Changes[i]).(*AuditLogChanges) + } + dest.UserID = a.UserID + dest.ID = a.ID + dest.Event = a.Event + dest.Options = a.Options + dest.Reason = a.Reason + + return nil +} + +func (a *AuditLogChanges) copyOverTo(other interface{}) error { + var dest *AuditLogChanges + var valid bool + if dest, valid = other.(*AuditLogChanges); !valid { + return newErrorUnsupportedType("argument given is not a *AuditLogChanges type") + } + dest.NewValue = a.NewValue + dest.OldValue = a.OldValue + dest.Key = a.Key + + return nil +} + +func (a *ActivityEmoji) copyOverTo(other interface{}) error { + var dest *ActivityEmoji + var valid bool + if dest, valid = other.(*ActivityEmoji); !valid { + return newErrorUnsupportedType("argument given is not a *ActivityEmoji type") + } + dest.Name = a.Name + dest.ID = a.ID + dest.Animated = a.Animated + + return nil +} + +func (e *EmbedFooter) copyOverTo(other interface{}) error { + var dest *EmbedFooter + var valid bool + if dest, valid = other.(*EmbedFooter); !valid { + return newErrorUnsupportedType("argument given is not a *EmbedFooter type") + } + dest.Text = e.Text + dest.IconURL = e.IconURL + dest.ProxyIconURL = e.ProxyIconURL return nil } diff --git a/iface_deepcopier_gen.go b/iface_deepcopier_gen.go index 56673413..7d6fa22f 100644 --- a/iface_deepcopier_gen.go +++ b/iface_deepcopier_gen.go @@ -2,110 +2,86 @@ package disgord -func (m *MentionChannel) deepCopy() interface{} { - cp := &MentionChannel{} - _ = DeepCopyOver(cp, m) - return cp -} - -func (g *Guild) deepCopy() interface{} { - cp := &Guild{} - _ = DeepCopyOver(cp, g) - return cp -} - -func (a *Activity) deepCopy() interface{} { - cp := &Activity{} - _ = DeepCopyOver(cp, a) - return cp -} - func (v *VoiceRegion) deepCopy() interface{} { cp := &VoiceRegion{} _ = DeepCopyOver(cp, v) return cp } -func (e *EmbedVideo) deepCopy() interface{} { - cp := &EmbedVideo{} +func (e *EmbedProvider) deepCopy() interface{} { + cp := &EmbedProvider{} _ = DeepCopyOver(cp, e) return cp } -func (e *EmbedField) deepCopy() interface{} { - cp := &EmbedField{} +func (e *EmbedVideo) deepCopy() interface{} { + cp := &EmbedVideo{} _ = DeepCopyOver(cp, e) return cp } -func (e *EmbedImage) deepCopy() interface{} { - cp := &EmbedImage{} +func (e *Embed) deepCopy() interface{} { + cp := &Embed{} _ = DeepCopyOver(cp, e) return cp } -func (m *Member) deepCopy() interface{} { - cp := &Member{} - _ = DeepCopyOver(cp, m) +func (i *Integration) deepCopy() interface{} { + cp := &Integration{} + _ = DeepCopyOver(cp, i) return cp } -func (a *AuditLogOption) deepCopy() interface{} { - cp := &AuditLogOption{} - _ = DeepCopyOver(cp, a) +func (b *Ban) deepCopy() interface{} { + cp := &Ban{} + _ = DeepCopyOver(cp, b) return cp } -func (e *Emoji) deepCopy() interface{} { - cp := &Emoji{} - _ = DeepCopyOver(cp, e) +func (c *Channel) deepCopy() interface{} { + cp := &Channel{} + _ = DeepCopyOver(cp, c) return cp } -func (a *ActivityTimestamp) deepCopy() interface{} { - cp := &ActivityTimestamp{} +func (a *AuditLogOption) deepCopy() interface{} { + cp := &AuditLogOption{} _ = DeepCopyOver(cp, a) return cp } -func (b *Ban) deepCopy() interface{} { - cp := &Ban{} - _ = DeepCopyOver(cp, b) - return cp -} - -func (a *AuditLog) deepCopy() interface{} { - cp := &AuditLog{} +func (a *Activity) deepCopy() interface{} { + cp := &Activity{} _ = DeepCopyOver(cp, a) return cp } -func (i *Integration) deepCopy() interface{} { - cp := &Integration{} - _ = DeepCopyOver(cp, i) +func (m *Message) deepCopy() interface{} { + cp := &Message{} + _ = DeepCopyOver(cp, m) return cp } -func (a *ActivitySecrets) deepCopy() interface{} { - cp := &ActivitySecrets{} - _ = DeepCopyOver(cp, a) +func (g *Guild) deepCopy() interface{} { + cp := &Guild{} + _ = DeepCopyOver(cp, g) return cp } -func (e *Embed) deepCopy() interface{} { - cp := &Embed{} +func (e *EmbedImage) deepCopy() interface{} { + cp := &EmbedImage{} _ = DeepCopyOver(cp, e) return cp } -func (i *InviteMetadata) deepCopy() interface{} { - cp := &InviteMetadata{} - _ = DeepCopyOver(cp, i) +func (r *Reaction) deepCopy() interface{} { + cp := &Reaction{} + _ = DeepCopyOver(cp, r) return cp } -func (a *AuditLogEntry) deepCopy() interface{} { - cp := &AuditLogEntry{} +func (a *ActivityAssets) deepCopy() interface{} { + cp := &ActivityAssets{} _ = DeepCopyOver(cp, a) return cp } @@ -116,27 +92,27 @@ func (i *IntegrationAccount) deepCopy() interface{} { return cp } -func (a *Attachment) deepCopy() interface{} { - cp := &Attachment{} - _ = DeepCopyOver(cp, a) +func (r *Role) deepCopy() interface{} { + cp := &Role{} + _ = DeepCopyOver(cp, r) return cp } -func (a *ActivityParty) deepCopy() interface{} { - cp := &ActivityParty{} - _ = DeepCopyOver(cp, a) +func (i *InviteMetadata) deepCopy() interface{} { + cp := &InviteMetadata{} + _ = DeepCopyOver(cp, i) return cp } -func (r *Reaction) deepCopy() interface{} { - cp := &Reaction{} - _ = DeepCopyOver(cp, r) +func (e *Emoji) deepCopy() interface{} { + cp := &Emoji{} + _ = DeepCopyOver(cp, e) return cp } -func (w *Webhook) deepCopy() interface{} { - cp := &Webhook{} - _ = DeepCopyOver(cp, w) +func (e *EmbedThumbnail) deepCopy() interface{} { + cp := &EmbedThumbnail{} + _ = DeepCopyOver(cp, e) return cp } @@ -146,33 +122,39 @@ func (e *EmbedAuthor) deepCopy() interface{} { return cp } -func (r *Role) deepCopy() interface{} { - cp := &Role{} - _ = DeepCopyOver(cp, r) +func (u *UserConnection) deepCopy() interface{} { + cp := &UserConnection{} + _ = DeepCopyOver(cp, u) return cp } -func (a *ActivityAssets) deepCopy() interface{} { - cp := &ActivityAssets{} +func (a *AuditLog) deepCopy() interface{} { + cp := &AuditLog{} _ = DeepCopyOver(cp, a) return cp } -func (e *EmbedProvider) deepCopy() interface{} { - cp := &EmbedProvider{} - _ = DeepCopyOver(cp, e) +func (i *Invite) deepCopy() interface{} { + cp := &Invite{} + _ = DeepCopyOver(cp, i) return cp } -func (u *UserConnection) deepCopy() interface{} { - cp := &UserConnection{} - _ = DeepCopyOver(cp, u) +func (a *ActivitySecrets) deepCopy() interface{} { + cp := &ActivitySecrets{} + _ = DeepCopyOver(cp, a) return cp } -func (e *EmbedThumbnail) deepCopy() interface{} { - cp := &EmbedThumbnail{} - _ = DeepCopyOver(cp, e) +func (a *Attachment) deepCopy() interface{} { + cp := &Attachment{} + _ = DeepCopyOver(cp, a) + return cp +} + +func (v *VoiceState) deepCopy() interface{} { + cp := &VoiceState{} + _ = DeepCopyOver(cp, v) return cp } @@ -182,33 +164,63 @@ func (m *MessageSticker) deepCopy() interface{} { return cp } +func (e *EmbedField) deepCopy() interface{} { + cp := &EmbedField{} + _ = DeepCopyOver(cp, e) + return cp +} + +func (u *UserPresence) deepCopy() interface{} { + cp := &UserPresence{} + _ = DeepCopyOver(cp, u) + return cp +} + +func (w *Webhook) deepCopy() interface{} { + cp := &Webhook{} + _ = DeepCopyOver(cp, w) + return cp +} + func (g *GuildEmbed) deepCopy() interface{} { cp := &GuildEmbed{} _ = DeepCopyOver(cp, g) return cp } -func (a *ActivityEmoji) deepCopy() interface{} { - cp := &ActivityEmoji{} +func (a *ActivityParty) deepCopy() interface{} { + cp := &ActivityParty{} _ = DeepCopyOver(cp, a) return cp } -func (m *Message) deepCopy() interface{} { - cp := &Message{} +func (a *ActivityTimestamp) deepCopy() interface{} { + cp := &ActivityTimestamp{} + _ = DeepCopyOver(cp, a) + return cp +} + +func (u *User) deepCopy() interface{} { + cp := &User{} + _ = DeepCopyOver(cp, u) + return cp +} + +func (m *Member) deepCopy() interface{} { + cp := &Member{} _ = DeepCopyOver(cp, m) return cp } -func (c *Channel) deepCopy() interface{} { - cp := &Channel{} - _ = DeepCopyOver(cp, c) +func (m *MentionChannel) deepCopy() interface{} { + cp := &MentionChannel{} + _ = DeepCopyOver(cp, m) return cp } -func (u *UserPresence) deepCopy() interface{} { - cp := &UserPresence{} - _ = DeepCopyOver(cp, u) +func (a *AuditLogEntry) deepCopy() interface{} { + cp := &AuditLogEntry{} + _ = DeepCopyOver(cp, a) return cp } @@ -218,9 +230,9 @@ func (a *AuditLogChanges) deepCopy() interface{} { return cp } -func (v *VoiceState) deepCopy() interface{} { - cp := &VoiceState{} - _ = DeepCopyOver(cp, v) +func (a *ActivityEmoji) deepCopy() interface{} { + cp := &ActivityEmoji{} + _ = DeepCopyOver(cp, a) return cp } @@ -229,15 +241,3 @@ func (e *EmbedFooter) deepCopy() interface{} { _ = DeepCopyOver(cp, e) return cp } - -func (u *User) deepCopy() interface{} { - cp := &User{} - _ = DeepCopyOver(cp, u) - return cp -} - -func (i *Invite) deepCopy() interface{} { - cp := &Invite{} - _ = DeepCopyOver(cp, i) - return cp -} diff --git a/iface_reseter_gen.go b/iface_reseter_gen.go index 383aaee4..d804b6ea 100644 --- a/iface_reseter_gen.go +++ b/iface_reseter_gen.go @@ -2,36 +2,36 @@ package disgord -func (g *Guild) reset() { - g.ID = 0 - g.ApplicationID = 0 - g.Name = "" - g.Icon = "" - g.Splash = "" - g.Owner = false - g.OwnerID = 0 - g.Permissions = 0 - g.Region = "" - g.AfkChannelID = 0 - g.AfkTimeout = 0 - g.VerificationLevel = 0 - g.DefaultMessageNotifications = 0 - g.ExplicitContentFilter = 0 - g.Roles = nil - g.Emojis = nil - g.Features = nil - g.MFALevel = 0 - g.WidgetEnabled = false - g.WidgetChannelID = 0 - g.SystemChannelID = 0 - g.JoinedAt = nil - g.Large = false - g.Unavailable = false - g.MemberCount = 0 - g.VoiceStates = nil - g.Members = nil - g.Channels = nil - g.Presences = nil +func (v *VoiceRegion) reset() { + v.ID = "" + v.Name = "" + v.SampleHostname = "" + v.SamplePort = 0 + v.VIP = false + v.Optimal = false + v.Deprecated = false + v.Custom = false +} + +func (c *Channel) reset() { + c.ID = 0 + c.Type = 0 + c.GuildID = 0 + c.Position = 0 + c.PermissionOverwrites = nil + c.Name = "" + c.Topic = "" + c.NSFW = false + c.LastMessageID = 0 + c.Bitrate = 0 + c.UserLimit = 0 + c.RateLimitPerUser = 0 + c.Recipients = nil + c.Icon = "" + c.OwnerID = 0 + c.ApplicationID = 0 + c.ParentID = 0 + c.LastPinTimestamp = Time{} } func (a *Activity) reset() { @@ -51,71 +51,6 @@ func (a *Activity) reset() { a.Flags = 0 } -func (v *VoiceRegion) reset() { - v.ID = "" - v.Name = "" - v.SampleHostname = "" - v.SamplePort = 0 - v.VIP = false - v.Optimal = false - v.Deprecated = false - v.Custom = false -} - -func (m *Member) reset() { - m.GuildID = 0 - if m.User != nil { - Reset(m.User) - } - m.Nick = "" - m.Roles = nil - m.JoinedAt = Time{} - m.PremiumSince = Time{} - m.Deaf = false - m.Mute = false - m.Pending = false - m.UserID = 0 -} - -func (e *Emoji) reset() { - e.ID = 0 - e.Name = "" - e.Roles = nil - if e.User != nil { - Reset(e.User) - } - e.RequireColons = false - e.Managed = false - e.Animated = false -} - -func (m *MessageCreate) reset() { - if m.Message != nil { - Reset(m.Message) - } - m.ShardID = 0 -} - -func (r *Reaction) reset() { - r.Count = 0 - r.Me = false - if r.Emoji != nil { - Reset(r.Emoji) - } -} - -func (r *Role) reset() { - r.ID = 0 - r.Name = "" - r.Color = 0 - r.Hoist = false - r.Position = 0 - r.Permissions = 0 - r.Managed = false - r.Mentionable = false - r.guildID = 0 -} - func (m *Message) reset() { m.ID = 0 m.ChannelID = 0 @@ -154,25 +89,68 @@ func (m *Message) reset() { m.HasSpoilerImage = false } -func (c *Channel) reset() { - c.ID = 0 - c.Type = 0 - c.GuildID = 0 - c.Position = 0 - c.PermissionOverwrites = nil - c.Name = "" - c.Topic = "" - c.NSFW = false - c.LastMessageID = 0 - c.Bitrate = 0 - c.UserLimit = 0 - c.RateLimitPerUser = 0 - c.Recipients = nil - c.Icon = "" - c.OwnerID = 0 - c.ApplicationID = 0 - c.ParentID = 0 - c.LastPinTimestamp = Time{} +func (g *Guild) reset() { + g.ID = 0 + g.ApplicationID = 0 + g.Name = "" + g.Icon = "" + g.Splash = "" + g.Owner = false + g.OwnerID = 0 + g.Permissions = 0 + g.Region = "" + g.AfkChannelID = 0 + g.AfkTimeout = 0 + g.VerificationLevel = 0 + g.DefaultMessageNotifications = 0 + g.ExplicitContentFilter = 0 + g.Roles = nil + g.Emojis = nil + g.Features = nil + g.MFALevel = 0 + g.WidgetEnabled = false + g.WidgetChannelID = 0 + g.SystemChannelID = 0 + g.JoinedAt = nil + g.Large = false + g.Unavailable = false + g.MemberCount = 0 + g.VoiceStates = nil + g.Members = nil + g.Channels = nil + g.Presences = nil +} + +func (r *Reaction) reset() { + r.Count = 0 + r.Me = false + if r.Emoji != nil { + Reset(r.Emoji) + } +} + +func (r *Role) reset() { + r.ID = 0 + r.Name = "" + r.Color = 0 + r.Hoist = false + r.Position = 0 + r.Permissions = 0 + r.Managed = false + r.Mentionable = false + r.guildID = 0 +} + +func (e *Emoji) reset() { + e.ID = 0 + e.Name = "" + e.Roles = nil + if e.User != nil { + Reset(e.User) + } + e.RequireColons = false + e.Managed = false + e.Animated = false } func (v *VoiceState) reset() { @@ -208,3 +186,25 @@ func (u *User) reset() { Reset(u.PartialMember) } } + +func (m *Member) reset() { + m.GuildID = 0 + if m.User != nil { + Reset(m.User) + } + m.Nick = "" + m.Roles = nil + m.JoinedAt = Time{} + m.PremiumSince = Time{} + m.Deaf = false + m.Mute = false + m.Pending = false + m.UserID = 0 +} + +func (m *MessageCreate) reset() { + if m.Message != nil { + Reset(m.Message) + } + m.ShardID = 0 +} diff --git a/member.go b/member.go index fdba974e..34718d59 100644 --- a/member.go +++ b/member.go @@ -13,12 +13,15 @@ type GuildMemberQueryBuilder interface { WithContext(ctx context.Context) GuildMemberQueryBuilder Get(flags ...Flag) (*Member, error) - Update(flags ...Flag) UpdateGuildMemberBuilder + UpdateBuilder(flags ...Flag) UpdateGuildMemberBuilder AddRole(roleID Snowflake, flags ...Flag) error RemoveRole(roleID Snowflake, flags ...Flag) error Kick(reason string, flags ...Flag) error Ban(params *BanMemberParams, flags ...Flag) error GetPermissions(flags ...Flag) (PermissionBit, error) + + // Deprecated: use UpdateBuilder + Update(flags ...Flag) UpdateGuildMemberBuilder } func (g guildQueryBuilder) Member(userID Snowflake) GuildMemberQueryBuilder { @@ -65,7 +68,7 @@ func (g guildMemberQueryBuilder) Get(flags ...Flag) (*Member, error) { } // UpdateMember is used to create a builder to update a guild member. -func (g guildMemberQueryBuilder) Update(flags ...Flag) UpdateGuildMemberBuilder { +func (g guildMemberQueryBuilder) UpdateBuilder(flags ...Flag) UpdateGuildMemberBuilder { builder := &updateGuildMemberBuilder{} builder.r.itemFactory = func() interface{} { return &Member{ diff --git a/message.go b/message.go index 936944d0..ff11db51 100644 --- a/message.go +++ b/message.go @@ -292,7 +292,7 @@ type MessageQueryBuilder interface { // UpdateMessage Edit a previously sent message. You can only edit messages that have been sent by the // current user. Returns a message object. Fires a Message Update Gateway event. - Update(flags ...Flag) *updateMessageBuilder + UpdateBuilder(flags ...Flag) *updateMessageBuilder SetContent(content string) (*Message, error) SetEmbed(embed *Embed) (*Message, error) @@ -367,7 +367,7 @@ func (m messageQueryBuilder) Get(flags ...Flag) (*Message, error) { // Discord documentation https://discord.com/developers/docs/resources/channel#edit-message // Reviewed 2018-06-10 // Comment All parameters to this endpoint are optional. -func (m messageQueryBuilder) Update(flags ...Flag) (builder *updateMessageBuilder) { +func (m messageQueryBuilder) UpdateBuilder(flags ...Flag) (builder *updateMessageBuilder) { builder = &updateMessageBuilder{} builder.r.itemFactory = func() interface{} { return &Message{} @@ -491,11 +491,17 @@ func (m messageQueryBuilder) DeleteAllReactions(flags ...Flag) error { ////////////////////////////////////////////////////// func (m messageQueryBuilder) SetContent(content string) (*Message, error) { - return m.WithContext(m.ctx).Update().SetContent(content).Execute() + builder := m.WithContext(m.ctx).UpdateBuilder() + return builder. + SetContent(content). + Execute() } func (m messageQueryBuilder) SetEmbed(embed *Embed) (*Message, error) { - return m.WithContext(m.ctx).Update().SetEmbed(embed).Execute() + builder := m.WithContext(m.ctx).UpdateBuilder() + return builder. + SetEmbed(embed). + Execute() } ////////////////////////////////////////////////////// diff --git a/rest_nop_query_impl.go b/rest_nop_query_impl.go index 28cd1898..2f5f301c 100644 --- a/rest_nop_query_impl.go +++ b/rest_nop_query_impl.go @@ -26,7 +26,7 @@ func (guildQueryBuilderNop) GetChannels(flags ...Flag) ([]*Channel, error) { func (guildQueryBuilderNop) GetMembers(params *GetMembersParams, flags ...Flag) ([]*Member, error) { return nil, nil } -func (guildQueryBuilderNop) Update(flags ...Flag) UpdateGuildBuilder { +func (guildQueryBuilderNop) UpdateBuilder(flags ...Flag) UpdateGuildBuilder { return nil } func (guildQueryBuilderNop) Delete(flags ...Flag) error { @@ -95,7 +95,7 @@ func (guildQueryBuilderNop) SyncIntegration(integrationID Snowflake, flags ...Fl func (guildQueryBuilderNop) GetEmbed(flags ...Flag) (*GuildEmbed, error) { return nil, nil } -func (guildQueryBuilderNop) UpdateEmbed(flags ...Flag) UpdateGuildEmbedBuilder { +func (guildQueryBuilderNop) UpdateEmbedBuilder(flags ...Flag) UpdateGuildEmbedBuilder { return nil } func (guildQueryBuilderNop) GetVanityURL(flags ...Flag) (*PartialInvite, error) { @@ -137,7 +137,7 @@ func (c currentUserQueryBuilderNop) WithContext(_ context.Context) CurrentUserQu func (currentUserQueryBuilderNop) Get(_ ...Flag) (*User, error) { return nil, nil } -func (currentUserQueryBuilderNop) Update(_ ...Flag) UpdateCurrentUserBuilder { +func (currentUserQueryBuilderNop) UpdateBuilder(_ ...Flag) UpdateCurrentUserBuilder { return nil } func (currentUserQueryBuilderNop) GetGuilds(_ *GetCurrentUserGuildsParams, _ ...Flag) ([]*Guild, error) { diff --git a/role.go b/role.go index c3f8f034..58918d52 100644 --- a/role.go +++ b/role.go @@ -78,8 +78,11 @@ func (r *Role) SetGuildID(id Snowflake) { type GuildRoleQueryBuilder interface { WithContext(ctx context.Context) GuildRoleQueryBuilder - Update(flags ...Flag) (builder UpdateGuildRoleBuilder) + UpdateBuilder(flags ...Flag) (builder UpdateGuildRoleBuilder) Delete(flags ...Flag) error + + // Deprecated: use UpdateBuilder + Update(flags ...Flag) UpdateGuildRoleBuilder } func (g guildQueryBuilder) Role(id Snowflake) GuildRoleQueryBuilder { @@ -100,7 +103,7 @@ func (g guildRoleQueryBuilder) WithContext(ctx context.Context) GuildRoleQueryBu // UpdateRole Modify a guild role. Requires the 'MANAGE_ROLES' permission. // Returns the updated role on success. Fires a Guild Role Update Gateway event. -func (g guildRoleQueryBuilder) Update(flags ...Flag) UpdateGuildRoleBuilder { +func (g guildRoleQueryBuilder) UpdateBuilder(flags ...Flag) UpdateGuildRoleBuilder { builder := &updateGuildRoleBuilder{} builder.r.itemFactory = func() interface{} { return &Role{} diff --git a/user.go b/user.go index 81bca5eb..29f0ea73 100644 --- a/user.go +++ b/user.go @@ -387,6 +387,9 @@ type CurrentUserQueryBuilder interface { Get(flags ...Flag) (*User, error) // UpdateCurrentUser Modify the requester's user account settings. Returns a user object on success. + UpdateBuilder(flags ...Flag) UpdateCurrentUserBuilder + + // Deprecated: use UpdateBuilder Update(flags ...Flag) UpdateCurrentUserBuilder // GetCurrentUserGuilds Returns a list of partial guild objects the current user is a member of. @@ -454,7 +457,7 @@ func (c currentUserQueryBuilder) Get(flags ...Flag) (user *User, err error) { // Discord documentation https://discord.com/developers/docs/resources/user#modify-current-user // Reviewed 2019-02-18 // Comment - -func (c currentUserQueryBuilder) Update(flags ...Flag) UpdateCurrentUserBuilder { +func (c currentUserQueryBuilder) UpdateBuilder(flags ...Flag) UpdateCurrentUserBuilder { builder := &updateCurrentUserBuilder{} builder.r.itemFactory = userFactory // TODO: peak cached user builder.r.flags = flags diff --git a/voice.go b/voice.go index af24584e..fbc2ab43 100644 --- a/voice.go +++ b/voice.go @@ -139,6 +139,9 @@ type VoiceChannelQueryBuilder interface { // a channel on success, and a 400 BAD REQUEST on invalid parameters. Fires a Channel Update Gateway event. If // modifying a category, individual Channel Update events will fire for each child channel that also changes. // For the PATCH method, all the JSON Params are optional. + UpdateBuilder(flags ...Flag) *updateChannelBuilder + + // Deprecated: use UpdateBuilder Update(flags ...Flag) *updateChannelBuilder // DeleteChannel Delete a channel, or close a private message. Requires the 'MANAGE_CHANNELS' permission for diff --git a/webhook.go b/webhook.go index 9ed9e027..b949e1d0 100644 --- a/webhook.go +++ b/webhook.go @@ -36,14 +36,17 @@ type WebhookQueryBuilder interface { // GetWebhook Returns the new webhook object for the given id. Get(flags ...Flag) (*Webhook, error) - // UpdateWebhook Modify a webhook. Requires the 'MANAGE_WEBHOOKS' permission. + // UpdateBuilder Modify a webhook. Requires the 'MANAGE_WEBHOOKS' permission. // Returns the updated webhook object on success. + UpdateBuilder(flags ...Flag) *updateWebhookBuilder + + // Deprecated: use UpdateBuilder Update(flags ...Flag) *updateWebhookBuilder - // DeleteWebhook Delete a webhook permanently. User must be owner. Returns a 204 NO CONTENT response on success. + // Delete Deletes a webhook permanently. User must be owner. Returns a 204 NO CONTENT response on success. Delete(flags ...Flag) error - // ExecuteWebhook Trigger a webhook in Discord. + // Execute Trigger a webhook in Discord. Execute(params *ExecuteWebhookParams, wait bool, URLSuffix string, flags ...Flag) (*Message, error) // ExecuteSlackWebhook Trigger a webhook in Discord from the Slack app. @@ -96,7 +99,7 @@ func (w webhookQueryBuilder) Get(flags ...Flag) (ret *Webhook, err error) { // Discord documentation https://discord.com/developers/docs/resources/webhook#modify-webhook // Reviewed 2018-08-14 // Comment All parameters to this endpoint. -func (w webhookQueryBuilder) Update(flags ...Flag) (builder *updateWebhookBuilder) { +func (w webhookQueryBuilder) UpdateBuilder(flags ...Flag) (builder *updateWebhookBuilder) { builder = &updateWebhookBuilder{} builder.r.itemFactory = func() interface{} { return &Webhook{} @@ -171,15 +174,18 @@ func (w webhookQueryBuilder) ExecuteGitHubWebhook(params *ExecuteWebhookParams, type WebhookWithTokenQueryBuilder interface { WithContext(ctx context.Context) WebhookWithTokenQueryBuilder - // GetWebhookWithToken Same as GetWebhook, except this call does not require authentication and + // Get Same as GetWebhook, except this call does not require authentication and // returns no user in the webhook object. Get(flags ...Flag) (*Webhook, error) - // UpdateWebhookWithToken Same as UpdateWebhook, except this call does not require authentication, + // UpdateBuilder Same as UpdateWebhook, except this call does not require authentication, // does _not_ accept a channel_id parameter in the body, and does not return a user in the webhook object. + UpdateBuilder(flags ...Flag) *updateWebhookBuilder + + // Deprecated: use UpdateBuilder Update(flags ...Flag) *updateWebhookBuilder - // DeleteWebhookWithToken Same as DeleteWebhook, except this call does not require authentication. + // Delete Same as DeleteWebhook, except this call does not require authentication. Delete(flags ...Flag) error Execute(params *ExecuteWebhookParams, wait bool, URLSuffix string, flags ...Flag) (*Message, error) @@ -228,7 +234,7 @@ func (w webhookWithTokenQueryBuilder) Get(flags ...Flag) (*Webhook, error) { // Discord documentation https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token // Reviewed 2018-08-14 // Comment All parameters to this endpoint. are optional. -func (w webhookWithTokenQueryBuilder) Update(flags ...Flag) (builder *updateWebhookBuilder) { +func (w webhookWithTokenQueryBuilder) UpdateBuilder(flags ...Flag) (builder *updateWebhookBuilder) { builder = &updateWebhookBuilder{} builder.r.itemFactory = func() interface{} { return &Webhook{}