add broadcaster check

This commit is contained in:
notohh 2024-07-17 21:38:14 -04:00
parent f712b59df1
commit 79754392bc
Signed by: notohh
GPG key ID: BD47506D475EE86D

View file

@ -39,6 +39,7 @@ pub async fn main() {
match message { match message {
ServerMessage::Privmsg(m) => { ServerMessage::Privmsg(m) => {
let is_moderator = m.badges.iter().any(|badge| badge.name == "moderator"); let is_moderator = m.badges.iter().any(|badge| badge.name == "moderator");
let is_broadcaster = m.badges.iter().any(|badge| badge.name == "broadcaster");
let channel = m.channel_login.clone(); let channel = m.channel_login.clone();
let sender = m.sender.name.clone(); let sender = m.sender.name.clone();
let contents = m.message_text.clone(); let contents = m.message_text.clone();
@ -53,7 +54,7 @@ pub async fn main() {
match command { match command {
"ping" => { "ping" => {
if is_moderator { if is_moderator || is_broadcaster {
ping_command(&m, &client).await.unwrap_or_default(); ping_command(&m, &client).await.unwrap_or_default();
} else { } else {
sleep(Duration::from_secs(1)); sleep(Duration::from_secs(1));
@ -61,7 +62,7 @@ pub async fn main() {
} }
} }
"song" => { "song" => {
if is_moderator { if is_moderator || is_broadcaster {
lastfm_command(&m, &client).await.unwrap_or_default(); lastfm_command(&m, &client).await.unwrap_or_default();
} else { } else {
sleep(Duration::from_secs(1)); sleep(Duration::from_secs(1));
@ -69,7 +70,7 @@ pub async fn main() {
} }
} }
"user" => { "user" => {
if is_moderator { if is_moderator || is_broadcaster {
get_user_command(&m, &client, &arguments) get_user_command(&m, &client, &arguments)
.await .await
.unwrap_or_default(); .unwrap_or_default();
@ -81,7 +82,7 @@ pub async fn main() {
} }
} }
"logs" => { "logs" => {
if is_moderator { if is_moderator || is_broadcaster {
logs_command(&m, &client, &arguments) logs_command(&m, &client, &arguments)
.await .await
.unwrap_or_default(); .unwrap_or_default();
@ -93,7 +94,7 @@ pub async fn main() {
} }
} }
"massping" => { "massping" => {
if is_moderator { if is_moderator || is_broadcaster {
massping_command(&m, &client).await.unwrap_or_default(); massping_command(&m, &client).await.unwrap_or_default();
} else { } else {
sleep(Duration::from_secs(1)); sleep(Duration::from_secs(1));