Add !unban command
This commit is contained in:
parent
4e8934903e
commit
0cd4fa9b39
14
src/main.rs
14
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));
|
||||
|
|
Loading…
Reference in a new issue