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

Behaviour improvement #396

Merged
merged 2 commits into from
Sep 25, 2021
Merged

Behaviour improvement #396

merged 2 commits into from
Sep 25, 2021

Conversation

ByteAlex
Copy link
Contributor

Kord entities inherit from their Behaviours, so to keep generic in some places you use a behaviour.

When calling as{Entity} on a Behaviour, I'd expect it to return itself when it's already an entity, but it's doing a cache-lookup instead.

This PR fixes that and returns the Entity in case the Behaviour is an Entity already.

Copy link
Member

@HopeBaron HopeBaron left a comment

Choose a reason for hiding this comment

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

instead of including this in the interface just override it in the core entity to reflect this just like we do in sub channel types
https://github.com/kordlib/kord/blob/0.8.x/core/src/main/kotlin/entity/channel/Category.kt#L29

@ByteAlex
Copy link
Contributor Author

I force pushed a fix for that, this should resolve that!

@ByteAlex ByteAlex requested a review from HopeBaron September 24, 2021 08:58
@HopeBaron HopeBaron merged commit 5b46c75 into kordlib:0.8.x Sep 25, 2021
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