File tree Expand file tree Collapse file tree 3 files changed +32
-32
lines changed
Expand file tree Collapse file tree 3 files changed +32
-32
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,35 @@ pub use self::thread::*;
3232use crate :: http:: Http ;
3333use crate :: model:: prelude:: * ;
3434
35+ impl From < ThreadId > for GenericChannelId {
36+ fn from ( val : ThreadId ) -> Self {
37+ Self :: new ( val. get ( ) )
38+ }
39+ }
40+
41+ impl From < ChannelId > for GenericChannelId {
42+ fn from ( val : ChannelId ) -> Self {
43+ Self :: new ( val. get ( ) )
44+ }
45+ }
46+
47+ impl GenericChannelId {
48+ #[ must_use]
49+ pub fn split ( self ) -> ( ChannelId , ThreadId ) {
50+ ( self . expect_channel ( ) , self . expect_thread ( ) )
51+ }
52+
53+ #[ must_use]
54+ pub fn expect_channel ( self ) -> ChannelId {
55+ ChannelId :: new ( self . get ( ) )
56+ }
57+
58+ #[ must_use]
59+ pub fn expect_thread ( self ) -> ThreadId {
60+ ThreadId :: new ( self . get ( ) )
61+ }
62+ }
63+
3564/// A container for a reference to any Guild channel.
3665#[ derive( Clone , Copy , Debug ) ]
3766// purposefully missing non-exhaustive, as discord considers new channel types like threads to be
Original file line number Diff line number Diff line change @@ -6,35 +6,6 @@ use crate::http::CacheHttp;
66use crate :: internal:: prelude:: * ;
77use crate :: model:: utils:: is_false;
88
9- impl From < ThreadId > for GenericChannelId {
10- fn from ( val : ThreadId ) -> Self {
11- Self :: new ( val. get ( ) )
12- }
13- }
14-
15- impl From < ChannelId > for GenericChannelId {
16- fn from ( val : ChannelId ) -> Self {
17- Self :: new ( val. get ( ) )
18- }
19- }
20-
21- impl GenericChannelId {
22- #[ must_use]
23- pub fn split ( self ) -> ( ChannelId , ThreadId ) {
24- ( self . expect_channel ( ) , self . expect_thread ( ) )
25- }
26-
27- #[ must_use]
28- pub fn expect_channel ( self ) -> ChannelId {
29- ChannelId :: new ( self . get ( ) )
30- }
31-
32- #[ must_use]
33- pub fn expect_thread ( self ) -> ThreadId {
34- ThreadId :: new ( self . get ( ) )
35- }
36- }
37-
389impl ThreadId {
3910 #[ must_use]
4011 pub fn widen ( self ) -> GenericChannelId {
@@ -316,7 +287,7 @@ pub struct ThreadMember {
316287 #[ serde( flatten) ]
317288 pub inner : PartialThreadMember ,
318289 /// The id of the thread.
319- pub id : ChannelId ,
290+ pub id : ThreadId ,
320291 /// The id of the user.
321292 pub user_id : UserId ,
322293 /// Additional information about the user.
Original file line number Diff line number Diff line change @@ -765,7 +765,7 @@ pub struct ThreadListSyncEvent {
765765 /// well, so you know to clear that data.
766766 pub channel_ids : Option < Vec < ChannelId > > ,
767767 /// All active threads in the given channels that the current user can access.
768- pub threads : FixedArray < GuildChannel > ,
768+ pub threads : FixedArray < GuildThread > ,
769769 /// All thread member objects from the synced threads for the current user, indicating which
770770 /// threads the current user has been added to
771771 pub members : FixedArray < ThreadMember > ,
@@ -791,7 +791,7 @@ pub struct ThreadMemberUpdateEvent {
791791#[ non_exhaustive]
792792pub struct ThreadMembersUpdateEvent {
793793 /// The id of the thread.
794- pub id : ChannelId ,
794+ pub id : ThreadId ,
795795 /// The id of the Guild.
796796 pub guild_id : GuildId ,
797797 /// The approximate number of members in the thread, capped at 50.
You can’t perform that action at this time.
0 commit comments