From f712b59df10e7e6340134276df39a4e1ed31ab31 Mon Sep 17 00:00:00 2001 From: notohh Date: Tue, 2 Jul 2024 18:16:12 -0400 Subject: [PATCH] remove unneeded dotenv() --- src/commands/lastfm.rs | 6 ++---- src/commands/logs.rs | 1 - src/commands/massping.rs | 2 -- src/commands/user.rs | 2 -- src/main.rs | 4 +++- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/commands/lastfm.rs b/src/commands/lastfm.rs index 2659eab..210bf7e 100644 --- a/src/commands/lastfm.rs +++ b/src/commands/lastfm.rs @@ -77,14 +77,12 @@ pub enum Size { } pub async fn lastfm_command(m: &PrivmsgMessage, c: &TwitchClient) -> Result<(), Box> { - dotenv().ok(); - let lastfm_api_key = env::var("LASTFM_API_KEY").expect("Failed to load lastfm api key."); let user = "notoh"; let recent_tracks_url = format!( - "http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&user={}&api_key={}&format=json&nowplaying=true", user, - lastfm_api_key + "http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&user={}&api_key={}&format=json&nowplaying=true", + user, lastfm_api_key ); let client = reqwest::Client::new(); diff --git a/src/commands/logs.rs b/src/commands/logs.rs index 4f497b2..4f64e46 100644 --- a/src/commands/logs.rs +++ b/src/commands/logs.rs @@ -9,7 +9,6 @@ pub async fn logs_command( c: &TwitchClient, a: &[&str], ) -> Result<(), Box> { - dotenv().ok(); let twitch_client = c.twitch_client.clone(); if let Some(_args) = a.first() { diff --git a/src/commands/massping.rs b/src/commands/massping.rs index 7398dd8..b3da201 100644 --- a/src/commands/massping.rs +++ b/src/commands/massping.rs @@ -18,8 +18,6 @@ struct UserData { } pub async fn massping_command(m: &PrivmsgMessage, c: &TwitchClient) -> Result<(), Box> { - dotenv().ok(); - let base_url = "https://api.twitch.tv/helix/chat/chatters?broadcaster_id=69768189&moderator_id=69768189"; diff --git a/src/commands/user.rs b/src/commands/user.rs index 87ac1fe..1371ad0 100644 --- a/src/commands/user.rs +++ b/src/commands/user.rs @@ -32,8 +32,6 @@ pub async fn get_user_command( c: &TwitchClient, a: &[&str], ) -> Result<(), Box> { - dotenv().ok(); - let base_url = format!("https://api.twitch.tv/helix/users?login={}", a.join(" ")); let helix_client = HelixClient::new(&base_url).client; let twitch_client = c.twitch_client.clone(); diff --git a/src/main.rs b/src/main.rs index 1a1d595..6387e04 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,7 @@ use commands::logs::logs_command; use commands::massping::massping_command; use commands::ping::ping_command; use commands::user::get_user_command; +use dotenv::dotenv; use client::client; use twitch_irc::message::ServerMessage; @@ -20,10 +21,11 @@ extern crate pretty_env_logger; #[tokio::main] pub async fn main() { + dotenv().ok(); pretty_env_logger::try_init().expect("Failed to load logger"); let mut client = client(); - let initial_channels = vec!["notnotoh", "notohh", "daph", "fembotfriday"]; + let initial_channels = vec!["notnotoh", "notohh", "daph", "fembotfriday", "miwo", "elis"]; for &channel in &initial_channels { match client.twitch_client.join(channel.to_string()) {