remove unneeded dotenv()
This commit is contained in:
parent
f7582596b6
commit
f712b59df1
5 changed files with 5 additions and 10 deletions
|
@ -77,14 +77,12 @@ pub enum Size {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn lastfm_command(m: &PrivmsgMessage, c: &TwitchClient) -> Result<(), Box<dyn Error>> {
|
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 lastfm_api_key = env::var("LASTFM_API_KEY").expect("Failed to load lastfm api key.");
|
||||||
let user = "notoh";
|
let user = "notoh";
|
||||||
|
|
||||||
let recent_tracks_url = format!(
|
let recent_tracks_url = format!(
|
||||||
"http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&user={}&api_key={}&format=json&nowplaying=true", user,
|
"http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&user={}&api_key={}&format=json&nowplaying=true",
|
||||||
lastfm_api_key
|
user, lastfm_api_key
|
||||||
);
|
);
|
||||||
|
|
||||||
let client = reqwest::Client::new();
|
let client = reqwest::Client::new();
|
||||||
|
|
|
@ -9,7 +9,6 @@ pub async fn logs_command(
|
||||||
c: &TwitchClient,
|
c: &TwitchClient,
|
||||||
a: &[&str],
|
a: &[&str],
|
||||||
) -> Result<(), Box<dyn Error>> {
|
) -> Result<(), Box<dyn Error>> {
|
||||||
dotenv().ok();
|
|
||||||
let twitch_client = c.twitch_client.clone();
|
let twitch_client = c.twitch_client.clone();
|
||||||
|
|
||||||
if let Some(_args) = a.first() {
|
if let Some(_args) = a.first() {
|
||||||
|
|
|
@ -18,8 +18,6 @@ struct UserData {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn massping_command(m: &PrivmsgMessage, c: &TwitchClient) -> Result<(), Box<dyn Error>> {
|
pub async fn massping_command(m: &PrivmsgMessage, c: &TwitchClient) -> Result<(), Box<dyn Error>> {
|
||||||
dotenv().ok();
|
|
||||||
|
|
||||||
let base_url =
|
let base_url =
|
||||||
"https://api.twitch.tv/helix/chat/chatters?broadcaster_id=69768189&moderator_id=69768189";
|
"https://api.twitch.tv/helix/chat/chatters?broadcaster_id=69768189&moderator_id=69768189";
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,6 @@ pub async fn get_user_command(
|
||||||
c: &TwitchClient,
|
c: &TwitchClient,
|
||||||
a: &[&str],
|
a: &[&str],
|
||||||
) -> Result<(), Box<dyn Error>> {
|
) -> Result<(), Box<dyn Error>> {
|
||||||
dotenv().ok();
|
|
||||||
|
|
||||||
let base_url = format!("https://api.twitch.tv/helix/users?login={}", a.join(" "));
|
let base_url = format!("https://api.twitch.tv/helix/users?login={}", a.join(" "));
|
||||||
let helix_client = HelixClient::new(&base_url).client;
|
let helix_client = HelixClient::new(&base_url).client;
|
||||||
let twitch_client = c.twitch_client.clone();
|
let twitch_client = c.twitch_client.clone();
|
||||||
|
|
|
@ -6,6 +6,7 @@ use commands::logs::logs_command;
|
||||||
use commands::massping::massping_command;
|
use commands::massping::massping_command;
|
||||||
use commands::ping::ping_command;
|
use commands::ping::ping_command;
|
||||||
use commands::user::get_user_command;
|
use commands::user::get_user_command;
|
||||||
|
use dotenv::dotenv;
|
||||||
|
|
||||||
use client::client;
|
use client::client;
|
||||||
use twitch_irc::message::ServerMessage;
|
use twitch_irc::message::ServerMessage;
|
||||||
|
@ -20,10 +21,11 @@ extern crate pretty_env_logger;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
pub async fn main() {
|
pub async fn main() {
|
||||||
|
dotenv().ok();
|
||||||
pretty_env_logger::try_init().expect("Failed to load logger");
|
pretty_env_logger::try_init().expect("Failed to load logger");
|
||||||
let mut client = client();
|
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 {
|
for &channel in &initial_channels {
|
||||||
match client.twitch_client.join(channel.to_string()) {
|
match client.twitch_client.join(channel.to_string()) {
|
||||||
|
|
Loading…
Reference in a new issue