tubes/msg

Types

An IRC message

pub type IrcMessage {
  IrcMessage(
    tags: Tags,
    source: Option(MessageSource),
    command: String,
    params: List(String),
  )
}

Constructors

  • IrcMessage(
      tags: Tags,
      source: Option(MessageSource),
      command: String,
      params: List(String),
    )
pub type MessageSource {
  Server(String)
  Nick(nickname: String, username: String, hostname: String)
}

Constructors

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

Functions

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