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(Member): set and reset guild timeouts #302

Merged
merged 3 commits into from
Jan 24, 2022

Conversation

nebulatgs
Copy link
Contributor

About

Adds setGuildTimeout and resetGuildTimeout functions to easily modify guild timeouts for a Member.
Previously, you could only do this by using Member.edit

Status

  • These changes have been tested against Discord API or do not contain API change.
  • This PR includes only documentation changes, no code change.
  • This PR introduces some Breaking changes.

@DjDeveloperr
Copy link
Member

Since Member entity already is a part of Guild, I think just setTimeout and resetTimeout would be better names.

@nebulatgs
Copy link
Contributor Author

Since Member entity already is a part of Guild, I think just setTimeout and resetTimeout would be better names.

oh ok, wanted to avoid confusion with timeouts as in network reqs

* Resets Timeout for the Member
*/
async resetTimeout(reason?: string): Promise<Member> {
return await this.setTimeout(undefined, reason)
Copy link
Member

Choose a reason for hiding this comment

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

use null to remove timeout

Copy link
Contributor Author

@nebulatgs nebulatgs Jan 24, 2022

Choose a reason for hiding this comment

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

MemberData.communicationDisabledUntil is Date | undefined, it's not nullable

Copy link
Member

Choose a reason for hiding this comment

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

huh, then it must be implemented wrong
from this it is nullable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

huh, that's pretty strange, does it function right now?

Copy link
Member

Choose a reason for hiding this comment

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

yes, even the official discord client uses null to remove timeout

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i mean does harmony's impl work, since its wrong

Copy link
Member

Choose a reason for hiding this comment

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

oh, probably not because undefined means that we don't want to change the value, not removing it

but again it's just MemberData type that is wrong, so changing the type or do @ts-ignore will work

Copy link
Member

Choose a reason for hiding this comment

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

Right, we forgot to add | null to MemberData's communication_disabled_until. Can you do that, and change this to null?

Copy link
Member

@DjDeveloperr DjDeveloperr left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@DjDeveloperr DjDeveloperr merged commit 17de8c8 into harmonyland:main Jan 24, 2022
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.

3 participants