1443 |
|
|
1444 |
@itemize @bullet |
@itemize @bullet |
1445 |
@item |
@item |
1446 |
@command{weechat.register ( name, version, shutdown_function, description );}@* |
@command{weechat.register ( name, version, shutdown_function, description )}@* |
1447 |
@* |
@* |
1448 |
This is first function to call in Python script.@* |
This is first function to call in Python script.@* |
1449 |
All Python scripts for WeeChat should call this function.@* |
All Python scripts for WeeChat should call this function.@* |
1459 |
@end itemize |
@end itemize |
1460 |
@* |
@* |
1461 |
@emph{Example:}@* |
@emph{Example:}@* |
1462 |
@code{weechat.register ("sample", "1.0", "sample_end", "Sample script!");}@* |
@code{weechat.register ("sample", "1.0", "sample_end", "Sample script!")}@* |
1463 |
@* |
@* |
1464 |
|
|
1465 |
@item |
@item |
1466 |
@command{weechat.prnt ( message, [channel, [server]] );}@* |
@command{weechat.prnt ( message, [channel, [server]] )}@* |
1467 |
@* |
@* |
1468 |
Print message in a channel.@* |
Print message in a channel.@* |
1469 |
|
|
1475 |
@end itemize |
@end itemize |
1476 |
@* |
@* |
1477 |
@emph{Examples:}@* |
@emph{Examples:}@* |
1478 |
@code{weechat.prnt ("message");}@* |
@code{weechat.prnt ("message")}@* |
1479 |
@code{weechat.prnt ("message", "#weechat");}@* |
@code{weechat.prnt ("message", "#weechat")}@* |
1480 |
@code{weechat.prnt ("message", "#weechat", "freenode");}@* |
@code{weechat.prnt ("message", "#weechat", "freenode")}@* |
1481 |
@* |
@* |
1482 |
|
|
1483 |
@item |
@item |
1484 |
@command{weechat.print_infobar ( delay, message );}@* |
@command{weechat.print_infobar ( delay, message )}@* |
1485 |
@* |
@* |
1486 |
Print message in infobar.@* |
Print message in infobar.@* |
1487 |
|
|
1493 |
@end itemize |
@end itemize |
1494 |
@* |
@* |
1495 |
@emph{Example:}@* |
@emph{Example:}@* |
1496 |
@code{weechat.print_infobar (5, "message");}@* |
@code{weechat.print_infobar (5, "message")}@* |
1497 |
@* |
@* |
1498 |
|
|
1499 |
@item |
@item |
1500 |
@command{weechat.add_message_handler ( name, function );}@* |
@command{weechat.add_message_handler ( name, function )}@* |
1501 |
@* |
@* |
1502 |
Attach a Python function to an IRC message.@* |
Attach a Python function to an IRC message.@* |
1503 |
Function will be called each time IRC message will be received.@* |
Function will be called each time IRC message will be received.@* |
1512 |
@end itemize |
@end itemize |
1513 |
@* |
@* |
1514 |
@emph{Example:}@* |
@emph{Example:}@* |
1515 |
@code{weechat.add_message_handler ("privmsg", my_function);}@* |
@code{weechat.add_message_handler ("privmsg", my_function)}@* |
1516 |
@code{sub my_function}@* |
@code{def my_function(server, args):}@* |
1517 |
@code{@{ }@* |
@code{@ @ @ @ weechat.prnt("server="+server)}@* |
1518 |
@code{@ @ @ @ weechat.print ("server=$_[0]\n");}@* |
@code{@ @ @ @ null, channel, message = string.split(args, ":", 2)}@* |
1519 |
@code{@ @ @ @ ($null, $channel, $message) = split ":",$_[1],3;}@* |
@code{@ @ @ @ hostmask, null, channel = string.split(string.strip(channel), " ", 2)}@* |
1520 |
@code{@ @ @ @ ($hostmask, $null, $channel) = split " ", $channel;}@* |
@code{@ @ @ @ weechat.prnt("host="+hostmask+", channel="+channel+", message="+message)}@* |
|
@code{@ @ @ @ weechat.prnt ("host=$hostmask, chan=$channel, msg=$message\n");}@* |
|
|
@code{@} }@* |
|
1521 |
@* |
@* |
1522 |
|
|
1523 |
@item |
@item |
1524 |
@command{weechat.add_command_handler ( name, function );}@* |
@command{weechat.add_command_handler ( name, function )}@* |
1525 |
@* |
@* |
1526 |
Create new WeeChat command, linked with Python function.@* |
Create new WeeChat command, linked with Python function.@* |
1527 |
Function will be called when user will launch command with @kbd{/name}.@* |
Function will be called when user will launch command with @kbd{/name}.@* |
1536 |
@end itemize |
@end itemize |
1537 |
@* |
@* |
1538 |
@emph{Example:}@* |
@emph{Example:}@* |
1539 |
@code{weechat.add_command_handler ("command", my_command);}@* |
@code{weechat.add_command_handler ("command", my_command)}@* |
1540 |
@code{sub my_command}@* |
@code{def my_command(server, args):}@* |
1541 |
@code{@{ }@* |
@code{@ @ @ @ weechat.prnt("server:"+server+" arguments:"+args)}@* |
|
@code{@ @ @ @ weechat.prnt("Server: $_[0], arguments: $_[1]\n");}@* |
|
|
@code{@ @ @ @ return 0;}@* |
|
|
@code{@} }@* |
|
1542 |
@* |
@* |
1543 |
|
|
1544 |
@item |
@item |
1545 |
@command{weechat.command ( command, [channel, [server]] );}@* |
@command{weechat.command ( command, [channel, [server]] )}@* |
1546 |
@* |
@* |
1547 |
Execute a command or send a message to a channel.@* |
Execute a command or send a message to a channel.@* |
1548 |
|
|
1554 |
@end itemize |
@end itemize |
1555 |
@* |
@* |
1556 |
@emph{Examples:}@* |
@emph{Examples:}@* |
1557 |
@code{weechat.command ("hello world!");}@* |
@code{weechat.command ("hello world!")}@* |
1558 |
@code{weechat.command ("/kick toto please leave this chan", "#weechat");}@* |
@code{weechat.command ("/kick toto please leave this chan", "#weechat")}@* |
1559 |
@code{weechat.command ("/nick newnick", "", "freenode");}@* |
@code{weechat.command ("/nick newnick", "", "freenode")}@* |
1560 |
@* |
@* |
1561 |
|
|
1562 |
|
|
1563 |
@item |
@item |
1564 |
@command{weechat.get_info ( name, [server] );}@* |
@command{weechat.get_info ( name, [server] )}@* |
1565 |
@* |
@* |
1566 |
Get various info about WeeChat, server or user.@* |
Get various info about WeeChat, server or user.@* |
1567 |
|
|
1580 |
@end itemize |
@end itemize |
1581 |
@* |
@* |
1582 |
@emph{Examples:}@* |
@emph{Examples:}@* |
1583 |
@code{$version = weechat.get_info("version");}@* |
@code{$version = weechat.get_info("version")}@* |
1584 |
@code{$nick = weechat.get_info("nick", "freenode");}@* |
@code{$nick = weechat.get_info("nick", "freenode")}@* |
1585 |
@* |
@* |
1586 |
|
|
1587 |
@end itemize |
@end itemize |