Fix: Used wrong rout to retrieve singular channel
This commit is contained in:
parent
797af67d3a
commit
8136bfa9a5
|
@ -202,12 +202,12 @@ impl types::Channel {
|
||||||
pub async fn get(
|
pub async fn get(
|
||||||
token: &str,
|
token: &str,
|
||||||
url_api: &str,
|
url_api: &str,
|
||||||
guild_id: &str,
|
channel_id: &str,
|
||||||
limits_user: &mut Limits,
|
limits_user: &mut Limits,
|
||||||
limits_instance: &mut Limits,
|
limits_instance: &mut Limits,
|
||||||
) -> Result<types::Channel, InstanceServerError> {
|
) -> Result<types::Channel, InstanceServerError> {
|
||||||
let request = Client::new()
|
let request = Client::new()
|
||||||
.get(format!("{}/guilds/{}/channels/", url_api, guild_id))
|
.get(format!("{}/channels/{}/", url_api, channel_id))
|
||||||
.bearer_auth(token);
|
.bearer_auth(token);
|
||||||
let mut requester = LimitedRequester::new().await;
|
let mut requester = LimitedRequester::new().await;
|
||||||
let result = match requester
|
let result = match requester
|
||||||
|
@ -222,10 +222,11 @@ impl types::Channel {
|
||||||
Ok(result) => result,
|
Ok(result) => result,
|
||||||
Err(e) => return Err(e),
|
Err(e) => return Err(e),
|
||||||
};
|
};
|
||||||
match from_str::<types::Channel>(&result.text().await.unwrap()) {
|
let result_text = result.text().await.unwrap();
|
||||||
|
match from_str::<types::Channel>(&result_text) {
|
||||||
Ok(object) => Ok(object),
|
Ok(object) => Ok(object),
|
||||||
Err(e) => Err(InstanceServerError::RequestErrorError {
|
Err(e) => Err(InstanceServerError::RequestErrorError {
|
||||||
url: format!("{}/guilds/{}/channels/", url_api, guild_id),
|
url: format!("{}/channels/{}/", url_api, channel_id),
|
||||||
error: e.to_string(),
|
error: e.to_string(),
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue