-
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
Feature: Threads #349
Merged
Merged
Feature: Threads #349
Changes from 35 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
2c0bce6
thread gateway/rest implementation
HopeBaron 544f742
add service endpoints and channel requests
HopeBaron 58a91a3
split invite from categorizables
HopeBaron 816e7a2
Add threads, thread users, missing routes
HopeBaron 844cb35
more work on this
HopeBaron 31e2ec6
core events
HopeBaron 618a256
Almost done (behavior/event handling)
HopeBaron e047fa7
Fix compilation errors
HopeBaron ce9ae39
Consider channels with unknown but same structure
HopeBaron 44dd2ba
implement thread parents behavior into news and text channels
HopeBaron 74c4fc6
implement missing store functions and enable v9 for gateway
HopeBaron d431010
documentation
HopeBaron fe38a32
fix core functions and names
HopeBaron 7d2e9e5
rename publicActiveThreads to activeThreads
HopeBaron 5110d19
remove list prefix from routes
HopeBaron 3e26503
Fix json incorrect and missing fields
HopeBaron 1815672
Fix incorrect jsons
HopeBaron f060237
make a thread modify request a part of channel modify request
HopeBaron d2f6e3e
remodel thread user
HopeBaron 1e745af
remodel thread user & add missing properties/functions
HopeBaron ccf26de
proper startXThread support
HopeBaron 0caffb6
move startPublicThreadWithMessage to thread parents
HopeBaron 019c043
Cleanup
HopeBaron d9e05c2
narrow down the thread channel types
HopeBaron 570dde4
add rest tests
HopeBaron de6b106
fix rest tests
HopeBaron 50bc255
fix user thread data conversion
HopeBaron 9e5800f
add description
HopeBaron 54436f5
register thread user data
HopeBaron fc9588e
add missing behaviors and clean up code
HopeBaron 2faf1da
Add missing getter functions
HopeBaron a6b4097
fix withStrategy signiture
HopeBaron 37734e7
remove has_more from ListThreadResponse
HopeBaron b535b6b
paginate thread suppliers
HopeBaron 618ec26
Fix errors and correct method signitures
HopeBaron d08e11e
optimize imports
HopeBaron 53fedc6
add ThreadParentChannel and cleanup its behavior
HopeBaron cb2998c
add core sync/updates events
HopeBaron 42eb797
handle thread events (broken)
HopeBaron 2c1f4cf
cleanup ChannelData
HopeBaron 5469f5e
handle unknown channel type
HopeBaron 1186df2
move thread related events under the same package
HopeBaron 281ffce
correct typo
HopeBaron 2534a79
remove thread events from the channel handlers
HopeBaron 32d75a2
clean up and document threads
HopeBaron a717883
further documentation
HopeBaron a4b103a
further documentation (2)
HopeBaron ceb7509
Fix markdowns
HopeBaron b8aa5a4
rename the mis-leading thread-starting functions
HopeBaron 26b4d49
Fix cache querying for threads
HopeBaron 9e3b3cb
invert boolean check for public archived threads
HopeBaron 607c023
apply suggestions
HopeBaron c7b3117
provide default values for durations
HopeBaron 79ac641
provide unsafe thread parent behaviors
HopeBaron e34803b
support X-Audit-Log
HopeBaron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package dev.kord.core.behavior | ||
|
||
import dev.kord.common.entity.Snowflake | ||
import dev.kord.core.Kord | ||
import dev.kord.core.behavior.channel.threads.ThreadChannelBehavior | ||
import dev.kord.core.entity.channel.thread.ThreadChannel | ||
import dev.kord.core.supplier.EntitySupplier | ||
import dev.kord.core.supplier.EntitySupplyStrategy | ||
import dev.kord.core.supplier.getChannelOf | ||
import dev.kord.core.supplier.getChannelOfOrNull | ||
|
||
interface ThreadUserBehavior : UserBehavior { | ||
|
||
val threadId: Snowflake | ||
|
||
val thread: ThreadChannelBehavior get() = ThreadChannelBehavior(threadId, kord) | ||
|
||
suspend fun getThread(): ThreadChannel = supplier.getChannelOf(threadId) | ||
|
||
suspend fun getThreadOrNull(): ThreadChannel? = supplier.getChannelOfOrNull(threadId) | ||
|
||
override fun withStrategy(strategy: EntitySupplyStrategy<*>): UserBehavior { | ||
return ThreadUserBehavior(id, threadId, kord, strategy.supply(kord)) | ||
|
||
} | ||
} | ||
|
||
fun ThreadUserBehavior( | ||
id: Snowflake, | ||
threadId: Snowflake, | ||
kord: Kord, | ||
supplier: EntitySupplier = kord.defaultSupplier | ||
): ThreadUserBehavior { | ||
return object : ThreadUserBehavior { | ||
override val id: Snowflake | ||
get() = id | ||
override val threadId: Snowflake | ||
get() = threadId | ||
override val kord: Kord | ||
get() = kord | ||
override val supplier: EntitySupplier | ||
get() = supplier | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm not sure if there's an official documentation out there, but these values are limited to a certain guild boost level, which should be documented.