Compare commits
No commits in common. "a6291ba380a53d497096cb3477ae70f6dac0131a" and "1b658cbe2ae72036b3e23637fc26f9db80ed98cc" have entirely different histories.
a6291ba380
...
1b658cbe2a
7 changed files with 21 additions and 8 deletions
13
flake.nix
13
flake.nix
|
@ -64,11 +64,14 @@
|
||||||
openssl
|
openssl
|
||||||
pkg-config
|
pkg-config
|
||||||
tokio-console
|
tokio-console
|
||||||
cargo
|
(fenix.packages.${system}.complete.withComponents [
|
||||||
rustc
|
"cargo"
|
||||||
clippy
|
"clippy"
|
||||||
rustfmt
|
"rust-src"
|
||||||
rust-analyzer
|
"rustc"
|
||||||
|
"rustfmt"
|
||||||
|
"rust-analyzer"
|
||||||
|
])
|
||||||
];
|
];
|
||||||
RUST_BACKTRACE = 1;
|
RUST_BACKTRACE = 1;
|
||||||
RUST_LOG = "info";
|
RUST_LOG = "info";
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
use twitch_irc::login::StaticLoginCredentials;
|
use dotenv::dotenv;
|
||||||
use twitch_irc::message::ServerMessage;
|
use twitch_irc::{
|
||||||
use twitch_irc::{ClientConfig, SecureTCPTransport, TwitchIRCClient};
|
login::StaticLoginCredentials, message::ServerMessage, ClientConfig, SecureTCPTransport,
|
||||||
|
TwitchIRCClient,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct TwitchClient {
|
pub struct TwitchClient {
|
||||||
pub incoming_messages: tokio::sync::mpsc::UnboundedReceiver<ServerMessage>,
|
pub incoming_messages: tokio::sync::mpsc::UnboundedReceiver<ServerMessage>,
|
||||||
|
@ -10,6 +12,7 @@ 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");
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
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;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use dotenv::dotenv;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use twitch_irc::message::PrivmsgMessage;
|
use twitch_irc::message::PrivmsgMessage;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use dotenv::dotenv;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use twitch_irc::message::PrivmsgMessage;
|
use twitch_irc::message::PrivmsgMessage;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ 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>> {
|
||||||
|
@ -21,6 +23,7 @@ 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;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use dotenv::dotenv;
|
||||||
use twitch_irc::message::PrivmsgMessage;
|
use twitch_irc::message::PrivmsgMessage;
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
Loading…
Reference in a new issue