1445 |
|
|
1446 |
@itemize @bullet |
@itemize @bullet |
1447 |
@item |
@item |
1448 |
@command{weechat.register ( nombre, versi@'on, funci@'on_final, descripci@'on );}@* |
@command{weechat.register ( nombre, versi@'on, funci@'on_final, descripci@'on )}@* |
1449 |
@* |
@* |
1450 |
Es la primera funci@'on a la que llamar en el programa Python.@* |
Es la primera funci@'on a la que llamar en el programa Python.@* |
1451 |
Todos los programas en Python para WeeChat deben llamar esta funci@'on.@* |
Todos los programas en Python para WeeChat deben llamar esta funci@'on.@* |
1461 |
@end itemize |
@end itemize |
1462 |
@* |
@* |
1463 |
@emph{Ejemplo:}@* |
@emph{Ejemplo:}@* |
1464 |
@code{weechat.register ("ejemplo", "1.0", "fin_ejemplo", "programa de ejemplo...");}@* |
@code{weechat.register ("ejemplo", "1.0", "fin_ejemplo", "programa de ejemplo...")}@* |
1465 |
@* |
@* |
1466 |
|
|
1467 |
@item |
@item |
1468 |
@command{weechat.prnt ( mensaje, [canal, [servidor]] );}@* |
@command{weechat.prnt ( mensaje, [canal, [servidor]] )}@* |
1469 |
@* |
@* |
1470 |
Escribe un mensaje en un canal.@* |
Escribe un mensaje en un canal.@* |
1471 |
|
|
1477 |
@end itemize |
@end itemize |
1478 |
@* |
@* |
1479 |
@emph{Ejemplo:}@* |
@emph{Ejemplo:}@* |
1480 |
@code{weechat.prnt ("mensaje");}@* |
@code{weechat.prnt ("mensaje")}@* |
1481 |
@code{weechat.prnt ("mensaje", "#weechat");}@* |
@code{weechat.prnt ("mensaje", "#weechat")}@* |
1482 |
@code{weechat.prnt ("mensaje", "#weechat", "freenode");}@* |
@code{weechat.prnt ("mensaje", "#weechat", "freenode")}@* |
1483 |
@* |
@* |
1484 |
|
|
1485 |
@item |
@item |
1486 |
@command{weechat.print_infobar ( retraso, mensaje );}@* |
@command{weechat.print_infobar ( retraso, mensaje )}@* |
1487 |
@* |
@* |
1488 |
Escribir un mensaje en la barra de informaciones.@* |
Escribir un mensaje en la barra de informaciones.@* |
1489 |
|
|
1490 |
@emph{Par@'ametros:} |
@emph{Par@'ametros:} |
1491 |
@itemize @minus |
@itemize @minus |
1492 |
@item @option{plazo}: periodo en segundo durante el cual se mostrar@'a el mensaje |
@item @option{retraso}: periodo en segundo durante el cual se mostrar@'a el mensaje |
1493 |
(si es 0, el mensaje no se borrar@'a). |
(si es 0, el mensaje no se borrar@'a). |
1494 |
@item @option{message}: mensaje que se escribir@'a en la barra de informaciones. |
@item @option{mensaje}: mensaje que se escribir@'a en la barra de informaciones. |
1495 |
@end itemize |
@end itemize |
1496 |
@* |
@* |
1497 |
@emph{Ejemplo:}@* |
@emph{Ejemplo:}@* |
1498 |
@code{weechat.print_infobar (5, "mensaje");}@* |
@code{weechat.print_infobar (5, "mensaje")}@* |
1499 |
@* |
@* |
1500 |
|
|
1501 |
@item |
@item |
1502 |
@command{weechat.add_message_handler ( nombre, funci@'on );}@* |
@command{weechat.add_message_handler ( nombre, funci@'on )}@* |
1503 |
@* |
@* |
1504 |
Adjunta una funci@'on Python a un mensaje IRC.@* |
Adjunta una funci@'on Python a un mensaje IRC.@* |
1505 |
Se llamar@'a a la funci@'on cada vez que el mensaje IRC se reciba.@* |
Se llamar@'a a la funci@'on cada vez que el mensaje IRC se reciba.@* |
1515 |
@end itemize |
@end itemize |
1516 |
@* |
@* |
1517 |
@emph{Ejemplo:}@* |
@emph{Ejemplo:}@* |
1518 |
@code{weechat.add_message_handler ("privmsg", mi_funcion);}@* |
@code{weechat.add_message_handler ("privmsg", mi_funcion)}@* |
1519 |
@code{sub mi_funcion}@* |
@code{def mi_funcion(servidor, args):}@* |
1520 |
@code{@{ }@* |
@code{@ @ @ @ weechat.prnt("servidor="+servidor)}@* |
1521 |
@code{@ @ @ @ weechat.prnt ("serveur=$_[0]\n");}@* |
@code{@ @ @ @ null, canal, mensaje = string.split(args, ":", 2)}@* |
1522 |
@code{@ @ @ @ ($null, $canal, $mensaje) = split ":",$_[1],3;}@* |
@code{@ @ @ @ mascara, null, canal = string.split(string.strip(canal), " ", 2)}@* |
1523 |
@code{@ @ @ @ ($mascara, $null, $canal) = split " ", $canal;}@* |
@code{@ @ @ @ weechat.prnt("mascara="+mascara+", canal="+canal+", mensaje="+mensaje)}@* |
|
@code{@ @ @ @ weechat.prnt ("mascara=$mascara, canal=$canal, mensaje=$mensaje\n");}@* |
|
|
@code{@} }@* |
|
1524 |
@* |
@* |
1525 |
|
|
1526 |
@item |
@item |
1527 |
@command{weechat.add_command_handler ( nombre, funci@'on );}@* |
@command{weechat.add_command_handler ( nombre, funci@'on )}@* |
1528 |
@* |
@* |
1529 |
A@~nadir un nuevo comando WeeChat, con un enlace a una funci@'on en Python.@* |
A@~nadir un nuevo comando WeeChat, con un enlace a una funci@'on en Python.@* |
1530 |
Se llamar@'a a la funci@'on cuando el usuario lance el comando con @kbd{/nombre}.@* |
Se llamar@'a a la funci@'on cuando el usuario lance el comando con @kbd{/nombre}.@* |
1539 |
@end itemize |
@end itemize |
1540 |
@* |
@* |
1541 |
@emph{Ejemplo:}@* |
@emph{Ejemplo:}@* |
1542 |
@code{weechat.add_command_handler ("comando", mi_comando);}@* |
@code{weechat.add_command_handler ("comando", mi_comando)}@* |
1543 |
@code{sub mi_comando}@* |
@code{def mi_comando(servidor, args):}@* |
1544 |
@code{@{ }@* |
@code{@ @ @ @ weechat.prnt("Servidor:"+servidor+" Par@'ametros:"+args)}@* |
|
@code{@ @ @ @ weechat.prnt("Servidor: $_[0], Par@'ametros: $_[1]\n");}@* |
|
|
@code{@ @ @ @ return 0;}@* |
|
|
@code{@} }@* |
|
1545 |
@* |
@* |
1546 |
|
|
1547 |
@item |
@item |
1548 |
@command{weechat.command ( command, [channel, [server]] );}@* |
@command{weechat.command ( command, [channel, [server]] )}@* |
1549 |
@* |
@* |
1550 |
Execute a command or send a message to a channel.@* |
Execute a command or send a message to a channel.@* |
1551 |
|
|
1557 |
@end itemize |
@end itemize |
1558 |
@* |
@* |
1559 |
@emph{Examples:}@* |
@emph{Examples:}@* |
1560 |
@code{weechat.command ("hello world!");}@* |
@code{weechat.command ("hello world!")}@* |
1561 |
@code{weechat.command ("/kick toto please leave this chan", "#weechat");}@* |
@code{weechat.command ("/kick toto please leave this chan", "#weechat")}@* |
1562 |
@code{weechat.command ("/nick newnick", "", "freenode");}@* |
@code{weechat.command ("/nick newnick", "", "freenode")}@* |
1563 |
@* |
@* |
1564 |
|
|
1565 |
@item |
@item |
1566 |
@command{weechat.get_info ( nombre, [servidor] );}@* |
@command{weechat.get_info ( nombre, [servidor] )}@* |
1567 |
@* |
@* |
1568 |
Obtener informaciones distintas sobre WeeChat, el servidor o el usuario.@* |
Obtener informaciones distintas sobre WeeChat, el servidor o el usuario.@* |
1569 |
|
|
1582 |
@end itemize |
@end itemize |
1583 |
@* |
@* |
1584 |
@emph{Ejemplos:}@* |
@emph{Ejemplos:}@* |
1585 |
@code{$version = weechat.get_info("version");}@* |
@code{$version = weechat.get_info("version")}@* |
1586 |
@code{$nick = weechat.get_info("nick", "freenode");}@* |
@code{$nick = weechat.get_info("nick", "freenode")}@* |
1587 |
@* |
@* |
1588 |
|
|
1589 |
@end itemize |
@end itemize |