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

Implement Get Thread Member #2810

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/http/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2988,6 +2988,26 @@ impl Http {
.await
}

pub async fn get_thread_channel_member(
&self,
channel_id: ChannelId,
user_id: UserId,
with_member: bool,
) -> Result<ThreadMember> {
self.fire(Request {
body: None,
multipart: None,
headers: None,
method: LightMethod::Get,
route: Route::ChannelThreadMember {
channel_id,
user_id,
},
params: Some(vec![("with_member", with_member.to_string())]),
})
.await
}

/// Retrieves the webhooks for the given [channel][`GuildChannel`]'s Id.
///
/// This method requires authentication.
Expand Down
16 changes: 16 additions & 0 deletions src/model/channel/channel_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,22 @@ impl ChannelId {
http.as_ref().remove_thread_channel_member(self, user_id).await
}

/// Gets a thread member, if this channel is a thread.
///
/// `with_member` controls if ThreadMember::member should be `Some`
///
/// # Errors
///
/// It may return an [`Error::Http`] if the channel is not a thread channel
pub async fn get_thread_member(
self,
http: impl AsRef<Http>,
user_id: UserId,
with_member: bool,
) -> Result<ThreadMember> {
http.as_ref().get_thread_channel_member(self, user_id, with_member).await
}

/// Gets private archived threads of a channel.
///
/// # Errors
Expand Down
Loading