remove unneeded dotenv()

This commit is contained in:
notohh 2024-07-02 18:16:12 -04:00
parent f7582596b6
commit f712b59df1
Signed by: notohh
GPG key ID: BD47506D475EE86D
5 changed files with 5 additions and 10 deletions

View file

@ -77,14 +77,12 @@ pub enum Size {
}
pub async fn lastfm_command(m: &PrivmsgMessage, c: &TwitchClient) -> Result<(), Box<dyn Error>> {
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();

View file

@ -9,7 +9,6 @@ pub async fn logs_command(
c: &TwitchClient,
a: &[&str],
) -> Result<(), Box<dyn Error>> {
dotenv().ok();
let twitch_client = c.twitch_client.clone();
if let Some(_args) = a.first() {

View file

@ -18,8 +18,6 @@ struct UserData {
}
pub async fn massping_command(m: &PrivmsgMessage, c: &TwitchClient) -> Result<(), Box<dyn Error>> {
dotenv().ok();
let base_url =
"https://api.twitch.tv/helix/chat/chatters?broadcaster_id=69768189&moderator_id=69768189";

View file

@ -32,8 +32,6 @@ pub async fn get_user_command(
c: &TwitchClient,
a: &[&str],
) -> Result<(), Box<dyn Error>> {
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();

View file

@ -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()) {