tubes/msg

Types

An IRC message

pub type IrcMessage {
  IrcMessage(
    tags: dict.Dict(String, option.Option(String)),
    source: option.Option(MessageSource),
    command: String,
    params: List(String),
  )
}

Constructors

pub type MessageSource {
  Server(String)
  Nick(nickname: String, username: String, hostname: String)
}

Constructors

  • Server(String)
  • Nick(nickname: String, username: String, hostname: String)

Values

pub fn parse(msg: String) -> IrcMessage

Convert an IRC line to an IrcMessage

Example:

import tubes/msg
import gleam/io

let msg = msg.parse(":leah!leah@pronounmail.com PRIVMSG #tubes :hello all!")
io.debug(msg) // => IrcMessage(
              //      dict.from_list([]),
              //      Some(Nick("leah", "leah", "pronounmail.com")),
              //      "PRIVMSG",
              //      ["#tubes", "hello all!"]
              //    )
Search Document