-
Notifications
You must be signed in to change notification settings - Fork 0
Lua Modules
Marco Silipo edited this page Sep 16, 2016
·
7 revisions
Alfred allows for extending him via lua to add a new lua module, simply add a new .lua file in the modules directory.
All functions are located in the alfred table.
-
FUNCTION Function to call when a message is received.
function will receive following argument set:
content:string, receiver:string, sender:string, kind:string
NIL
alfred.registerraw(function(c, recv, send, kind) print(c) end);
-
FUNCTION Function to call when a message is received.
function will receive following argument set:
content:string, receiver:string, sender:string, kind:stringadditionally, the function will receive all parameters you requested in formatprovider - STRING Name of the command
-
STRING Arg-Format of this command.
Each argument has to be terminated with a
;.
- Required Argument:
ARGNAME; - Optional Argument:
ARGNAME=DEFUALT;
- BOOLEAN Determines wether this command requires you to be an authorized user.
- BOOLEAN Determines wether this command is only available via direct messages.
NIL
alfred.registerMsg(function(c, recv, send, kind, arg1) print(arg1) end, "roll", "from=0;to=30000;", false, false);
- STRING Message to send.
- STRING Receiver of this message. Receiver can be a channel, a fuly qualified nick or a nick.
NIL
alfred.sendPrivMsg("hello there", "X39");alfred.sendPrivMsg("hello there", "jenny!~foo.vaderphone.ip-pool.doop");alfred.sendPrivMsg("hello there", "#foobar");
- STRING Message to send.
- STRING Receiver of this message. Should be registermsg or registerraw receiver arg.
- STRING Sender of this message. Should be registermsg or registerraw sender arg.
NIL
alfred.respond("hello there", recv, sender);alfred.respond("hello there", "#foobar", "jenny!~foo.vaderphone.ip-pool.doop");
- STRING response available in config.xml file.
STRING either invalid arg string or a random response as entered in config.xml
alfred.getRandomResponse("error");alfred.getRandomResponse("unknown");
-
STRING Fully qualified channel name (always starts with
#). - STRING Namespace. Users are automatically managed by using their fully qualified username (discarded when user PARTs).
- STRING Variable name to use.
- STRING Value to put.
NIL
alfred.setChannelVar("#foo", "bar", "varname", "something");alfred.setChannelVar("#foo", "jenny!~foo.vaderphone.ip-pool.doop", "varname", "something");
-
STRING Fully qualified channel name (always starts with
#). - STRING Namespace. Users are automatically managed by using their fully qualified username (discarded when user PARTs).
- STRING Variable name to use.
STRING Value in given slot or NIL if there was no value at given slot.
alfred.getChannelVar("#foo", "bar", "varname", "something");alfred.getChannelVar("#foo", "jenny!~foo.vaderphone.ip-pool.doop", "varname", "something");