Skip to content
fro_ozen edited this page Jul 27, 2015 · 4 revisions

Creating a basic command

from pybot import plugin_manager, irc

@plugin_manager.command("hello")
def hello_command(command, server):
    # Create the event to be sent
    hello_event = irc.Irc_event("PRIVMSG", command.event.args[0], "Hello.")
    # Send the event
    server.send_event(hello_event)

This code creates a command that can be called by writing )hello in the channel.

Creating a basic handler

from pybot import plugin_manager, irc

@plugin_manager.event_handler("JOIN")
def on_join(event, server):
    # Create the event
    hello_event = irc.Irc_event("PRIVMSG", command.event.args[0], "Hello.")
    # Send the event
    server.send_event(hello_event)

This code creates a handler that writes Hello. in the channel every time someone joins.

Clone this wiki locally