First, simply copy the the irc
directory into your project. You can then use the connector like so:
from irc import IRC
# Create an IRC instance
irc = IRC("irc.example.com", 6697, "test-user", "test-user")
# Connect to the server
irc.connect()
# Read the first message
print(next(irc.messages))
# Send a message
irc.send_message("#bot-test", "Hello, world!")
- Easy to use
- Highly extensible
- Thread safe
- Supports TLS
- Zero dependencies
- Low-level socket API built for speed and efficiency
- Uses typing
- Handles message splitting etc. automatically
- Automatic reconnect
- Heavily analysed using several static analyzers
There are multiple examples available in the examples
directory. To run one of them, simply execute the following command:
python3 -m examples.ping --server irc.example.com --user test --nick test
Some of the examples feature verbose logging to show what's happening. In production, this library is nowhere near as verbose. As this library is using the built-in logging library, logging can also be completely turned off or modified.
Any contribution is welcome. If you're not able to code it yourself, perhaps someone else is - so post an issue if there's anything on your mind.
Clone the repository:
git clone https://github.com/AlexGustafsson/irc-python
Setup a virtual environment and dependencies:
make setup
Write code and commit it.
Follow the conventions enforced:
make static-analysis
Test the project:
make test
Although the project is very capable, it is not built with production in mind. Therefore there might be complications when trying to use the connector for large-scale projects meant for the public. The bot was created to easily connect to IRC and as such it might not promote best practices nor be performant.