init commit
This commit is contained in:
parent
619008acaf
commit
e91bfe2a89
6 changed files with 879 additions and 0 deletions
src
27
src/main.rs
Normal file
27
src/main.rs
Normal file
|
@ -0,0 +1,27 @@
|
|||
use twitch_irc::login::StaticLoginCredentials;
|
||||
use twitch_irc::ClientConfig;
|
||||
use twitch_irc::SecureTCPTransport;
|
||||
use twitch_irc::TwitchIRCClient;
|
||||
|
||||
#[tokio::main]
|
||||
pub async fn main() {
|
||||
let login_name = "daphbot".to_owned();
|
||||
let oauth_token = "".to_owned();
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
client.join("daph".to_owned()).unwrap();
|
||||
client.say("daph".to_owned(), "Connected!".to_owned()).await.unwrap();
|
||||
|
||||
join_handle.await.unwrap();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue