1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
use serde::{Deserialize, Serialize};
use crate::{attachment::Attachment, user::User};
bitflags::bitflags! {
    /// User badge bitfield
    #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct BotFlags: u64 {
        const Verified = 1;
        const Official = 2;
    }
}
crate::impl_serde_bitflags!(BotFlags);
/// Public bot
#[derive(Deserialize, Debug, Clone)]
pub struct PublicBot {
    /// Bot Id
    #[serde(rename = "_id")]
    pub id: String,
    /// Bot Username
    pub username: String,
    /// Profile Avatar
    pub avatar: Option<Attachment>,
    /// Profile Description
    pub description: Option<String>,
}
/// Representation of a bot on Revolt
#[derive(Deserialize, Debug, Clone)]
pub struct Bot {
    /// Bot Id
    ///
    /// This equals the associated bot user's id.
    #[serde(rename = "_id")]
    pub id: String,
    /// User Id of the bot owner
    pub owner: String,
    /// Token used to authenticate requests for this bot
    pub token: String,
    /// Whether the bot is public
    /// (may be invited by anyone)
    pub public: bool,
    /// Whether to enable analytics
    #[serde(default)]
    pub analytics: bool,
    /// Whether this bot should be publicly discoverable
    #[serde(default)]
    pub discoverable: bool,
    /// Reserved; URL for handling interactions
    pub interactions_url: Option<String>,
    /// URL for terms of service
    pub terms_of_service_url: Option<String>,
    /// URL for privacy policy
    pub privacy_policy_url: Option<String>,
    /// Enum of bot flags
    pub flags: Option<BotFlags>,
}
/// Partial representation of a bot on Revolt
#[derive(Serialize, Deserialize, Default, Debug, Clone)]
pub struct PartialBot {
    /// Bot Id
    ///
    /// This equals the associated bot user's id.
    #[serde(rename = "_id")]
    pub id: Option<String>,
    /// User Id of the bot owner
    pub owner: Option<String>,
    /// Token used to authenticate requests for this bot
    pub token: Option<String>,
    /// Whether the bot is public
    /// (may be invited by anyone)
    pub public: Option<bool>,
    /// Whether to enable analytics
    pub analytics: Option<bool>,
    /// Whether this bot should be publicly discoverable
    pub discoverable: Option<bool>,
    /// Reserved; URL for handling interactions
    pub interactions_url: Option<String>,
    /// URL for terms of service
    pub terms_of_service_url: Option<String>,
    /// URL for privacy policy
    pub privacy_policy_url: Option<String>,
    /// Enum of bot flags
    pub flags: Option<BotFlags>,
}
/// Owned bot.
///
/// Contains bot and user information.
#[derive(Deserialize, Debug, Clone)]
pub struct OwnedBot {
    /// Bot object
    pub bot: Bot,
    /// User object
    pub user: User,
}
/// Optional fields on bot object
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub enum FieldsBot {
    Token,
    InteractionsURL,
}
/// Owned bots.
///
/// Both lists are sorted by their IDs.
#[derive(Deserialize, Debug, Clone)]
pub struct OwnedBots {
    /// Bot objects
    pub bots: Vec<Bot>,
    /// User objects
    pub users: Vec<User>,
}