Skip to content

Commit

Permalink
updated member stuct with premiumSince and Flags, and added voice mes…
Browse files Browse the repository at this point in the history
…sage flag on message struct (#1635)

Co-authored-by: Ashish Jhanwar <[email protected]>
  • Loading branch information
ashishjh-bst and ashishjh-bst authored Apr 14, 2024
1 parent 9d85292 commit 3e8cf81
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/discordgo/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ const (
MessageFlagsFailedToMentionSomeRolesInThread MessageFlags = 1 << 8
// MessageFlagsSuppressNotifications this message will not trigger push and desktop notifications
MessageFlagsSuppressNotifications MessageFlags = 1 << 12
// MessageFlagsIsVoiceMessage this message is a voice message.
MessageFlagsIsVoiceMessage MessageFlags = 1 << 13
)

// File stores info about files you e.g. send in messages.
Expand Down
23 changes: 23 additions & 0 deletions lib/discordgo/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,22 @@ type MessageActivity struct {
PartyID string `json:"party_id"`
}

// MemberFlags represent flags of a guild member.
// https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-flags
type MemberFlags int

// Block containing known MemberFlags values.
const (
// MemberFlagDidRejoin indicates whether the Member has left and rejoined the guild.
MemberFlagDidRejoin MemberFlags = 1 << 0
// MemberFlagCompletedOnboarding indicates whether the Member has completed onboarding.
MemberFlagCompletedOnboarding MemberFlags = 1 << 1
// MemberFlagBypassesVerification indicates whether the Member is exempt from guild verification requirements.
MemberFlagBypassesVerification MemberFlags = 1 << 2
// MemberFlagStartedOnboarding indicates whether the Member has started onboarding.
MemberFlagStartedOnboarding MemberFlags = 1 << 3
)

// A Member stores user information for Guild members. A guild
// member represents a certain user's presence in a guild.
type Member struct {
Expand Down Expand Up @@ -860,6 +876,13 @@ type Member struct {
// A list of IDs of the roles which are possessed by the member.
Roles IDSlice `json:"roles,string"`

// When the user used their Nitro boost on the server
PremiumSince *time.Time `json:"premium_since"`

// The flags of this member. This is a combination of bit masks; the presence of a certain
// flag can be checked by performing a bitwise AND between this int and the flag.
Flags MemberFlags `json:"flags"`

// Whether the user has not yet passed the guild's Membership Screening requirements
Pending bool `json:"pending"`

Expand Down
4 changes: 4 additions & 0 deletions lib/dstate/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ type MemberFields struct {
Nick string
Avatar string
Pending bool
PremiumSince *time.Time
Flags discordgo.MemberFlags
CommunicationDisabledUntil *time.Time
}

Expand Down Expand Up @@ -350,6 +352,8 @@ func MemberStateFromMember(member *discordgo.Member) *MemberState {
Nick: member.Nick,
Avatar: member.Avatar,
Pending: member.Pending,
PremiumSince: member.PremiumSince,
Flags: member.Flags,
CommunicationDisabledUntil: member.CommunicationDisabledUntil,
},
Presence: nil,
Expand Down

0 comments on commit 3e8cf81

Please sign in to comment.