Skip to content

Quit message not being sent #276

@Ep0chalypse

Description

@Ep0chalypse

Hi, when i use sender.send_quit("Custom message") the bot doesnt seem to actually send "Custom message" but does quit.

I can see the bot join/quit

[10:25:46PM] * [irc-crate-ci] ([email protected]) has joined #test-quit
[10:25:56PM] * [irc-crate-ci] ([email protected]) Quit

And I see this in the console where I run the bot:
ERROR :Closing Link: hostname.com ()

A minimal example is below

use futures::prelude::*;
use irc::client::prelude::*;
use std::default::Default;

#[tokio::main]
async fn main() -> irc::error::Result<()> {
    let config = Config {
        nickname: Some("test-quit123".to_owned()),
        server: Some("irc.efnet.org".to_owned()),
        alt_nicks: vec!["[irc-crate-ci]".to_owned()],
        ..Default::default()
    };

    let mut client = Client::from_config(config).await?;

    client.identify()?;

    let mut stream = client.stream()?;
    let sender = client.sender();

    while let Some(message) = stream.next().await.transpose()? {
        print!("{}", message);
        client.send_join("#channel").unwrap();

        let sender_clone = sender.clone();
        tokio::spawn(async move {
            tokio::time::sleep(tokio::time::Duration::from_millis(10000)).await;

            // sender_clone.send_quit("Custom message").unwrap();
            if let Err(e) = sender_clone.send_quit("Custom message") {
                eprintln!("Error sending QUIT: {}", e);
            }
            tokio::time::sleep(tokio::time::Duration::from_millis(5000)).await;
        });
    }

    Ok(())
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions