-
Notifications
You must be signed in to change notification settings - Fork 82
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
Top channels #353
Top channels #353
Conversation
fun TopGuildChannelBehavior( | ||
guildId: Snowflake, | ||
id: Snowflake, | ||
kord: Kord, | ||
strategy: EntitySupplyStrategy<*> = kord.resources.defaultStrategy | ||
): TopGuildChannelBehavior = object : TopGuildChannelBehavior { | ||
override val guildId: Snowflake = guildId | ||
override val id: Snowflake = id | ||
override val kord: Kord = kord | ||
override val supplier: EntitySupplier = strategy.supply(kord) | ||
|
||
override fun hashCode(): Int = Objects.hash(id, guildId) | ||
|
||
override fun equals(other: Any?): Boolean = when (other) { | ||
is GuildChannelBehavior -> other.id == id && other.guildId == guildId | ||
is ChannelBehavior -> other.id == id | ||
else -> false | ||
} | ||
|
||
override fun toString(): String { | ||
return "TopGuildChannelBehavior(id=$id, guildId=$guildId, kord=$kord, supplier=$supplier)" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be internal
core/src/main/kotlin/Unsafe.kt
Outdated
fun guildChannel(guildId: Snowflake, id: Snowflake): GuildChannelBehavior = | ||
GuildChannelBehavior(guildId = guildId, id = id, kord = kord) | ||
fun guildChannel(guildId: Snowflake, id: Snowflake): TopGuildChannelBehavior = | ||
TopGuildChannelBehavior(guildId = guildId, id = id, kord = kord) | ||
|
||
fun guildMessageChannel(guildId: Snowflake, id: Snowflake): GuildMessageChannelBehavior = | ||
GuildMessageChannelBehavior(guildId = guildId, id = id, kord = kord) | ||
fun guildMessageChannel(guildId: Snowflake, id: Snowflake): TopGuildMessageChannelBehavior = | ||
TopGuildMessageChannelBehavior(guildId = guildId, id = id, kord = kord) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For correctness, I think these should include top
in their name.
override fun hashCode(): Int = Objects.hash(id, guildId) | ||
|
||
override fun equals(other: Any?): Boolean = when (other) { | ||
is GuildChannelBehavior -> other.id == id && other.guildId == guildId | ||
is ChannelBehavior -> other.id == id | ||
else -> false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this removed?
/** | ||
* The behavior of a Discord channel associated to a [guild]. | ||
*/ | ||
interface TopGuildChannelBehavior : GuildChannelBehavior { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should explain what constitutes as a top channel, and how it is different from a not-top channel
core/src/main/kotlin/behavior/channel/GuildMessageChannelBehavior.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/behavior/channel/TopGuildChannelBehavior.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/behavior/channel/TopGuildMessageChannelBehavior.kt
Outdated
Show resolved
Hide resolved
Co-authored-by: Bart Arys <[email protected]>
Co-authored-by: Bart Arys <[email protected]>
GuildChannel
andGuildMessageChannel
to include shared behaviors / data between threads and top level channels.