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

Implement Raw sending of status (Rich Presence and Online Status) #462

Merged
merged 9 commits into from
Oct 22, 2017

Conversation

SilverCory
Copy link
Contributor

@SilverCory SilverCory commented Oct 20, 2017

@ikkerens had his cloned and Rich Presence was implemented on top of this.

@SilverCory SilverCory mentioned this pull request Oct 20, 2017
Doesn't do it on save because Gogland removed it and their new thing I
can't make sense of.
wsapi.go Outdated
// UpdateOnlineStatus is used to update the user's online status
// If idle>0 and status=="online" then set status to idle
// If otherwise, set status to the given value and no game
func (s *Session) UpdateOnlineStatus(status string, afk bool, idle int) (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.

I don't think we need to bother with this now.

wsapi.go Outdated
// If game!="" then set game
// If game!="" and url!="" then set the status type to streaming with the URL set.
// If otherwise, set status to the given value and no game
func (s *Session) UpdateOnlineStreamingStatus(status string, afk bool, idle int, game string, url string) (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.

I don't think we need this either, or at least make this private.

structs.go Outdated
Type GameType `json:"type"`
URL string `json:"url,omitempty"`
Name string `json:"name"`
Type int `json:"type"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change Type back to GameType, changing to int is an api change.

wsapi.go Outdated
@@ -276,7 +276,7 @@ func (s *Session) UpdateStreamingStatus(idle int, game string, url string) (err
return ErrWSNotFound
Copy link
Collaborator

Choose a reason for hiding this comment

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

Move this block into UpdateStatusComplex, it should be thread safe too! :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, I think you missed this, we should move the RLock/wsConn check to UpdateStatusComplex.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah sorry I missed that.

wsapi.go Outdated
@@ -291,11 +291,16 @@ func (s *Session) UpdateStreamingStatus(idle int, game string, url string) (err
}
usd.Game = &Game{
Name: game,
Type: gameType,
Type: int(gameType),
Copy link
Collaborator

Choose a reason for hiding this comment

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

This shouldn't be needed.

@SilverCory
Copy link
Contributor Author

@iopred
Copy link
Collaborator

iopred commented Oct 20, 2017

Oops, my apologies, looks like we need the cast when creating the Game, but we should keep the API as using GameType.

@iopred
Copy link
Collaborator

iopred commented Oct 22, 2017

Thanks so much for this <3

@iopred iopred merged commit 8737777 into bwmarrin:develop Oct 22, 2017
@bwmarrin bwmarrin added this to the v0.18.0 milestone Oct 23, 2017
ErikMcClure pushed a commit to ErikMcClure/discordgo that referenced this pull request Aug 4, 2020
…marrin#462)

* Added ability to change the online status

* Add structs for rick presence implementation

* Refractor and publicise UpdateStatusData

* Add UpdateStatusComplex for raw status data sending

* Case gameType to int, stopped it compiling

* Might want to gofmt.

Doesn't do it on save because Gogland removed it and their new thing I
can't make sense of.

* Revert "Added ability to change the online status"

This reverts commit 235cd15.

* Change gametypeto match

* Move RLock to UpdateStatusComplex
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