struct FastIRC::Message

Included Modules

Defined in:

fast_irc/message.cr
fast_irc/parser.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(str : Slice(UInt8), tags_start : Int32 | Nil, prefix : Prefix | Nil, command : String, params_start : Int32 | Nil) #

Initialises the Message with a backing Slice(UInt8) of bytes, and the locations of strings inside the slice. Use this method only if you know what you are doing.


[View source]
def self.new(command : String, params : Nil | Array(String) = nil, prefix : FastIRC::Prefix | Nil = nil, tags : Hash(String, String | Nil) | Nil = nil) #

Initialises the Message with the given tags, prefix, command and params.


[View source]

Class Method Detail

def self.parse(str : Slice(UInt8)) #

Parses an IRC Message from a Slice(UInt8). The slice should not have trailing \r\n characters and should be null terminated.


[View source]
def self.parse(str) #

Parses an IRC message from a String. The String should not have the trailing "\r\n" characters.


[View source]

Instance Method Detail

def ==(other : self) #

[View source]
def command : String #

[View source]
def inspect(io) #

[View source]
def params #

The parameters of the IRC message as an Array(String), or an empty array if there were none. For faster performance with 0 parameter messages, use #params?.


[View source]
def params? #

The parameters of the IRC message as an Array(String), or nil if there were none.


[View source]
def prefix #

[View source]
def prefix? : FastIRC::Prefix? #

[View source]
def tags #

The IRCv3 tags of the IRC message as a Hash(String, String|Nil), or an empty Hash if there were none. Tags with no value are mapped to nil. For faster performance when there are no tags, use #tags?


[View source]
def tags? #

The IRCv3 tags of the IRC message as a Hash(String, String|Nil), or nil if there were none. Tags with no value are mapped to nil.


[View source]
def to_s(io) #

Converts the Message back into an IRC format string. (e.g. "@tag :nick!user@host COMMAND arg1 :more args" )


[View source]