Module Autumn::StemFacade
In: lib/autumn/stem_facade.rb

A collection of convenience methods that are added to the Stem class. These methods serve two purposes; one, to allow easier backwards compatibility with Autumn Leaves 1.0 (which had a simpler one-stem-per-leaf approach), and two, to make it easier or more Ruby-like to perform certain IRC actions.

Methods

Public Instance methods

Changes this stem‘s IRC nick. Note that the stem‘s original nick will still be used by the logger.

Grants a privilege to a channel member, such as voicing a member. The stem must have the required privilege level to perform this command. privilege can either be a symbol from the Daemon instance or a string with the letter code for the privilege.

 grant_user_privilege 'mychannel', 'Somedude', :operator
 grant_user_privilege '#mychannel', 'Somedude', 'oa'

Grants a usermode to an IRC nick, such as making a nick invisible. The stem must have the required privilege level to perform this command. (Generally, one can only change his own usermode unless he is a server op.) mode can either be a symbol from the Daemon instance or a string with the letter code for the usermode.

 grant_usermode 'Spycloak', :invisible
 grant_usermode 'UpMobility', 'os'

Joins a channel by name. If the channel is password-protected, specify the password parameter. Of course, you could always just call the join method (since each IRC command has a method named after it), but the advantage to using this method is that it will also update the @channel_passwords instance variable. Internal consistency is a good thing, so please use this method.

Leaves a channel, specified by name.

Sends a message to one or more channels or nicks. If no channels or nicks are specified, broadcasts the message to every channel the stem is in. If you are sending a message to a channel you must prefix it correctly; the "#" will not be added before the channel name for you.

 message "Look at me!" # Broadcasts to all channels
 message "I love kitties", '#kitties' # Sends a message to one channel or person
 message "Learn to RTFM", '#help', 'NoobGuy' # Sends a message to two channels or people

Returns the privilege level of a channel member. The privilege level will be a symbol from the Daemon instance. Returns nil if the channel member doesn‘t exist or if the bot is not on the given channel. Returns an array of privileges if the server supports multiple privileges per user, and the user has more than one privilege.

user can be a nick or a sender hash.

Removes a privilege to a channel member, such as voicing a member. The stem must have the required privilege level to perform this command. privilege can either be a symbol from the Daemon instance or a string with the letter code for the privilege.

Revokes a usermode from an IRC nick, such as removing invisibility. The stem must have the required privilege level to perform this command. (Generally, one can only change his own usermode unless he is a server op.) mode can either be a symbol from the Daemon instance or a string with the letter code for the usermode.

Sets a property of a channel, such as moderated. The stem must have the required privilege level to perform this command. property can either be a symbol from the Daemon instance or a string with the letter code for the property. If the property takes an argument (such as when setting a channel password), pass it as the argument paramter.

 set_channel_property '#mychannel', :secret
 set_channel_property 'mychannel', :keylock, 'mypassword'
 set_channel_property '#mychannel', 'ntr'

Sets the topic for one or more channels. If no channels are specified, sets the topic of every channel the stem is in.

 set_topic "Bots sure are fun!", 'bots', 'morebots'

Removes a property of a channel, such as moderated. The stem must have the required privilege level to perform this command. property can either be a symbol from the Daemon instance or a string with the letter code for the property. If the property takes an argument (such as when removing a channel password), pass it as the argument paramter.

Returns an array of nicks for users that are in a channel.

[Validate]