Modules/bIRC/ircStrip

From Multi Theft Auto: Wiki
Revision as of 09:05, 30 July 2009 by Awwu (talk | contribs) (Created page with '{{ml_birc}} __NOTOC__ This function can be used to strip out wanted IRC specific text features (bolding, colouring...). ==Syntax== <syntaxhighlight lang="lua"> string ircStrip ( string text, …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Package-x-generic.png This function is provided by the external module Basic IRC Module. You must install this module to use this function.

This function can be used to strip out wanted IRC specific text features (bolding, colouring...).

Syntax

string ircStrip ( string text, [ string options = "burc" ] )

Required Arguments

  • text: The wanted string which is going to be stripped out it's text features.

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • options: A string representing the strip options. It is formed from single letters, each having it's own role in the final result.
    • b: Strip out all bold text.
    • u: Strip out all underlined text.
    • r: Strip out all reversed text.
    • c: Strip out all coloured text.
By default all text features are removed.

Returns

Returns the stripped out version of the string if passed arguments were valid, false otherwise.

Example

This example creates an ircbot called DummyBot makes it connect to a server and join a channel. Once joining the channel, bot will be echoing all IRC channel text to server log, stripping off all IRC specific text features.

function resourceStart ( )
    theBot = ircCreateBot ( "DummyBot" )
    ircConnect ( theBot, "irc.gtanet.com", 6667 )
end
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), resourceStart )

function event_ircOnConnect ( theBot )
    setTimer ( ircJoinChannel, 2000, 1, theBot, "#testchannel" )
end

function event_ircOnText ( theBot, channel, sender, message )
    outputServerLog ( "[IRC-ECHO] On " .. channel .. "; " .. sender .. ": " .. ircStrip ( message ) )
end

See Also

Bot functions

Creation

Connection

Other

IRC functions

Channel

User

Communication

Other