Fixed circe not joining with the correct mode, updated examples
This commit is contained in:
parent
e5022403e4
commit
afb1891fb6
|
@ -3,7 +3,7 @@ use async_circe::{commands::Command, Client, Config};
|
|||
#[tokio::main]
|
||||
async fn main() -> Result<(), tokio::io::Error> {
|
||||
let config = Config::new(
|
||||
&["#no-normies"],
|
||||
&["#main", "#no-normies"],
|
||||
"karx.xyz",
|
||||
Some("+B"),
|
||||
Some("async-circe"),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
host = "karx.xyz"
|
||||
port = 6697
|
||||
username = "async-circe"
|
||||
channels = ["#no-normies"]
|
||||
channels = ["#main", "#no-normies"]
|
||||
mode = "+B"
|
||||
|
|
|
@ -9,7 +9,7 @@ async fn main() -> Result<(), tokio::io::Error> {
|
|||
.init();
|
||||
|
||||
let config = Config::new(
|
||||
&["#no-normies"],
|
||||
&["#main", "#no-normies"],
|
||||
"karx.xyz",
|
||||
Some("+B"),
|
||||
Some("async-circe"),
|
||||
|
|
15
src/lib.rs
15
src/lib.rs
|
@ -4,7 +4,7 @@
|
|||
//! fn main() -> Result<(), tokio::io::Error> {
|
||||
//! let config = Default::default();
|
||||
//! let mut client = Client::new(config).await.unwrap();
|
||||
//! client.identify()?.await.unwrap();
|
||||
//! client.identify().await.unwrap();
|
||||
//!
|
||||
//! loop {
|
||||
//! if let Ok(ref command) = client.read().await {
|
||||
|
@ -162,7 +162,14 @@ impl Client {
|
|||
}
|
||||
|
||||
let config = self.config.clone();
|
||||
self.write_command(commands::Command::MODE(config.username, config.mode))
|
||||
let user = {
|
||||
if let Some(nick) = config.nickname {
|
||||
nick
|
||||
} else {
|
||||
config.username
|
||||
}
|
||||
};
|
||||
self.write_command(commands::Command::MODE(user, config.mode))
|
||||
.await?;
|
||||
for channel in &config.channels {
|
||||
self.write_command(commands::Command::JOIN(channel.to_string()))
|
||||
|
@ -602,10 +609,10 @@ impl Config {
|
|||
/// # use circe::*;
|
||||
/// let config = Config::new(
|
||||
/// &["#main", "#circe"],
|
||||
/// "192.168.178.100",
|
||||
/// "karx.xyz",
|
||||
/// Some("+B"),
|
||||
/// Some("circe"),
|
||||
/// 6667,
|
||||
/// 6697,
|
||||
/// "circe",
|
||||
/// );
|
||||
/// ```
|
||||
|
|
Loading…
Reference in a new issue