Compare commits

...

2 commits

Author SHA1 Message Date
a6291ba380
flake.nix: remove fenix packages 2024-12-14 12:07:29 -05:00
ef980e8fd1
chore: code cleanup 2024-12-14 12:07:13 -05:00
7 changed files with 8 additions and 21 deletions

View file

@ -64,14 +64,11 @@
openssl openssl
pkg-config pkg-config
tokio-console tokio-console
(fenix.packages.${system}.complete.withComponents [ cargo
"cargo" rustc
"clippy" clippy
"rust-src" rustfmt
"rustc" rust-analyzer
"rustfmt"
"rust-analyzer"
])
]; ];
RUST_BACKTRACE = 1; RUST_BACKTRACE = 1;
RUST_LOG = "info"; RUST_LOG = "info";

View file

@ -1,10 +1,8 @@
use std::env; use std::env;
use dotenv::dotenv; use twitch_irc::login::StaticLoginCredentials;
use twitch_irc::{ use twitch_irc::message::ServerMessage;
login::StaticLoginCredentials, message::ServerMessage, ClientConfig, SecureTCPTransport, use twitch_irc::{ClientConfig, SecureTCPTransport, TwitchIRCClient};
TwitchIRCClient,
};
pub struct TwitchClient { pub struct TwitchClient {
pub incoming_messages: tokio::sync::mpsc::UnboundedReceiver<ServerMessage>, pub incoming_messages: tokio::sync::mpsc::UnboundedReceiver<ServerMessage>,
@ -12,7 +10,6 @@ pub struct TwitchClient {
} }
pub fn client_config() -> ClientConfig<StaticLoginCredentials> { pub fn client_config() -> ClientConfig<StaticLoginCredentials> {
dotenv().ok();
let twitch_id = env::var("TWITCH_ID").expect("Failed to load twitch id"); let twitch_id = env::var("TWITCH_ID").expect("Failed to load twitch id");
let twitch_oauth = env::var("TWITCH_OAUTH").expect("Failed to load oauth"); let twitch_oauth = env::var("TWITCH_OAUTH").expect("Failed to load oauth");

View file

@ -1,5 +1,4 @@
use crate::client::TwitchClient; use crate::client::TwitchClient;
use dotenv::dotenv;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::env; use std::env;
use std::error::Error; use std::error::Error;

View file

@ -1,4 +1,3 @@
use dotenv::dotenv;
use std::error::Error; use std::error::Error;
use twitch_irc::message::PrivmsgMessage; use twitch_irc::message::PrivmsgMessage;

View file

@ -1,4 +1,3 @@
use dotenv::dotenv;
use std::error::Error; use std::error::Error;
use twitch_irc::message::PrivmsgMessage; use twitch_irc::message::PrivmsgMessage;

View file

@ -2,8 +2,6 @@ use crate::client::TwitchClient;
use sysinfo::System; use sysinfo::System;
use std::error::Error; use std::error::Error;
use std::thread::sleep;
use std::time::Duration;
use twitch_irc::message::PrivmsgMessage; use twitch_irc::message::PrivmsgMessage;
pub async fn ping_command(m: &PrivmsgMessage, c: &TwitchClient) -> Result<(), Box<dyn Error>> { pub async fn ping_command(m: &PrivmsgMessage, c: &TwitchClient) -> Result<(), Box<dyn Error>> {
@ -23,7 +21,6 @@ pub async fn ping_command(m: &PrivmsgMessage, c: &TwitchClient) -> Result<(), Bo
let uptime_hours = uptime_seconds / (60 * 60); let uptime_hours = uptime_seconds / (60 * 60);
let uptime_days = uptime_hours / 24; let uptime_days = uptime_hours / 24;
let remaining_seconds = uptime_seconds % 60;
let remaining_minutes = uptime_minutes % 60; let remaining_minutes = uptime_minutes % 60;
let remaining_hours = uptime_hours % 24; let remaining_hours = uptime_hours % 24;

View file

@ -1,4 +1,3 @@
use dotenv::dotenv;
use twitch_irc::message::PrivmsgMessage; use twitch_irc::message::PrivmsgMessage;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};