Enum Command

Source
pub enum Command {
Show 15 variants ADMIN(String), AWAY(String), INVITE(String, String), JOIN(String), LIST(Option<String>, Option<String>), MODE(String, Option<String>), NAMES(String, Option<String>), NICK(String), OPER(String, String), OTHER(String), PART(String), PING(String), PRIVMSG(String, String, String), QUIT(String), TOPIC(String, Option<String>), // some variants omitted
}
Expand description

Commands that can be send or recived from an IRC server.

Variants§

§

ADMIN(String)

Request information about the admin of a given server.

# let config = Default::default();
# let mut client = Client::new(config).await?;
# client.identify().await?;
client.admin("libera.chat").await?;
# Ok(())

§Errors

Returns IO errors from the TcpStream.

Tuple Fields

§0: String

Target

§

AWAY(String)

Set the status of the client.

# let config = Default::default();
# let mut client = Client::new(config).await?;
# client.identify().await?;
client.away("afk").await?;
# Ok(())

Tuple Fields

§0: String

Message

§

INVITE(String, String)

Invite someone to a channel.

# let config = Default::default();
# let mut client = Client::new(config).await?;
# client.identify().await?;
client.invite("liblemonirc", "#async-circe").await?;
# Ok(())

Tuple Fields

§0: String

User

§1: String

Channel

§

JOIN(String)

Join a channel.

# let config = Default::default();
# let mut client = Client::new(config).await?;
# client.identify().await?;
client.join("#chaos").await?;
# Ok(())

Tuple Fields

§0: String

Channel

§

LIST(Option<String>, Option<String>)

List available channels on an IRC, or users in a channel.

# let config = Default::default();
# let mut client = Client::new(config).await?;
# client.identify().await?;
client.list(None, None).await?;
# Ok(())

Tuple Fields

§0: Option<String>

Channel

§1: Option<String>

Server to foreward request to

§

MODE(String, Option<String>)

Set the mode for a user.

# let config = Default::default();
# let mut client = Client::new(config).await?;
# client.identify().await?;
client.mode("test", Some("+B")).await?;
# Ok(())

Tuple Fields

§0: String

Channel

§1: Option<String>

Mode

§

NAMES(String, Option<String>)

Get all the people online in channels.

# let config = Default::default();
# let mut client = Client::new(config).await?;
# client.identify().await?;
client.names("#chaos,#async-circe", None).await?;
# Ok(())

Tuple Fields

§0: String

Channel

§1: Option<String>

Server to foreward request to

§

NICK(String)

Change your nickname on a server.

# let config = Default::default();
# let mut client = Client::new(config).await?;
# client.identify().await?;
client.nick("Not async-circe").await?;
# Ok(())

Tuple Fields

§0: String

Nickname

§

OPER(String, String)

Authentificate as an operator on a server.

# let config = Default::default();
# let mut client = Client::new(config).await?;
# client.identify().await?;
client.oper("username", "password").await?;
# Ok(())

Tuple Fields

§0: String

Username

§1: String

Password

§

OTHER(String)

Everything that is not a command

§

PART(String)

Leave a channel.

# let config = Default::default();
# let mut client = Client::new(config).await?;
# client.identify().await?;
client.part("#chaos").await?;
# Ok(())

Tuple Fields

§0: String

Target

§

PING(String)

Tests the presence of a connection to a server.

# let config = Default::default();
# let mut client = Client::new(config).await?;
# client.identify().await?;
client.ping("libera.chat", None).await?;
# Ok(())
§

PRIVMSG(String, String, String)

Send a message to a channel.

# let config = Default::default();
# let mut client = Client::new(config).await?;
# client.identify().await?;
client.privmsg("#chaos", "Hello").await?;
# Ok(())

Tuple Fields

§0: String

Source Nickname

§1: String

Channel

§2: String

Message

§

QUIT(String)

Leave the IRC server you are connected to.

# let config = Default::default();
# let mut client = Client::new(config).await?;
# client.identify().await?;
client.quit(None).await?;
# Ok(())

Tuple Fields

§0: String

Leave message

§

TOPIC(String, Option<String>)

Get the topic of a channel.

§Example

# let config = Default::default();
# let mut client = Client::new(config).await?;
# client.identify().await?;
client.topic("#chaos", None).await?;
# Ok(())

Set the topic of a channel.

§Example

# let config = Default::default();
# let mut client = Client::new(config).await?;
# client.identify().await?;
client.topic("#chaos", Some("main channel")).await?;
# Ok(())

§Errors

Returns IO errors from the TcpStream.

Tuple Fields

§0: String

Channel

§1: Option<String>

Topic

Implementations§

Source§

impl Command

Source

pub async fn command_from_str(s: &str) -> Self

Creates a Command from a &str. Currently only [PING] and [PRIVMSG] are supported.

§Panics

This function will panic if the IRCd sends malformed messages. Please contact the maintainer of your IRCd if this happens.

Trait Implementations§

Source§

impl Debug for Command

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more