2023-10-22 08:35:09 -04:00
|
|
|
use twitch_irc::login::StaticLoginCredentials;
|
|
|
|
use twitch_irc::ClientConfig;
|
|
|
|
use twitch_irc::SecureTCPTransport;
|
|
|
|
use twitch_irc::TwitchIRCClient;
|
2023-11-28 01:49:51 -05:00
|
|
|
use std::env;
|
2023-10-22 08:35:09 -04:00
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
pub async fn main() {
|
2023-11-28 01:49:51 -05:00
|
|
|
let login_name = "modulatingforcebot".to_owned();
|
|
|
|
let oauth_token = env::var("access_token").unwrap().to_owned();
|
2023-10-22 08:35:09 -04:00
|
|
|
|
|
|
|
let config = ClientConfig::new_simple(
|
|
|
|
StaticLoginCredentials::new(login_name, Some(oauth_token))
|
|
|
|
);
|
|
|
|
let (mut incoming_messages, client) =
|
|
|
|
TwitchIRCClient::<SecureTCPTransport, StaticLoginCredentials>::new(config);
|
|
|
|
|
|
|
|
let join_handle = tokio::spawn(async move {
|
|
|
|
while let Some(message) = incoming_messages.recv().await {
|
|
|
|
println!("Received message: {:?}", message);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2023-11-28 01:49:51 -05:00
|
|
|
client.join("modulatingforcebot".to_owned()).unwrap();
|
|
|
|
client.say("modulatingforcebot".to_owned(), "Connected!".to_owned()).await.unwrap();
|
2023-10-22 08:35:09 -04:00
|
|
|
|
|
|
|
join_handle.await.unwrap();
|
|
|
|
}
|