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

feat: support for CUSTOM_STATUS activity type #3353

Merged
merged 2 commits into from
Dec 5, 2019
Merged

feat: support for CUSTOM_STATUS activity type #3353

merged 2 commits into from
Dec 5, 2019

Conversation

favna
Copy link
Contributor

@favna favna commented Jun 22, 2019

Please describe the changes this PR makes and why it should be merged:

This PR covers the custom status Discord recently released to the public. The PR was initially created 4 months ago based on data mined data but now that custom statuses are in the public the PR should enter the merge track.

Evals performed with code changes:

imageimage


Original post from 4 months ago:

This is an upcoming feature that has been data mined from the Canary client. Presumably these few lines are all that is needed since in ClientPresence the number gets matched to the indexOf the ActivityType constant and the new options are as follows:

{
    PLAYING: 0,
    STREAMING: 1,
    LISTENING: 2,
    WATCHING: 3,
    CUSTOM_STATUS: 4 // the newly added type
}

Example images after enabling the option, courtesy of a friend of mine who has it as I do not have it myself.

image

image

As an aside, there also seems to be an upcoming custom voice status however there is not sufficient enough information for that yet to suggest any code changes. That said, I can guarantee my friend and I will keep our eyes out and I'll be back with another PR if required for that.

Status

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating

Semantic versioning classification:

  • This PR changes the library's interface (methods or parameters added)
    • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)
  • This PR only includes non-code changes, like changes to documentation, README, etc.

@favna
Copy link
Contributor Author

favna commented Oct 26, 2019

Bumping this up as custom status is landing now

@vladfrangu
Copy link
Member

The PR is incomplete @favna, see discord/discord-api-docs#1160 (comment)

Maybe it's time to add these too?

@favna
Copy link
Contributor Author

favna commented Oct 26, 2019

With 5a62541 I believe the part of adding it to Activity structure at least is fully covered.

Edit: 8e88100 squashes the above 3 commits into 1 for a cleaner merge

@bensaine
Copy link

I have you tested this manually through the API? Seems like it is not covered for Bot use as of right now.
https://www.reddit.com/r/discordapp/comments/dm47sv/at_least_something_regarding_custom_status/f508crt/

@favna
Copy link
Contributor Author

favna commented Oct 26, 2019

@fatplatapus that's correct it's not available for bots but that doesn't stop bots from getting this data for regular users. Ergo you see the image of message.author.activity offering the data. Logging data in the Activity class returns all the added data from the API.

A good remark but note that it is also covered in the referenced issue on discordapp/discord-api-docs.

@bensaine
Copy link

bensaine commented Oct 26, 2019

@favna Ah ok! Didn't realize this was for getting a user's custom status. Looking over code now, looks good! Nice job :)

@bensaine

This comment has been minimized.

@cfanoulis

This comment has been minimized.

@DevYukine
Copy link
Contributor

Stop spamming peoples notifications with this, if you want to use this just run the fork instead of original d.js in your bot.

Copy link
Contributor

@izexi izexi left a comment

Choose a reason for hiding this comment

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

A getter for Activity#createdAt (which simply returns new Date(this.createdTimestamp)) should be added for consistency

Copy link

@kashima-dot-com kashima-dot-com left a comment

Choose a reason for hiding this comment

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

gg

@favna favna changed the title Support upcoming CUSTOM_STATUS activity type feat: support for CUSTOM_STATUS activity type Nov 11, 2019
@JMTK
Copy link
Contributor

JMTK commented Nov 26, 2019

Will this support multiple activities(array of activities as documented)? Right now the library only supports a 1 to 1.

image

@favna
Copy link
Contributor Author

favna commented Nov 26, 2019

@JMTK That is not part of this pull request and falls out-of-scope. You can create your own pull request to cover such a feature if you want.

Copy link

@RohitM-IN RohitM-IN left a comment

Choose a reason for hiding this comment

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

cant wait for this custom status update for bots. all checks passed dev ?

@favna
Copy link
Contributor Author

favna commented Dec 5, 2019

@RootAndroid58 this will not allow bots to set custom status. Bots cannot have a custom status by API limitation. This will only allow bots to read the custom status of users.

And yes as you can clearly see all checks have passed. This PR is waiting for someone like @SpaceEEC to review it.

@SpaceEEC SpaceEEC merged commit 2ca74d6 into discordjs:master Dec 5, 2019
samsamson33 pushed a commit to samsamson33/discord.js that referenced this pull request Feb 27, 2020
* feat: support for custom status in activity

* nit(typings): order properties
samsamson33 added a commit to samsamson33/discord.js that referenced this pull request Feb 27, 2020
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.