Modules/bIRC/ircGetUserMode

From Multi Theft Auto: Wiki
Revision as of 20:54, 14 August 2009 by Awwu (talk | contribs) (Created page with '{{ml_birc}} __NOTOC__ This function returns the user mode of user in specified channel. The specified {{ml_birc|ircbot}} has to be in that channel. ==Syntax== <syntaxhighlight lang="lua"> str…')
(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 returns the user mode of user in specified channel. The specified ircbot has to be in that channel.

Syntax

string ircGetUserMode ( ircbot theBot, string channel, string user )

Required Arguments

  • theBot: The ircbot which is in the channel
  • channel: The name of the channel which channel mode you want to get
  • user: The name of the user whose user mode you want to return

Returns

Returns a string containing a series of symbols, each representing a user mode. Symbols are

  • +: user is voiced in the channel
  • %: user is a channel half-operator
  • @: user is a channel operator
  • &: user is a channel super-operator
  • ~: user is the channel owner

If user does not have any modes on that channel, returns an empty string or false if invalid arguments were passed.

Example

This example creates a function which can be used to check whether a user is voiced in a channel.

function isUserVoiced( theBot, channel, user )
    local botName = ircGetName( theBot )
    if botName then -- if the bot given was valid (it has a name)
        if ircIsInChannel( theBot, channel, user ) then -- if the user is in channel
            local userMode = ircGetUserMode( theBot, channel, user )
            if userMode and userMode:find( "+" ) then -- if valid arguments were passed, and '+' symbol is found in the user mode
                return true
            end
        end
    end
    return false
end

See Also

Bot functions

Creation

Connection

Other

IRC functions

Channel

User

Communication

Other