Remove logged_in from User

This commit is contained in:
bitfl0wer 2023-05-07 12:42:52 +02:00
parent 54944fbb0e
commit 11be031e98
No known key found for this signature in database
GPG Key ID: 84BBB60DF895ABF2
2 changed files with 1 additions and 18 deletions

View File

@ -2,7 +2,6 @@ pub mod messages {
use reqwest::Client;
use serde_json::to_string;
use crate::api::types::{Message, PartialDiscordFileAttachment, User};
use crate::limit::LimitedRequester;
@ -82,8 +81,6 @@ mod test {
limit::LimitedRequester,
};
#[tokio::test]
async fn send_message() {
let channel_id = "1104413094102290492".to_string();
@ -123,8 +120,7 @@ mod test {
let token = login_result.token;
let settings = login_result.settings;
let limits = instance.limits.clone();
let mut user =
crate::api::types::User::new(true, &mut instance, token, limits, settings, None);
let mut user = crate::api::types::User::new(&mut instance, token, limits, settings, None);
let response = user
.send_message(&mut message, &channel_id, None)
.await

View File

@ -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.
*/
use serde::{Deserialize, Serialize};
use crate::{api::limits::Limits, instance::Instance};
@ -156,7 +154,6 @@ pub struct UserObject {
#[derive(Debug)]
pub struct User<'a> {
pub logged_in: bool,
pub belongs_to: &'a mut Instance,
token: String,
pub limits: Limits,
@ -165,10 +162,6 @@ pub struct User<'a> {
}
impl<'a> User<'a> {
pub fn is_logged_in(&self) -> bool {
self.logged_in
}
pub fn belongs_to(&mut self) -> &mut Instance {
self.belongs_to
}
@ -177,16 +170,11 @@ impl<'a> User<'a> {
self.token.clone()
}
pub fn set_logged_in(&mut self, bool: bool) {
self.logged_in = bool;
}
pub fn set_token(&mut self, token: String) {
self.token = token;
}
pub fn new(
logged_in: bool,
belongs_to: &'a mut Instance,
token: String,
limits: Limits,
@ -194,7 +182,6 @@ impl<'a> User<'a> {
object: Option<UserObject>,
) -> User<'a> {
User {
logged_in,
belongs_to,
token,
limits,