diff --git a/src/main.rs b/src/main.rs index 60316a3..c5b3b7e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -110,6 +110,20 @@ async fn main() -> anyhow::Result<()> { format!("{:#?}", channel_users).replace("\n", "\r\n"), )?; } + } else if let Some(mut user) = message.strip_prefix("!unban ") { + user = user.trim(); + if !user.is_empty() { + if let Some(users) = channel_users.get_mut(channel) { + if let Some(status) = users.get_mut(user) { + *status = Status::TimeoutCount(0); + + let mode = + Mode::Minus(ChannelMode::Ban, Some(format!("{}!*@*", user))); + client.send_mode(channel, &[mode])?; + client.send_privmsg(channel, format!("Unbanned {}", user))?; + } + } + } } let users = unwrap_or_continue!(channel_users.get_mut(channel)); let user = unwrap_or_continue!(users.get_mut(nick));