diff options
| author | Zeyla Hellyer <[email protected]> | 2018-01-10 20:37:57 -0800 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2018-01-10 20:37:57 -0800 |
| commit | b816ca9e35f6d4c2c4e0ed02d4b3c229df8f2787 (patch) | |
| tree | 02e6fd9d36ff3996403880da3c62f80f098114a3 /src/client | |
| parent | Simplify ShardManager creation (diff) | |
| download | serenity-b816ca9e35f6d4c2c4e0ed02d4b3c229df8f2787.tar.xz serenity-b816ca9e35f6d4c2c4e0ed02d4b3c229df8f2787.zip | |
Revert "Add `Client::user_id`"
This reverts commit 062ea86d5b0d9932207636d4a44a5357b079e79a.
This change had the unintended side-effect of making tests with the
Client impossible without hitting Discord's REST API for every test
(even worse, while unauthorized).
Knowing the user's ID on creation isn't _too_ important, and what was
being done with that knowledge can be deferred to connection start.
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/mod.rs | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/client/mod.rs b/src/client/mod.rs index 2e01104..1219793 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -39,7 +39,6 @@ pub use CACHE; use http; use internal::prelude::*; -use model::id::UserId; use parking_lot::Mutex; use self::bridge::gateway::{ShardManager, ShardManagerMonitor, ShardManagerOptions}; use std::sync::Arc; @@ -277,10 +276,6 @@ pub struct Client { pub threadpool: ThreadPool, /// The token in use by the client. pub token: Arc<Mutex<String>>, - /// The ID of the user for this client. - /// - /// This is retrieved when the client is created using the given token. - pub user_id: UserId, /// URI that the client's shards will use to connect to the gateway. /// /// This is likely not important for production usage and is, at best, used @@ -332,8 +327,6 @@ impl Client { }; http::set_token(&token); - let user_id = http::get_current_user()?.id; - let locked = Arc::new(Mutex::new(token)); let name = "serenity client".to_owned(); @@ -368,7 +361,6 @@ impl Client { shard_manager, shard_manager_worker, threadpool, - user_id, }) } @@ -807,8 +799,10 @@ impl Client { // This also acts as a form of check to ensure the token is correct. #[cfg(all(feature = "standard_framework", feature = "framework"))] { + let user = http::get_current_user()?; + if let Some(ref mut framework) = *self.framework.lock() { - framework.update_current_user(self.user_id); + framework.update_current_user(user.id); } } |