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

allow activity types #149

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

allow activity types #149

wants to merge 2 commits into from

Conversation

sKiLdUsT
Copy link

@sKiLdUsT sKiLdUsT commented Aug 19, 2021

This allows for sending activity types described here.

I also included some handy constants to use.

This fixes #146

@sKiLdUsT sKiLdUsT changed the title allow activity types (fixes #146) allow activity types Aug 19, 2021
@landenpls
Copy link

It should be noted that the ActivityType enum is discarded in outgoing transport. It is solely for use of incoming messages (e.g. reading friend's activity

From the official docs:

ActivityType is strictly for the purpose of handling events that you receive from Discord; though the SDK/our API will not reject a payload with an ActivityType sent, it will be discarded and will not change anything in the client.

@cpiber
Copy link

cpiber commented Oct 5, 2021

@afoxie I think you're looking at the wrong docs, if you start from https://discord.com/developers/docs/topics/rpc#setactivity (what is used internally), you land at https://discord.com/developers/docs/topics/gateway#activity-object-activity-types, which doesn't have this restriction.

@Araxeus
Copy link

Araxeus commented Nov 23, 2021

Have any of you even checked to see if this PR works?

this literally doesn't work. first of all

child "activity" fails because [child "type" fails because ["type" must be one of [0, 3]]]

second of all even if you input type 3 it still wont actually do anything...

@Viktova
Copy link

Viktova commented Apr 10, 2022

PR doesn't work, but this is an issue that needs to be looked into.
@afoxie you're referring to the docs where it says that the type will get discarded whatsoever and the API will not reject the payload, but in the matter of fact, it is rejecting it and returning 400 (Bad Request).

src/constants.js Outdated
Comment on lines 180 to 187
exports.ActivityTypes = {
PLAYING: 0,
STREAMING: 1,
LISTENING: 2,
WATCHING: 3,
CUSTOM: 4,
COMPETING: 5
}
Copy link

Choose a reason for hiding this comment

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

Suggested change
exports.ActivityTypes = {
PLAYING: 0,
STREAMING: 1,
LISTENING: 2,
WATCHING: 3,
CUSTOM: 4,
COMPETING: 5
}
exports.ActivityTypes = {
PLAYING: 0,
WATCHING: 3
}

Only PLAYING and WATCHING are allowed by RPC. Everything else results in an error.

@sKiLdUsT
Copy link
Author

sKiLdUsT commented Mar 6, 2023

Just to clarify something: This PR was only meant to provide feature-complete integration according to the API docs (https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-types), assuming in the future the use of these constants would open up to the public. I'm aware it's not working right now (since there is no public access to most of the constants) and I'm willing to close this request if there's no need for it.

src/constants.js Outdated Show resolved Hide resolved
src/client.js Outdated Show resolved Hide resolved
Copy link

@jojoblackFr jojoblackFr left a comment

Choose a reason for hiding this comment

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

looks good to me

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.

Is it possible that this library gets way to set Activity Types?
8 participants