Compare commits

...

2 commits

Author SHA1 Message Date
c3f297deaa
flake.lock: update 2024-07-17 21:38:39 -04:00
79754392bc
add broadcaster check 2024-07-17 21:38:14 -04:00
2 changed files with 25 additions and 24 deletions

View file

@ -6,11 +6,11 @@
"rust-analyzer-src": "rust-analyzer-src" "rust-analyzer-src": "rust-analyzer-src"
}, },
"locked": { "locked": {
"lastModified": 1717223092, "lastModified": 1719815435,
"narHash": "sha256-ih8NPk3Jn5EAILOGQZ+KS5NLmu6QmwohJX+36MaTAQE=", "narHash": "sha256-K2xFp142onP35jcx7li10xUxNVEVRWjAdY8DSuR7Naw=",
"owner": "nix-community", "owner": "nix-community",
"repo": "fenix", "repo": "fenix",
"rev": "9a025daf6799e3af80b677f0af57ef76432c3fcf", "rev": "ebfe2c639111d7e82972a12711206afaeeda2450",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -59,11 +59,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1716948383, "lastModified": 1719506693,
"narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=", "narHash": "sha256-C8e9S7RzshSdHB7L+v9I51af1gDM5unhJ2xO1ywxNH8=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "ad57eef4ef0659193044870c731987a6df5cf56b", "rev": "b2852eb9365c6de48ffb0dc2c9562591f652242a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -75,27 +75,27 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1718811006, "lastModified": 1720386169,
"narHash": "sha256-0Y8IrGhRmBmT7HHXlxxepg2t8j1X90++qRN3lukGaIk=", "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "03d771e513ce90147b65fe922d87d3a0356fc125", "rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-23.11", "ref": "nixos-24.05",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1719379843, "lastModified": 1721116560,
"narHash": "sha256-u+D+IOAMMl70+CJ9NKB+RMrASjInuIWMHzjLWQjPZ6c=", "narHash": "sha256-++TYlGMAJM1Q+0nMVaWBSEvEUjRs7ZGiNQOpqbQApCU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b3f3c1b13fb08f3828442ee86630362e81136bbc", "rev": "9355fa86e6f27422963132c2c9aeedb0fb963d93",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -129,11 +129,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1719259945, "lastModified": 1721042469,
"narHash": "sha256-F1h+XIsGKT9TkGO3omxDLEb/9jOOsI6NnzsXFsZhry4=", "narHash": "sha256-6FPUl7HVtvRHCCBQne7Ylp4p+dpP3P/OYuzjztZ4s70=",
"owner": "cachix", "owner": "cachix",
"repo": "pre-commit-hooks.nix", "repo": "pre-commit-hooks.nix",
"rev": "0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07", "rev": "f451c19376071a90d8c58ab1a953c6e9840527fd",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -153,11 +153,11 @@
"rust-analyzer-src": { "rust-analyzer-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1717169693, "lastModified": 1719760370,
"narHash": "sha256-qBruki5NHrSqIw5ulxtwFmVsb6W/aOKOMjsCJjfalA4=", "narHash": "sha256-fsxAuW6RxKZYjAP3biUC6C4vaYFhDfWv8lp1Tmx3ZCY=",
"owner": "rust-lang", "owner": "rust-lang",
"repo": "rust-analyzer", "repo": "rust-analyzer",
"rev": "d6d735e6f20ef78b16a79886fe28bd69cf059504", "rev": "ea7fdada6a0940b239ddbde2048a4d7dac1efe1e",
"type": "github" "type": "github"
}, },
"original": { "original": {

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));