Remove logged_in from User
This commit is contained in:
parent
54944fbb0e
commit
11be031e98
|
@ -2,7 +2,6 @@ pub mod messages {
|
||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
use serde_json::to_string;
|
use serde_json::to_string;
|
||||||
|
|
||||||
|
|
||||||
use crate::api::types::{Message, PartialDiscordFileAttachment, User};
|
use crate::api::types::{Message, PartialDiscordFileAttachment, User};
|
||||||
use crate::limit::LimitedRequester;
|
use crate::limit::LimitedRequester;
|
||||||
|
|
||||||
|
@ -82,8 +81,6 @@ mod test {
|
||||||
limit::LimitedRequester,
|
limit::LimitedRequester,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn send_message() {
|
async fn send_message() {
|
||||||
let channel_id = "1104413094102290492".to_string();
|
let channel_id = "1104413094102290492".to_string();
|
||||||
|
@ -123,8 +120,7 @@ mod test {
|
||||||
let token = login_result.token;
|
let token = login_result.token;
|
||||||
let settings = login_result.settings;
|
let settings = login_result.settings;
|
||||||
let limits = instance.limits.clone();
|
let limits = instance.limits.clone();
|
||||||
let mut user =
|
let mut user = crate::api::types::User::new(&mut instance, token, limits, settings, None);
|
||||||
crate::api::types::User::new(true, &mut instance, token, limits, settings, None);
|
|
||||||
let response = user
|
let response = user
|
||||||
.send_message(&mut message, &channel_id, None)
|
.send_message(&mut message, &channel_id, None)
|
||||||
.await
|
.await
|
||||||
|
|
|
@ -4,8 +4,6 @@ https://discord.com/developers/docs .
|
||||||
I do not feel like re-documenting all of this, as everything is already perfectly explained there.
|
I do not feel like re-documenting all of this, as everything is already perfectly explained there.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{api::limits::Limits, instance::Instance};
|
use crate::{api::limits::Limits, instance::Instance};
|
||||||
|
@ -156,7 +154,6 @@ pub struct UserObject {
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct User<'a> {
|
pub struct User<'a> {
|
||||||
pub logged_in: bool,
|
|
||||||
pub belongs_to: &'a mut Instance,
|
pub belongs_to: &'a mut Instance,
|
||||||
token: String,
|
token: String,
|
||||||
pub limits: Limits,
|
pub limits: Limits,
|
||||||
|
@ -165,10 +162,6 @@ pub struct User<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> User<'a> {
|
impl<'a> User<'a> {
|
||||||
pub fn is_logged_in(&self) -> bool {
|
|
||||||
self.logged_in
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn belongs_to(&mut self) -> &mut Instance {
|
pub fn belongs_to(&mut self) -> &mut Instance {
|
||||||
self.belongs_to
|
self.belongs_to
|
||||||
}
|
}
|
||||||
|
@ -177,16 +170,11 @@ impl<'a> User<'a> {
|
||||||
self.token.clone()
|
self.token.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_logged_in(&mut self, bool: bool) {
|
|
||||||
self.logged_in = bool;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_token(&mut self, token: String) {
|
pub fn set_token(&mut self, token: String) {
|
||||||
self.token = token;
|
self.token = token;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
logged_in: bool,
|
|
||||||
belongs_to: &'a mut Instance,
|
belongs_to: &'a mut Instance,
|
||||||
token: String,
|
token: String,
|
||||||
limits: Limits,
|
limits: Limits,
|
||||||
|
@ -194,7 +182,6 @@ impl<'a> User<'a> {
|
||||||
object: Option<UserObject>,
|
object: Option<UserObject>,
|
||||||
) -> User<'a> {
|
) -> User<'a> {
|
||||||
User {
|
User {
|
||||||
logged_in,
|
|
||||||
belongs_to,
|
belongs_to,
|
||||||
token,
|
token,
|
||||||
limits,
|
limits,
|
||||||
|
|
Loading…
Reference in New Issue