Implement roles management (#18)

Fix formatting

Implement `roles` management

Add a 'roles' mod and DB
This commit is contained in:
Natsu Kagami 2020-03-27 21:22:15 +00:00
parent 99c7888dfb
commit 5dd26d7474
4 changed files with 250 additions and 1 deletions

View file

@ -8,6 +8,9 @@ use youmubot_db::{GuildMap, DB};
/// A list of SoftBans for all servers.
pub type SoftBans = DB<GuildMap<ServerSoftBans>>;
/// A list of assignable roles for all servers.
pub type Roles = DB<GuildMap<HashMap<RoleId, Role>>>;
/// For the admin commands:
/// - Each server might have a `soft ban` role implemented.
/// - We allow periodical `soft ban` applications.
@ -34,3 +37,10 @@ pub struct ImplementedSoftBans {
/// List of all to-unban people.
pub periodical_bans: HashMap<UserId, DateTime<Utc>>,
}
/// Role represents an assignable role.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Role {
pub id: RoleId,
pub description: String,
}