From 2f59abdda7a1072036ea1fdb4c859cccbb56efa6 Mon Sep 17 00:00:00 2001 From: Wim Date: Fri, 4 Sep 2020 23:29:13 +0200 Subject: Update vendor (#1228) --- .../github.com/matterbridge/discordgo/.travis.yml | 4 +- vendor/github.com/matterbridge/discordgo/README.md | 31 +- .../github.com/matterbridge/discordgo/discord.go | 2 +- .../github.com/matterbridge/discordgo/message.go | 45 ++- vendor/github.com/matterbridge/discordgo/oauth2.go | 28 ++ .../github.com/matterbridge/discordgo/restapi.go | 19 +- .../github.com/matterbridge/discordgo/structs.go | 370 +++++++++++++++------ 7 files changed, 361 insertions(+), 138 deletions(-) (limited to 'vendor/github.com/matterbridge') diff --git a/vendor/github.com/matterbridge/discordgo/.travis.yml b/vendor/github.com/matterbridge/discordgo/.travis.yml index b88f11ee..6077b25a 100644 --- a/vendor/github.com/matterbridge/discordgo/.travis.yml +++ b/vendor/github.com/matterbridge/discordgo/.travis.yml @@ -1,9 +1,11 @@ language: go go: - - 1.10.x - 1.11.x - 1.12.x - 1.13.x + - 1.14.x +env: + - GO111MODULE=on install: - go get github.com/bwmarrin/discordgo - go get -v . diff --git a/vendor/github.com/matterbridge/discordgo/README.md b/vendor/github.com/matterbridge/discordgo/README.md index 4410d1e1..289e1622 100644 --- a/vendor/github.com/matterbridge/discordgo/README.md +++ b/vendor/github.com/matterbridge/discordgo/README.md @@ -26,41 +26,17 @@ Gophers](https://discord.gg/0f1SbxBZjYq9jLBk) chat server.** ## Getting Started -### master vs develop Branch -* The master branch represents the latest released version of DiscordGo. This -branch will always have a stable and tested version of the library. Each release -is tagged and you can easily download a specific release and view release notes -on the github [releases](https://github.com/bwmarrin/discordgo/releases) page. - -* The develop branch is where all development happens and almost always has -new features over the master branch. However breaking changes are frequently -added to develop and even sometimes bugs are introduced. Bugs get fixed and -the breaking changes get documented before pushing to master. - -*So, what should you use?* - -If you can accept the constant changing nature of *develop*, it is the -recommended branch to use. Otherwise, if you want to tail behind development -slightly and have a more stable package with documented releases, use *master*. - ### Installing This assumes you already have a working Go environment, if not please see [this page](https://golang.org/doc/install) first. -`go get` *will always pull the latest released version from the master branch.* +`go get` *will always pull the latest tagged release from the master branch.* ```sh go get github.com/bwmarrin/discordgo ``` -If you want to use the develop branch, follow these steps next. - -```sh -cd $GOPATH/src/github.com/bwmarrin/discordgo -git checkout develop -``` - ### Usage Import the package into your project. @@ -81,7 +57,7 @@ See Documentation and Examples below for more detailed information. ## Documentation -**NOTICE** : This library and the Discord API are unfinished. +**NOTICE**: This library and the Discord API are unfinished. Because of that there may be major changes to library in the future. The DiscordGo code is fairly well documented at this point and is currently @@ -112,12 +88,11 @@ Contributions are very welcomed, however please follow the below guidelines. - First open an issue describing the bug or enhancement so it can be discussed. -- Fork the develop branch and make your changes. - Try to match current naming conventions as closely as possible. - This package is intended to be a low level direct mapping of the Discord API, so please avoid adding enhancements outside of that scope without first discussing it. -- Create a Pull Request with your changes against the develop branch. +- Create a Pull Request with your changes against the master branch. ## List of Discord APIs diff --git a/vendor/github.com/matterbridge/discordgo/discord.go b/vendor/github.com/matterbridge/discordgo/discord.go index c8395080..0d2aafbb 100644 --- a/vendor/github.com/matterbridge/discordgo/discord.go +++ b/vendor/github.com/matterbridge/discordgo/discord.go @@ -22,7 +22,7 @@ import ( ) // VERSION of DiscordGo, follows Semantic Versioning. (http://semver.org/) -const VERSION = "0.21.1" +const VERSION = "0.22.0" // ErrMFA will be risen by New when the user has 2FA. var ErrMFA = errors.New("account has 2FA enabled") diff --git a/vendor/github.com/matterbridge/discordgo/message.go b/vendor/github.com/matterbridge/discordgo/message.go index 00b8112b..f4b20fee 100644 --- a/vendor/github.com/matterbridge/discordgo/message.go +++ b/vendor/github.com/matterbridge/discordgo/message.go @@ -16,6 +16,7 @@ import ( ) // MessageType is the type of Message +// https://discord.com/developers/docs/resources/channel#message-object-message-types type MessageType int // Block contains the valid known MessageType values @@ -33,6 +34,8 @@ const ( MessageTypeUserPremiumGuildSubscriptionTierTwo MessageTypeUserPremiumGuildSubscriptionTierThree MessageTypeChannelFollowAdd + MessageTypeGuildDiscoveryDisqualified + MessageTypeGuildDiscoveryRequalified ) // A Message stores all data related to a specific Discord message. @@ -117,9 +120,22 @@ type Message struct { // The flags of the message, which describe extra features of a message. // This is a combination of bit masks; the presence of a certain permission can // be checked by performing a bitwise AND between this int and the flag. - Flags int `json:"flags"` + Flags MessageFlags `json:"flags"` } +// MessageFlags is the flags of "message" (see MessageFlags* consts) +// https://discord.com/developers/docs/resources/channel#message-object-message-flags +type MessageFlags int + +// Valid MessageFlags values +const ( + MessageFlagsCrossPosted MessageFlags = 1 << iota + MessageFlagsIsCrossPosted + MessageFlagsSupressEmbeds + MessageFlagsSourceMessageDeleted + MessageFlagsUrgent +) + // File stores info about files you e.g. send in messages. type File struct { Name string @@ -245,10 +261,9 @@ type MessageEmbedThumbnail struct { // MessageEmbedVideo is a part of a MessageEmbed struct. type MessageEmbedVideo struct { - URL string `json:"url,omitempty"` - ProxyURL string `json:"proxy_url,omitempty"` - Width int `json:"width,omitempty"` - Height int `json:"height,omitempty"` + URL string `json:"url,omitempty"` + Width int `json:"width,omitempty"` + Height int `json:"height,omitempty"` } // MessageEmbedProvider is a part of a MessageEmbed struct. @@ -275,7 +290,7 @@ type MessageEmbedField struct { // An MessageEmbed stores data for message embeds. type MessageEmbed struct { URL string `json:"url,omitempty"` - Type string `json:"type,omitempty"` + Type EmbedType `json:"type,omitempty"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` Timestamp string `json:"timestamp,omitempty"` @@ -289,6 +304,20 @@ type MessageEmbed struct { Fields []*MessageEmbedField `json:"fields,omitempty"` } +// EmbedType is the type of embed +// https://discord.com/developers/docs/resources/channel#embed-object-embed-types +type EmbedType string + +// Block of valid EmbedTypes +const ( + EmbedTypeRich EmbedType = "rich" + EmbedTypeImage EmbedType = "image" + EmbedTypeVideo EmbedType = "video" + EmbedTypeGifv EmbedType = "gifv" + EmbedTypeArticle EmbedType = "article" + EmbedTypeLink EmbedType = "link" +) + // MessageReactions holds a reactions object for a message. type MessageReactions struct { Count int `json:"count"` @@ -307,7 +336,7 @@ type MessageActivityType int // Constants for the different types of Message Activity const ( - MessageActivityTypeJoin = iota + 1 + MessageActivityTypeJoin MessageActivityType = iota + 1 MessageActivityTypeSpectate MessageActivityTypeListen MessageActivityTypeJoinRequest @@ -319,7 +348,7 @@ type MessageFlag int // Constants for the different bit offsets of Message Flags const ( // This message has been published to subscribed channels (via Channel Following) - MessageFlagCrossposted = 1 << iota + MessageFlagCrossposted MessageFlag = 1 << iota // This message originated from a message in another channel (via Channel Following) MessageFlagIsCrosspost // Do not include any embeds when serializing this message diff --git a/vendor/github.com/matterbridge/discordgo/oauth2.go b/vendor/github.com/matterbridge/discordgo/oauth2.go index 4a52120b..289eca94 100644 --- a/vendor/github.com/matterbridge/discordgo/oauth2.go +++ b/vendor/github.com/matterbridge/discordgo/oauth2.go @@ -13,6 +13,33 @@ package discordgo // Code specific to Discord OAuth2 Applications // ------------------------------------------------------------------------------------------------ +// The MembershipState represents whether the user is in the team or has been invited into it +type MembershipState int + +// Constants for the different stages of the MembershipState +const ( + MembershipStateInvited MembershipState = iota + 1 + MembershipStateAccepted +) + +// A TeamMember struct stores values for a single Team Member, extending the normal User data - note that the user field is partial +type TeamMember struct { + User *User `json:"user"` + TeamID string `json:"team_id"` + MembershipState MembershipState `json:"membership_state"` + Permissions []string `json:"permissions"` +} + +// A Team struct stores the members of a Discord Developer Team as well as some metadata about it +type Team struct { + ID string `json:"id"` + Name string `json:"name"` + Description string `json:"description"` + Icon string `json:"icon"` + OwnerID string `json:"owner_user_id"` + Members []*TeamMember `json:"members"` +} + // An Application struct stores values for a Discord OAuth2 Application type Application struct { ID string `json:"id,omitempty"` @@ -27,6 +54,7 @@ type Application struct { Flags int `json:"flags,omitempty"` Owner *User `json:"owner"` Bot *User `json:"bot"` + Team *Team `json:"team"` } // Application returns an Application structure of a specific Application diff --git a/vendor/github.com/matterbridge/discordgo/restapi.go b/vendor/github.com/matterbridge/discordgo/restapi.go index b2bbed31..6944e9f6 100644 --- a/vendor/github.com/matterbridge/discordgo/restapi.go +++ b/vendor/github.com/matterbridge/discordgo/restapi.go @@ -844,13 +844,13 @@ func (s *Session) GuildMemberEdit(guildID, userID string, roles []string) (err e // GuildMemberMove moves a guild member from one voice channel to another/none // guildID : The ID of a Guild. // userID : The ID of a User. -// channelID : The ID of a channel to move user to, or null? +// channelID : The ID of a channel to move user to or nil to remove from voice channel // NOTE : I am not entirely set on the name of this function and it may change // prior to the final 1.0.0 release of Discordgo -func (s *Session) GuildMemberMove(guildID, userID, channelID string) (err error) { +func (s *Session) GuildMemberMove(guildID string, userID string, channelID *string) (err error) { data := struct { - ChannelID string `json:"channel_id"` + ChannelID *string `json:"channel_id"` }{channelID} _, err = s.RequestWithBucketID("PATCH", EndpointGuildMember(guildID, userID), data, EndpointGuildMember(guildID, "")) @@ -1309,6 +1309,19 @@ func (s *Session) GuildAuditLog(guildID, userID, beforeID string, actionType, li return } +// GuildEmojis returns all emoji +// guildID : The ID of a Guild. +func (s *Session) GuildEmojis(guildID string) (emoji []*Emoji, err error) { + + body, err := s.RequestWithBucketID("GET", EndpointGuildEmojis(guildID), nil, EndpointGuildEmojis(guildID)) + if err != nil { + return + } + + err = unmarshal(body, &emoji) + return +} + // GuildEmojiCreate creates a new emoji // guildID : The ID of a Guild. // name : The Name of the Emoji. diff --git a/vendor/github.com/matterbridge/discordgo/structs.go b/vendor/github.com/matterbridge/discordgo/structs.go index 620489cc..d7425e0b 100644 --- a/vendor/github.com/matterbridge/discordgo/structs.go +++ b/vendor/github.com/matterbridge/discordgo/structs.go @@ -143,13 +143,24 @@ type Integration struct { Enabled bool `json:"enabled"` Syncing bool `json:"syncing"` RoleID string `json:"role_id"` - ExpireBehavior int `json:"expire_behavior"` + EnableEmoticons bool `json:"enable_emoticons"` + ExpireBehavior ExpireBehavior `json:"expire_behavior"` ExpireGracePeriod int `json:"expire_grace_period"` User *User `json:"user"` Account IntegrationAccount `json:"account"` SyncedAt Timestamp `json:"synced_at"` } +//ExpireBehavior of Integration +// https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors +type ExpireBehavior int + +// Block of valid ExpireBehaviors +const ( + ExpireBehaviorRemoveRole ExpireBehavior = iota + ExpireBehaviorKick +) + // IntegrationAccount is integration account information // sent by the UserConnections endpoint type IntegrationAccount struct { @@ -180,23 +191,34 @@ type ICEServer struct { // A Invite stores all data related to a specific Discord Guild or Channel invite. type Invite struct { - Guild *Guild `json:"guild"` - Channel *Channel `json:"channel"` - Inviter *User `json:"inviter"` - Code string `json:"code"` - CreatedAt Timestamp `json:"created_at"` - MaxAge int `json:"max_age"` - Uses int `json:"uses"` - MaxUses int `json:"max_uses"` - Revoked bool `json:"revoked"` - Temporary bool `json:"temporary"` - Unique bool `json:"unique"` + Guild *Guild `json:"guild"` + Channel *Channel `json:"channel"` + Inviter *User `json:"inviter"` + Code string `json:"code"` + CreatedAt Timestamp `json:"created_at"` + MaxAge int `json:"max_age"` + Uses int `json:"uses"` + MaxUses int `json:"max_uses"` + Revoked bool `json:"revoked"` + Temporary bool `json:"temporary"` + Unique bool `json:"unique"` + TargetUser *User `json:"target_user"` + TargetUserType TargetUserType `json:"target_user_type"` // will only be filled when using InviteWithCounts ApproximatePresenceCount int `json:"approximate_presence_count"` ApproximateMemberCount int `json:"approximate_member_count"` } +// TargetUserType is the type of the target user +// https://discord.com/developers/docs/resources/invite#invite-object-target-user-types +type TargetUserType int + +// Block contains known TargetUserType values +const ( + TargetUserTypeStream TargetUserType = iota +) + // ChannelType is the type of a Channel type ChannelType int @@ -268,6 +290,12 @@ type Channel struct { // Amount of seconds a user has to wait before sending another message (0-21600) // bots, as well as users with the permission manage_messages or manage_channel, are unaffected RateLimitPerUser int `json:"rate_limit_per_user"` + + // ID of the DM creator Zeroed if guild channel + OwnerID string `json:"owner_id"` + + // ApplicationID of the DM creator Zeroed if guild channel or not a bot user + ApplicationID string `json:"application_id"` } // Mention returns a string which mentions the channel @@ -301,8 +329,9 @@ type Emoji struct { ID string `json:"id"` Name string `json:"name"` Roles []string `json:"roles"` - Managed bool `json:"managed"` + User *User `json:"user"` RequireColons bool `json:"require_colons"` + Managed bool `json:"managed"` Animated bool `json:"animated"` Available bool `json:"available"` } @@ -398,11 +427,17 @@ type Guild struct { // The user ID of the owner of the guild. OwnerID string `json:"owner_id"` + // If we are the owner of the guild + Owner bool `json:"owner"` + // The time at which the current user joined the guild. // This field is only present in GUILD_CREATE events and websocket // update events, and thus is only present in state-cached guilds. JoinedAt Timestamp `json:"joined_at"` + // The hash of the guild's discovery splash. + DiscoverySplash string `json:"discovery_splash"` + // The hash of the guild's splash. Splash string `json:"splash"` @@ -426,8 +461,7 @@ type Guild struct { Large bool `json:"large"` // The default message notification setting for the guild. - // 0 == all messages, 1 == mentions only. - DefaultMessageNotifications int `json:"default_message_notifications"` + DefaultMessageNotifications MessageNotifications `json:"default_message_notifications"` // A list of roles in the guild. Roles []*Role `json:"roles"` @@ -445,6 +479,12 @@ type Guild struct { // update events, and thus is only present in state-cached guilds. Presences []*Presence `json:"presences"` + // The maximum number of presences for the guild (the default value, currently 25000, is in effect when null is returned) + MaxPresences int `json:"max_presences"` + + // The maximum number of members for the guild + MaxMembers int `json:"max_members"` + // A list of channels in the guild. // This field is only present in GUILD_CREATE events and websocket // update events, and thus is only present in state-cached guilds. @@ -469,6 +509,9 @@ type Guild struct { // Required MFA level for the guild MfaLevel MfaLevel `json:"mfa_level"` + // The application id of the guild if bot created. + ApplicationID string `json:"application_id"` + // Whether or not the Server Widget is enabled WidgetEnabled bool `json:"widget_enabled"` @@ -478,6 +521,12 @@ type Guild struct { // The Channel ID to which system messages are sent (eg join and leave messages) SystemChannelID string `json:"system_channel_id"` + // The System channel flags + SystemChannelFlags SystemChannelFlag `json:"system_channel_flags"` + + // The ID of the rules channel ID, used for rules. + RulesChannelID string `json:"rules_channel_id"` + // the vanity url code for the guild VanityURLCode string `json:"vanity_url_code"` @@ -492,8 +541,46 @@ type Guild struct { // The total number of users currently boosting this server PremiumSubscriptionCount int `json:"premium_subscription_count"` + + // The preferred locale of a guild with the "PUBLIC" feature; used in server discovery and notices from Discord; defaults to "en-US" + PreferredLocale string `json:"preferred_locale"` + + // The id of the channel where admins and moderators of guilds with the "PUBLIC" feature receive notices from Discord + PublicUpdatesChannelID string `json:"public_updates_channel_id"` + + // The maximum amount of users in a video channel + MaxVideoChannelUsers int `json:"max_video_channel_users"` + + // Approximate number of members in this guild, returned from the GET /guild/ endpoint when with_counts is true + ApproximateMemberCount int `json:"approximate_member_count"` + + // Approximate number of non-offline members in this guild, returned from the GET /guild/ endpoint when with_counts is true + ApproximatePresenceCount int `json:"approximate_presence_count"` + + // Permissions of our user + Permissions int `json:"permissions"` } +// MessageNotifications is the notification level for a guild +// https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level +type MessageNotifications int + +// Block containing known MessageNotifications values +const ( + MessageNotificationsAllMessages MessageNotifications = iota + MessageNotificationsOnlyMentions +) + +// SystemChannelFlag is the type of flags in the system channel (see SystemChannelFlag* consts) +// https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags +type SystemChannelFlag int + +// Block containing known SystemChannelFlag values +const ( + SystemChannelFlagsSuppressJoin SystemChannelFlag = 1 << iota + SystemChannelFlagsSuppressPremium +) + // IconURL returns a URL to the guild's icon. func (g *Guild) IconURL() string { if g.Icon == "" { @@ -775,79 +862,157 @@ type GuildEmbed struct { } // A GuildAuditLog stores data for a guild audit log. +// https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure type GuildAuditLog struct { - Webhooks []struct { - ChannelID string `json:"channel_id"` - GuildID string `json:"guild_id"` - ID string `json:"id"` - Avatar string `json:"avatar"` - Name string `json:"name"` - } `json:"webhooks,omitempty"` - Users []struct { - Username string `json:"username"` - Discriminator string `json:"discriminator"` - Bot bool `json:"bot"` - ID string `json:"id"` - Avatar string `json:"avatar"` - } `json:"users,omitempty"` - AuditLogEntries []struct { - TargetID string `json:"target_id"` - Changes []struct { - NewValue interface{} `json:"new_value"` - OldValue interface{} `json:"old_value"` - Key string `json:"key"` - } `json:"changes,omitempty"` - UserID string `json:"user_id"` - ID string `json:"id"` - ActionType int `json:"action_type"` - Options struct { - DeleteMembersDay string `json:"delete_member_days"` - MembersRemoved string `json:"members_removed"` - ChannelID string `json:"channel_id"` - Count string `json:"count"` - ID string `json:"id"` - Type string `json:"type"` - RoleName string `json:"role_name"` - } `json:"options,omitempty"` - Reason string `json:"reason"` - } `json:"audit_log_entries"` + Webhooks []*Webhook `json:"webhooks,omitempty"` + Users []*User `json:"users,omitempty"` + AuditLogEntries []*AuditLogEntry `json:"audit_log_entries"` + Integrations []*Integration `json:"integrations"` } +// AuditLogEntry for a GuildAuditLog +// https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure +type AuditLogEntry struct { + TargetID string `json:"target_id"` + Changes []*AuditLogChange `json:"changes"` + UserID string `json:"user_id"` + ID string `json:"id"` + ActionType *AuditLogAction `json:"action_type"` + Options *AuditLogOptions `json:"options"` + Reason string `json:"reason"` +} + +// AuditLogChange for an AuditLogEntry +type AuditLogChange struct { + NewValue interface{} `json:"new_value"` + OldValue interface{} `json:"old_value"` + Key *AuditLogChangeKey `json:"key"` +} + +// AuditLogChangeKey value for AuditLogChange +// https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-key +type AuditLogChangeKey string + +// Block of valid AuditLogChangeKey +const ( + AuditLogChangeKeyName AuditLogChangeKey = "name" + AuditLogChangeKeyIconHash AuditLogChangeKey = "icon_hash" + AuditLogChangeKeySplashHash AuditLogChangeKey = "splash_hash" + AuditLogChangeKeyOwnerID AuditLogChangeKey = "owner_id" + AuditLogChangeKeyRegion AuditLogChangeKey = "region" + AuditLogChangeKeyAfkChannelID AuditLogChangeKey = "afk_channel_id" + AuditLogChangeKeyAfkTimeout AuditLogChangeKey = "afk_timeout" + AuditLogChangeKeyMfaLevel AuditLogChangeKey = "mfa_level" + AuditLogChangeKeyVerificationLevel AuditLogChangeKey = "verification_level" + AuditLogChangeKeyExplicitContentFilter AuditLogChangeKey = "explicit_content_filter" + AuditLogChangeKeyDefaultMessageNotification AuditLogChangeKey = "default_message_notifications" + AuditLogChangeKeyVanityURLCode AuditLogChangeKey = "vanity_url_code" + AuditLogChangeKeyRoleAdd AuditLogChangeKey = "$add" + AuditLogChangeKeyRoleRemove AuditLogChangeKey = "$remove" + AuditLogChangeKeyPruneDeleteDays AuditLogChangeKey = "prune_delete_days" + AuditLogChangeKeyWidgetEnabled AuditLogChangeKey = "widget_enabled" + AuditLogChangeKeyWidgetChannelID AuditLogChangeKey = "widget_channel_id" + AuditLogChangeKeySystemChannelID AuditLogChangeKey = "system_channel_id" + AuditLogChangeKeyPosition AuditLogChangeKey = "position" + AuditLogChangeKeyTopic AuditLogChangeKey = "topic" + AuditLogChangeKeyBitrate AuditLogChangeKey = "bitrate" + AuditLogChangeKeyPermissionOverwrite AuditLogChangeKey = "permission_overwrites" + AuditLogChangeKeyNSFW AuditLogChangeKey = "nsfw" + AuditLogChangeKeyApplicationID AuditLogChangeKey = "application_id" + AuditLogChangeKeyRateLimitPerUser AuditLogChangeKey = "rate_limit_per_user" + AuditLogChangeKeyPermissions AuditLogChangeKey = "permissions" + AuditLogChangeKeyColor AuditLogChangeKey = "color" + AuditLogChangeKeyHoist AuditLogChangeKey = "hoist" + AuditLogChangeKeyMentionable AuditLogChangeKey = "mentionable" + AuditLogChangeKeyAllow AuditLogChangeKey = "allow" + AuditLogChangeKeyDeny AuditLogChangeKey = "deny" + AuditLogChangeKeyCode AuditLogChangeKey = "code" + AuditLogChangeKeyChannelID AuditLogChangeKey = "channel_id" + AuditLogChangeKeyInviterID AuditLogChangeKey = "inviter_id" + AuditLogChangeKeyMaxUses AuditLogChangeKey = "max_uses" + AuditLogChangeKeyUses AuditLogChangeKey = "uses" + AuditLogChangeKeyMaxAge AuditLogChangeKey = "max_age" + AuditLogChangeKeyTempoary AuditLogChangeKey = "temporary" + AuditLogChangeKeyDeaf AuditLogChangeKey = "deaf" + AuditLogChangeKeyMute AuditLogChangeKey = "mute" + AuditLogChangeKeyNick AuditLogChangeKey = "nick" + AuditLogChangeKeyAvatarHash AuditLogChangeKey = "avatar_hash" + AuditLogChangeKeyID AuditLogChangeKey = "id" + AuditLogChangeKeyType AuditLogChangeKey = "type" + AuditLogChangeKeyEnableEmoticons AuditLogChangeKey = "enable_emoticons" + AuditLogChangeKeyExpireBehavior AuditLogChangeKey = "expire_behavior" + AuditLogChangeKeyExpireGracePeriod AuditLogChangeKey = "expire_grace_period" +) + +// AuditLogOptions optional data for the AuditLog +// https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info +type AuditLogOptions struct { + DeleteMemberDays string `json:"delete_member_days"` + MembersRemoved string `json:"members_removed"` + ChannelID string `json:"channel_id"` + MessageID string `json:"message_id"` + Count string `json:"count"` + ID string `json:"id"` + Type *AuditLogOptionsType `json:"type"` + RoleName string `json:"role_name"` +} + +// AuditLogOptionsType of the AuditLogOption +// https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info +type AuditLogOptionsType string + +// Valid Types for AuditLogOptionsType +const ( + AuditLogOptionsTypeMember AuditLogOptionsType = "member" + AuditLogOptionsTypeRole AuditLogOptionsType = "role" +) + +// AuditLogAction is the Action of the AuditLog (see AuditLogAction* consts) +// https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events +type AuditLogAction int + // Block contains Discord Audit Log Action Types const ( - AuditLogActionGuildUpdate = 1 - - AuditLogActionChannelCreate = 10 - AuditLogActionChannelUpdate = 11 - AuditLogActionChannelDelete = 12 - AuditLogActionChannelOverwriteCreate = 13 - AuditLogActionChannelOverwriteUpdate = 14 - AuditLogActionChannelOverwriteDelete = 15 - - AuditLogActionMemberKick = 20 - AuditLogActionMemberPrune = 21 - AuditLogActionMemberBanAdd = 22 - AuditLogActionMemberBanRemove = 23 - AuditLogActionMemberUpdate = 24 - AuditLogActionMemberRoleUpdate = 25 - - AuditLogActionRoleCreate = 30 - AuditLogActionRoleUpdate = 31 - AuditLogActionRoleDelete = 32 - - AuditLogActionInviteCreate = 40 - AuditLogActionInviteUpdate = 41 - AuditLogActionInviteDelete = 42 - - AuditLogActionWebhookCreate = 50 - AuditLogActionWebhookUpdate = 51 - AuditLogActionWebhookDelete = 52 - - AuditLogActionEmojiCreate = 60 - AuditLogActionEmojiUpdate = 61 - AuditLogActionEmojiDelete = 62 - - AuditLogActionMessageDelete = 72 + AuditLogActionGuildUpdate AuditLogAction = 1 + + AuditLogActionChannelCreate AuditLogAction = 10 + AuditLogActionChannelUpdate AuditLogAction = 11 + AuditLogActionChannelDelete AuditLogAction = 12 + AuditLogActionChannelOverwriteCreate AuditLogAction = 13 + AuditLogActionChannelOverwriteUpdate AuditLogAction = 14 + AuditLogActionChannelOverwriteDelete AuditLogAction = 15 + + AuditLogActionMemberKick AuditLogAction = 20 + AuditLogActionMemberPrune AuditLogAction = 21 + AuditLogActionMemberBanAdd AuditLogAction = 22 + AuditLogActionMemberBanRemove AuditLogAction = 23 + AuditLogActionMemberUpdate AuditLogAction = 24 + AuditLogActionMemberRoleUpdate AuditLogAction = 25 + + AuditLogActionRoleCreate AuditLogAction = 30 + AuditLogActionRoleUpdate AuditLogAction = 31 + AuditLogActionRoleDelete AuditLogAction = 32 + + AuditLogActionInviteCreate AuditLogAction = 40 + AuditLogActionInviteUpdate AuditLogAction = 41 + AuditLogActionInviteDelete AuditLogAction = 42 + + AuditLogActionWebhookCreate AuditLogAction = 50 + AuditLogActionWebhookUpdate AuditLogAction = 51 + AuditLogActionWebhookDelete AuditLogAction = 52 + + AuditLogActionEmojiCreate AuditLogAction = 60 + AuditLogActionEmojiUpdate AuditLogAction = 61 + AuditLogActionEmojiDelete AuditLogAction = 62 + + AuditLogActionMessageDelete AuditLogAction = 72 + AuditLogActionMessageBulkDelete AuditLogAction = 73 + AuditLogActionMessagePin AuditLogAction = 74 + AuditLogActionMessageUnpin AuditLogAction = 75 + + AuditLogActionIntegrationCreate AuditLogAction = 80 + AuditLogActionIntegrationUpdate AuditLogAction = 81 + AuditLogActionIntegrationDelete AuditLogAction = 82 ) // A UserGuildSettingsChannelOverride stores data for a channel override for a users guild settings. @@ -884,23 +1049,35 @@ type APIErrorMessage struct { // Webhook stores the data for a webhook. type Webhook struct { - ID string `json:"id"` - GuildID string `json:"guild_id"` - ChannelID string `json:"channel_id"` - User *User `json:"user"` - Name string `json:"name"` - Avatar string `json:"avatar"` - Token string `json:"token"` + ID string `json:"id"` + Type WebhookType `json:"type"` + GuildID string `json:"guild_id"` + ChannelID string `json:"channel_id"` + User *User `json:"user"` + Name string `json:"name"` + Avatar string `json:"avatar"` + Token string `json:"token"` } +// WebhookType is the type of Webhook (see WebhookType* consts) in the Webhook struct +// https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-types +type WebhookType int + +// Valid WebhookType values +const ( + WebhookTypeIncoming WebhookType = iota + WebhookTypeChannelFollower +) + // WebhookParams is a struct for webhook params, used in the WebhookExecute command. type WebhookParams struct { - Content string `json:"content,omitempty"` - Username string `json:"username,omitempty"` - AvatarURL string `json:"avatar_url,omitempty"` - TTS bool `json:"tts,omitempty"` - File *File `json:"-"` - Embeds []*MessageEmbed `json:"embeds,omitempty"` + Content string `json:"content,omitempty"` + Username string `json:"username,omitempty"` + AvatarURL string `json:"avatar_url,omitempty"` + TTS bool `json:"tts,omitempty"` + File *File `json:"-"` + Embeds []*MessageEmbed `json:"embeds,omitempty"` + AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"` } // MessageReaction stores the data for a message reaction. @@ -940,7 +1117,6 @@ type Activity struct { type ActivityType int // Valid ActivityType values -// https://discord.com/developers/docs/topics/gateway#activity-object-activity-types const ( ActivityTypeGame GameType = iota ActivityTypeStreaming -- cgit v1.2.3