struct FastIRC::Message
- FastIRC::Message
- Struct
- Value
- Object
Included Modules
- FastIRC::ParserMacros
Defined in:
fast_irc/message.crfast_irc/parser.cr
Constructors
-
.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.
-
.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.
Class Method Summary
-
.parse(str : Slice(UInt8))
Parses an IRC Message from a Slice(UInt8).
-
.parse(str)
Parses an IRC message from a String.
Instance Method Summary
- #==(other : self)
- #command : String
- #inspect(io)
-
#params
The parameters of the IRC message as an Array(String), or an empty array if there were none.
-
#params?
The parameters of the IRC message as an Array(String), or nil if there were none.
- #prefix
- #prefix? : FastIRC::Prefix?
-
#tags
The IRCv3 tags of the IRC message as a Hash(String, String|Nil), or an empty Hash if there were none.
-
#tags?
The IRCv3 tags of the IRC message as a Hash(String, String|Nil), or nil if there were none.
-
#to_s(io)
Converts the Message back into an IRC format string.
Constructor Detail
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.
Initialises the Message with the given tags, prefix, command and params.
Class Method Detail
Parses an IRC Message from a Slice(UInt8). The slice should not have trailing \r\n characters and should be null terminated.
Parses an IRC message from a String. The String should not have the trailing "\r\n" characters.
Instance Method Detail
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?
.
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?
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.
Converts the Message back into an IRC format string. (e.g. "@tag :nick!user@host COMMAND arg1 :more args" )