예제 #1
0
#!/usr/bin/python3

import ircutil

mybot = ircutil.Connection()
mybot.nick = "ezBot"
mybot.server = "irc.freenode.org:6665"


@mybot.trigger()
def raw(event):
    # See everything from irc server and ircutil
    print(event.raw)


@mybot.trigger("WELCOME")
def autojoin(event):
    mybot.join('#ircutil')


@mybot.trigger("JOIN", priority=10)
def prio10(event):
    mybot.msg(event.chat, "prio 10")


@mybot.trigger("JOIN")  # default priority is 0
def prio(event):
    mybot.msg(event.chat, "prio 0")


@mybot.trigger("JOIN", priority=30)
예제 #2
0
#!/usr/bin/python3
"""
Simplistic bot that connects to IRC and prints what happens.
"""

import ircutil

mybot = ircutil.Connection()  # create a connection

# bot setup
mybot.nick = "ezBot"  # the bot's nick
mybot.server = "irc.freenode.org"  # the server to connect to


# handle IRC events
@mybot.trigger()  # run the function below on all IRC events
def raw(event):
    # See everything from IRC server and ircutil
    print(event.raw)  # print the event as raw, unprocessed text


# now connect to IRC, stay connected and reconnect automatically
mybot.connect()