Skip to content

Commit

Permalink
Remove methods on ClientBulder that don't serve a purpose (serenity…
Browse files Browse the repository at this point in the history
…-rs#2953)

The `ClientBuilder` struct is gated behind the `gateway` feature, which
means that the client will receive the current application ID over the
gateway when first authenticating. Therefore it doesn't make sense to
set the application ID through the `ClientBuilder` as it will get
overrided anyway.

Also, the `get_token` method is pretty useless because the only source
of the token would be whatever the user would have passed to
`ClientBuilder::new`, meaning they would already have a way to read out
its value.
  • Loading branch information
mkrasnitski authored and GnomedDev committed Oct 20, 2024
1 parent 30e24b8 commit 4f427fc
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/gateway/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ use crate::http::Http;
use crate::internal::prelude::*;
use crate::internal::tokio::spawn_named;
use crate::model::gateway::GatewayIntents;
use crate::model::id::ApplicationId;
#[cfg(feature = "voice")]
use crate::model::id::UserId;
use crate::model::user::OnlineStatus;
Expand Down Expand Up @@ -111,26 +110,6 @@ impl ClientBuilder {
}
}

/// Gets the current token used for the [`Http`] client.
#[must_use]
pub fn get_token(&self) -> &str {
self.http.token()
}

/// Sets the application id.
pub fn application_id(self, application_id: ApplicationId) -> Self {
self.http.set_application_id(application_id);

self
}

/// Gets the application ID, if already initialized. See [`Self::application_id`] for more
/// info.
#[must_use]
pub fn get_application_id(&self) -> Option<ApplicationId> {
self.http.application_id()
}

/// Sets the global data type that can be accessed from [`Context::data`].
pub fn data<D: std::any::Any + Send + Sync>(mut self, data: Arc<D>) -> Self {
self.data = Some(data);
Expand Down

0 comments on commit 4f427fc

Please sign in to comment.