1use serde::{Deserialize, Serialize};
2
3use crate::{attachment::Attachment, user::User};
4
5bitflags::bitflags! {
6 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
8 pub struct BotFlags: u64 {
9 const Verified = 1;
10 const Official = 2;
11 }
12}
13crate::impl_serde_bitflags!(BotFlags);
14
15#[derive(Deserialize, Debug, Clone)]
17pub struct PublicBot {
18 #[serde(rename = "_id")]
20 pub id: String,
21 pub username: String,
23 pub avatar: Option<Attachment>,
25 pub description: Option<String>,
27}
28
29#[derive(Deserialize, Debug, Clone)]
31pub struct Bot {
32 #[serde(rename = "_id")]
36 pub id: String,
37 pub owner: String,
39 pub token: String,
41 pub public: bool,
44
45 #[serde(default)]
47 pub analytics: bool,
48 #[serde(default)]
50 pub discoverable: bool,
51 pub interactions_url: Option<String>,
53 pub terms_of_service_url: Option<String>,
55 pub privacy_policy_url: Option<String>,
57
58 pub flags: Option<BotFlags>,
60}
61
62#[derive(Serialize, Deserialize, Default, Debug, Clone)]
64pub struct PartialBot {
65 #[serde(rename = "_id")]
69 pub id: Option<String>,
70 pub owner: Option<String>,
72 pub token: Option<String>,
74 pub public: Option<bool>,
77
78 pub analytics: Option<bool>,
80 pub discoverable: Option<bool>,
82 pub interactions_url: Option<String>,
84 pub terms_of_service_url: Option<String>,
86 pub privacy_policy_url: Option<String>,
88
89 pub flags: Option<BotFlags>,
91}
92
93#[derive(Deserialize, Debug, Clone)]
97pub struct OwnedBot {
98 pub bot: Bot,
100 pub user: User,
102}
103
104#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
106pub enum FieldsBot {
107 Token,
108 InteractionsURL,
109}
110
111#[derive(Deserialize, Debug, Clone)]
115pub struct OwnedBots {
116 pub bots: Vec<Bot>,
118 pub users: Vec<User>,
120}