Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support of changing user status #258

Merged
merged 8 commits into from
Sep 28, 2016
Merged

Add Support of changing user status #258

merged 8 commits into from
Sep 28, 2016

Conversation

Hinara
Copy link
Contributor

@Hinara Hinara commented Sep 27, 2016

Recently Discord add the support to change the User status beetween Online, Idle, Do not Distrub and Invisible.
This PR is to implement that new functionality.

@@ -320,6 +320,23 @@ func (s *Session) UserSettings() (st *Settings, err error) {
return
}

// UserUpdateStatus update the user status
// status : The new status (Actual valid status are 'online','idle','dnd','invisible')
func (s *Session) UserUpdateStatus(status string) (st *Settings, err error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider making a type and constants for the valid values, like VerificationLevel, so that we can restrict the values of status.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is actually you have 5 status.
"online","idle","dnd","invisible","offline".
However the Status can be set by the user as "online","idle","dnd" or "invisible"
And the library can see only Users as "online","idle","dnd" or "offline"
So even if there is a Status type the user can send a status bad type ("offline")
I will do that and make a verification in the function.

@Hinara
Copy link
Contributor Author

Hinara commented Sep 28, 2016

So Status is now a type.
Look like it works ^^

Status string `json:"status"`
Game *Game `json:"game"`
User *User `json:"user"`
Status *Status `json:"status"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Status Status json:"status"

GuildPositions []string `json:"guild_positions"`
RestrictedGuilds []string `json:"restricted_guilds"`
FriendSourceFlags *FriendSourceFlags `json:"friend_source_flags"`
Status *Status `json:"status"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Status instead of *Status

Copy link
Contributor Author

@Hinara Hinara Sep 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I will fix it

@iopred iopred merged commit af3fe48 into bwmarrin:develop Sep 28, 2016
@bwmarrin bwmarrin added this to the v0.14.0 milestone Sep 28, 2016
@Hinara Hinara deleted the UserUpdateStats branch January 7, 2017 15:49
ErikMcClure pushed a commit to ErikMcClure/discordgo that referenced this pull request Aug 4, 2020
Add Support of changing user status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants