Removing null bytes from incoming Twitch messages

This commit is contained in:
Xithrius 2023-03-09 19:58:11 -08:00
parent 5f970df742
commit c19efeaaeb
No known key found for this signature in database
GPG Key ID: A867F27CC80B28C1

View File

@ -142,9 +142,15 @@ async fn handle_message_command(
retrieve_user_badges(&mut name, &message);
}
tx.send(DataBuilder::user(name.to_string(), msg.to_string()))
.await
.unwrap();
// An attempt to remove null bytes from the message.
let cleaned_message = msg.trim_matches(char::from(0));
tx.send(DataBuilder::user(
name.to_string(),
cleaned_message.to_string(),
))
.await
.unwrap();
debug!("Message received from twitch: {} - {}", name, msg);
}