Unban users when they join back for real
This commit is contained in:
parent
f6a03a792f
commit
70f9b42d1b
13
src/main.rs
13
src/main.rs
|
@ -59,6 +59,19 @@ async fn main() -> anyhow::Result<()> {
|
|||
match message.command {
|
||||
Command::JOIN(ref channel, _, _) => {
|
||||
let users = unwrap_or_continue!(channel_users.get_mut(channel));
|
||||
for (user, status) in users.iter_mut() {
|
||||
if nick.starts_with(user) {
|
||||
// They're joining back for real, unban them
|
||||
*status = match status {
|
||||
Status::Banned => Status::TimeoutCount(0),
|
||||
_ => *status,
|
||||
};
|
||||
|
||||
let mode = Mode::Minus(ChannelMode::Ban, Some(format!("{}!*@*", user)));
|
||||
client.send_mode(channel, &[mode])?;
|
||||
client.send_privmsg(nick, "You're unbanned, welcome back!")?;
|
||||
}
|
||||
}
|
||||
if !users.contains_key(nick) {
|
||||
users.insert(nick.to_string(), Status::TimeoutCount(0));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue