diff options
Diffstat (limited to 'src/modules/commands/admins/config.rs')
| -rw-r--r-- | src/modules/commands/admins/config.rs | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/src/modules/commands/admins/config.rs b/src/modules/commands/admins/config.rs index a26fc3d..43e2215 100644 --- a/src/modules/commands/admins/config.rs +++ b/src/modules/commands/admins/config.rs @@ -505,73 +505,73 @@ impl Command for ConfigWelcome { } } -pub struct ConfigGoodbye; -impl Command for ConfigGoodbye { - fn options(&self) -> Arc<CommandOptions> { - let default = CommandOptions::default(); - let options = CommandOptions { - // desc: Some("Change welcome message settings.\nOption is one of enable, disable, channel, message, type and the respective values should be none, none, channel_resolvable, desired message.\nType designates if the message is plain or embed. Anything other than embed will result in plain.".to_string()), - desc: Some("People leaving you ? At least make it cool and custom.\n\nOptions:\n`enable` - none.\n`disable` - none.\n`channel` - `channel_resolvable` (Mentionable).\n`message` - Your desired welcome message.\n`type` - `plain` or `embed`.".to_string()), - usage: Some("<option> <value>".to_string()), - example: Some("message {user} has left {guild}...".to_string()), - min_args: Some(1), - required_permissions: Permissions::MANAGE_GUILD, - ..default - }; - Arc::new(options) - } +// pub struct ConfigGoodbye; +// impl Command for ConfigGoodbye { +// fn options(&self) -> Arc<CommandOptions> { +// let default = CommandOptions::default(); +// let options = CommandOptions { +// // desc: Some("Change welcome message settings.\nOption is one of enable, disable, channel, message, type and the respective values should be none, none, channel_resolvable, desired message.\nType designates if the message is plain or embed. Anything other than embed will result in plain.".to_string()), +// desc: Some("People leaving you ? At least make it cool and custom.\n\nOptions:\n`enable` - none.\n`disable` - none.\n`channel` - `channel_resolvable` (Mentionable).\n`message` - Your desired welcome message.\n`type` - `plain` or `embed`.".to_string()), +// usage: Some("<option> <value>".to_string()), +// example: Some("message {user} has left {guild}...".to_string()), +// min_args: Some(1), +// required_permissions: Permissions::MANAGE_GUILD, +// ..default +// }; +// Arc::new(options) +// } - fn execute(&self, _: &mut Context, message: &Message, mut args: Args) -> Result<(), CommandError> { - if let Some(guild_id) = message.guild_id { - let mut guild_data = db.get_guild(guild_id.0 as i64)?; - let op = args.single::<String>().unwrap_or(String::new()); - let mut val = args.rest().to_string(); - match op.to_lowercase().as_str() { - "enable" => { - guild_data.welcome = true; - }, - "disable" => { - guild_data.welcome = false; - }, - "channel" => { - match parse_channel(val.to_string(), guild_id) { - Some((channel_id, channel)) => { - guild_data.welcome_channel = channel_id.0 as i64; - val = format!("{} ({})", channel.name, channel_id.0); - }, - None => { - message.channel_id.say("I couldn't find that channel.")?; - return Ok(()) - }, - } - }, - "message" => { - guild_data.welcome_message = val.to_string(); - }, - "type" => { - guild_data.welcome_type = val.to_string(); - }, - _ => { - message.channel_id.say("I didn't understand that option. Valid options are: `enable`, `disable`, `channel`, `message`, `type`. For more information see `help config goodbye`")?; - return Ok(()) - }, - } - let guild = db.update_guild(guild_id.0 as i64, guild_data)?; - message.channel_id.send_message(|m| m - .embed(|e| e - .title("Goodbye Configuration Summary") - .colour(*colours::MAIN) - .description(format!("**Operation:** {}\n**Value:** {}", - op, - if val.is_empty() { guild.welcome.to_string() } else { val }, - )) - ))?; - } else { - failed!(GUILDID_FAIL); - } - Ok(()) - } -} +// fn execute(&self, _: &mut Context, message: &Message, mut args: Args) -> Result<(), CommandError> { +// if let Some(guild_id) = message.guild_id { +// let mut guild_data = db.get_guild(guild_id.0 as i64)?; +// let op = args.single::<String>().unwrap_or(String::new()); +// let mut val = args.rest().to_string(); +// match op.to_lowercase().as_str() { +// "enable" => { +// guild_data.welcome = true; +// }, +// "disable" => { +// guild_data.welcome = false; +// }, +// "channel" => { +// match parse_channel(val.to_string(), guild_id) { +// Some((channel_id, channel)) => { +// guild_data.welcome_channel = channel_id.0 as i64; +// val = format!("{} ({})", channel.name, channel_id.0); +// }, +// None => { +// message.channel_id.say("I couldn't find that channel.")?; +// return Ok(()) +// }, +// } +// }, +// "message" => { +// guild_data.welcome_message = val.to_string(); +// }, +// "type" => { +// guild_data.welcome_type = val.to_string(); +// }, +// _ => { +// message.channel_id.say("I didn't understand that option. Valid options are: `enable`, `disable`, `channel`, `message`, `type`. For more information see `help config goodbye`")?; +// return Ok(()) +// }, +// } +// let guild = db.update_guild(guild_id.0 as i64, guild_data)?; +// message.channel_id.send_message(|m| m +// .embed(|e| e +// .title("Goodbye Configuration Summary") +// .colour(*colours::MAIN) +// .description(format!("**Operation:** {}\n**Value:** {}", +// op, +// if val.is_empty() { guild.welcome.to_string() } else { val }, +// )) +// ))?; +// } else { +// failed!(GUILDID_FAIL); +// } +// Ok(()) +// } +// } pub struct ConfigIntroduction; impl Command for ConfigIntroduction { |