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

BITFIELD_INVALID when passing presence object to new RichPresence() #1406

Closed
3 tasks done
p0ut opened this issue Dec 25, 2024 · 2 comments
Closed
3 tasks done

BITFIELD_INVALID when passing presence object to new RichPresence() #1406

p0ut opened this issue Dec 25, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@p0ut
Copy link

p0ut commented Dec 25, 2024

Which package has the bugs?

The core library

Issue description

If I create a presence object which contains the 'flags' field containing the bitfield value, new RichPresence(client, presence_object) will throw an an BITFIELD_INVALID error. current solution is to use 'delete' the flags field from the presence object.

I am not sure if this an error by me, or perhaps the library, but this error did not previously occur.

Code sample

const presence = {} // assuming this is a complete presence object
const newPresence = new RichPresence(client, presence); // throws error due to flags field ;(

Package version

n/a

Node.js version

18

Operating system

ubuntu

Priority this issue should have

Low (slightly annoying)

Checklist

  • I have searched the open issues for duplicates.
  • I have shared the entire traceback.
  • I am using a user token (and it isn't visible in the code).

Additional Information

No response

@p0ut p0ut added the bug Something isn't working label Dec 25, 2024
@aiko-chan-ai
Copy link
Owner

const test = new RichPresence(client)
	.setApplicationId('367827983903490050')
	.setType('PLAYING')
	.setURL('https://www.youtube.com/watch?v=5icFcPkVzMg') 
	.setState('Arcade Game')
	.setName('osu!')
	.setDetails('MariannE - Yooh')
	.setParty({
		max: 8,
		current: 1,
	})
	.setStartTimestamp(Date.now())
	.setAssetsSmallImage('373370493127884800')
	.setAssetsSmallText('click the circles')
	.setPlatform('desktop')
	.addButton('Beatmap', 'https://osu.ppy.sh/beatmapsets/1391659#osu/2873429');

console.log(new RichPresence(client, test));
console.log(new RichPresence(client, test.toJSON()));

stdout

RichPresence {
  name: 'osu!',
  type: 'PLAYING',
  url: 'https://www.youtube.com/watch?v=5icFcPkVzMg',
  sessionId: undefined,
  platform: 'desktop',
  timestamps: { start: 1735277718468, end: null },
  applicationId: '367827983903490050',
  details: 'MariannE - Yooh',
  state: 'Arcade Game',
  syncId: null,
  flags: ActivityFlags { bitfield: 0 },
  buttons: [ 'Beatmap' ],
  emoji: null,
  party: { size: [ 1, 8 ], id: 'cec777db-ed1a-43dd-a38d-adecc5cbcb8a' },
  assets: RichPresenceAssets {
    largeText: null,
    smallText: 'click the circles',
    largeImage: null,
    smallImage: '373370493127884800'
  },
  secrets: {},
  metadata: {
    button_urls: [ 'https://osu.ppy.sh/beatmapsets/1391659#osu/2873429' ]
  }
}
RichPresence {
  name: 'osu!',
  type: 'PLAYING',
  url: 'https://www.youtube.com/watch?v=5icFcPkVzMg',
  sessionId: undefined,
  platform: 'desktop',
  timestamps: { start: 1735277718468, end: null },
  applicationId: '367827983903490050',
  details: 'MariannE - Yooh',
  state: 'Arcade Game',
  syncId: null,
  flags: ActivityFlags { bitfield: 0 },
  buttons: [ 'Beatmap' ],
  emoji: null,
  party: { size: [ 1, 8 ], id: 'cec777db-ed1a-43dd-a38d-adecc5cbcb8a' },
  assets: RichPresenceAssets {
    largeText: null,
    smallText: 'click the circles',
    largeImage: null,
    smallImage: '373370493127884800'
  },
  secrets: {},
  metadata: {
    button_urls: [ 'https://osu.ppy.sh/beatmapsets/1391659#osu/2873429' ]
  }
}

I have tried the code above, and there are no issues.

@p0ut
Copy link
Author

p0ut commented Dec 29, 2024

AH yep! sorry! (brainless javascript noob here)

@p0ut p0ut closed this as completed Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants