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

Fixing setPresence method #69

Merged
merged 3 commits into from
May 7, 2020
Merged

Fixing setPresence method #69

merged 3 commits into from
May 7, 2020

Conversation

One-Nub
Copy link
Contributor

@One-Nub One-Nub commented May 7, 2020

Resolves both a serialization error to json & an issue regarding the packet format that discord expects for the presence.

'type' : game.type,
if(game.type == ActivityType.streaming) 'url' : game.url
'type' : game.type._value,
if(game.type._value == ActivityType.streaming._value) 'url' : game.url
Copy link
Member

Choose a reason for hiding this comment

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

Can you remove _value and modify == operator in ActivityType

other is ActivityType && other._value == this._value

Copy link
Contributor Author

@One-Nub One-Nub May 7, 2020

Choose a reason for hiding this comment

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

Should I also remove it for the moment in 'type' : game.type._value? The only workaround I can think of that would leave it in a usable state would be to parse an int from the toString of game.type ultimately looking like:

'type' : int.parse(game.type.toString())

Although this would most likely be changed when getters are made for the enums if it's remembered

Copy link
Member

Choose a reason for hiding this comment

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

In that case not because we need int as in documentation. This is related to #70 that we need sometimes raw value of enum and now we don't have way to.

nyxx/lib/src/Shard.dart Outdated Show resolved Hide resolved
@l7ssha
Copy link
Member

l7ssha commented May 7, 2020

All "enums" should probably have something like getValue getter because calling _value isn't good practice. But this is for another issue.

@l7ssha l7ssha mentioned this pull request May 7, 2020
@l7ssha l7ssha added this to the 1.0.0 milestone May 7, 2020
@l7ssha l7ssha added bug Something isn't working enhancement New feature or request labels May 7, 2020
@l7ssha l7ssha merged commit 554ab60 into nyxx-discord:rewrite_modular May 7, 2020
@l7ssha l7ssha mentioned this pull request May 7, 2020
21 tasks
l7ssha added a commit that referenced this pull request Feb 11, 2021
Fixing setPresence method
[ci skip]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants