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
use std::collections::HashMap;

use crate::internal::prelude::*;

/// A builder to specify the fields to edit in a [`GuildWidget`].
///
/// [`GuildWidget`]: crate::model::guild::GuildWidget
#[derive(Clone, Debug, Default)]
pub struct EditGuildWidget(pub HashMap<&'static str, Value>);

impl EditGuildWidget {
    /// Whether the widget is enabled or not.
    pub fn enabled(&mut self, enabled: bool) -> &mut Self {
        self.0.insert("enabled", Value::from(enabled));

        self
    }

    /// The server description shown in the welcome screen.
    pub fn channel_id(&mut self, id: u64) -> &mut Self {
        self.0.insert("channel_id", Value::from(id.to_string()));

        self
    }
}