aboutsummaryrefslogtreecommitdiffstats

PyRC

An IRC library written in Python

License

BSD 3-Clause. See LICENSE.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/python

import PyRC
import sys
import time

Irc = PyRC.Client()

Irc.connect(host='irc.example.com')

# Give the server a moment to respond
time.sleep(2.0)

print Irc.main_loop()

Irc.join("#example)

print Irc.main_loop()

Irc.message('#example', 'PyRC Bot is listening')

print Irc.main_loop()

while True:
    try:
        msgs = Irc.main_loop()
        if msgs:
            for line in msgs:
              print line
        time.sleep(1.0)
        msgs = []
    except KeyboardInterrupt:
        Irc.quit('Powered by PyRC Bot')


Copyright (c) 2009-2015, Daniel Washburn. All rights reserved.