Lala utils

Helpers to be used with plugins

class lala.util.command(command=None, admin_only=False, aliases=None)[source]

Bases: object

Decorator to register a command. The name of the command is the __name__ attribute of the decorated function. Example:

def heyiamacommand(user, channel, text):

You can also pass a command parameter to overwrite the name of the command:

def command_with_a_really_stupid_or_insanely_long_name(user,
channel, text):

aliases can be a list of names under which the function will be available in addition to its primary name.

An additional argument, admin_only can be used to make a function available to admins only:

def give_me_the_one_ring(user, channel, text):

New in version 0.5.

If the function returns a twisted.internet.defer.Deferred or a generator function that’s generating them, an Errback will automatically be added to the Deferred(s).

Changed in version 0.5.

The third argument received by a command function used to include the name of the command itself. Since version 0.5 this is no longer the case.

lala.util.msg(target, message, log=True)[source]

Send a message to a target.

  • target (str) – Target to send the message to. Can be a channel or user
  • message (str or [str]) – One or more messages to send
  • log (bool) – Whether or not to log the message

Decorator for functions reacting to joins

Parameters:f – The function which should be called on joins.
class lala.util.regex(regex)[source]

Bases: object

Decorator to register a regex. Example:

def somefunc(user, channel, text, match_obj):

match_obj is a re.MatchObject.

Parameters:regex – A re.RegexObject or a string representing a regular expression.

Disables trigger.

Parameters:trigger (str) – The trigger to disable. Can be a key for a callback or a regular expression

Enables trigger.

Parameters:trigger (str) – The trigger to enable. Can be a key for a callback or a regular expression

Check whether user is an admin.

If a nickserv password is set, this will work by checking an internal list of identified admins.

If no nickserv password is set, this simply checks if user is in the “admins” option of the “base” section.

class lala.pluginmanager.PluginFunc(func, enabled=True, admin_only=False, aliases=None)[source]

Bases: object