feat: some cleanup in messages and added some handrails so folks wont add stupid combos
This commit is contained in:
parent
32292a3c0b
commit
5e7964ae26
1 changed files with 32 additions and 2 deletions
|
@ -61,6 +61,13 @@ pub mod edit {
|
|||
return "Please provide a valid role for ``Role Current``".to_string();
|
||||
};
|
||||
|
||||
if role_a == role_b {
|
||||
return "Roles A and B must be different".to_string();
|
||||
}
|
||||
|
||||
if (role_c == role_a)|| (role_c == role_b) {
|
||||
return "Role C cannot be same as A or B".to_string();
|
||||
}
|
||||
|
||||
let mut delete = false;
|
||||
|
||||
|
@ -86,8 +93,9 @@ pub mod edit {
|
|||
};
|
||||
let db = db_lock.read().await;
|
||||
|
||||
let server = command.guild_id.unwrap_or_default();
|
||||
let server_data = RoleAdder {
|
||||
server: command.guild_id.unwrap_or_default(),
|
||||
server,
|
||||
role_a,
|
||||
role_b,
|
||||
role_c,
|
||||
|
@ -101,7 +109,29 @@ pub mod edit {
|
|||
}
|
||||
}
|
||||
|
||||
"Added/Updated server info".to_string()
|
||||
|
||||
let mut role_a_name = String::new();
|
||||
let mut role_b_name = String::new();
|
||||
let mut role_c_name = String::new();
|
||||
|
||||
if let Ok(x) = server.roles(&ctx).await {
|
||||
if let Some(y) = x.get(&role_a){
|
||||
role_a_name = y.to_owned().name;
|
||||
}
|
||||
if let Some(y) = x.get(&role_b){
|
||||
role_b_name = y.to_owned().name;
|
||||
}
|
||||
if let Some(y) = x.get(&role_b){
|
||||
role_c_name = y.to_owned().name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if delete {
|
||||
format!("Removed {} + {} = {}", role_a_name, role_b_name, role_c_name)
|
||||
} else {
|
||||
format!("Added {} + {} = {}", role_a_name, role_b_name, role_c_name)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand {
|
||||
|
|
Loading…
Reference in a new issue