Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/belak/python-seabird
Simple proof of concept IRC bot using Python's asyncio module
https://github.com/belak/python-seabird
Last synced: about 2 months ago
JSON representation
Simple proof of concept IRC bot using Python's asyncio module
- Host: GitHub
- URL: https://github.com/belak/python-seabird
- Owner: belak
- License: mit
- Created: 2015-06-29T06:33:27.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-09-16T17:42:15.000Z (over 2 years ago)
- Last Synced: 2024-10-19T05:51:50.597Z (3 months ago)
- Language: Python
- Homepage:
- Size: 117 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# seabird
![Build Status](https://drone.coded.io/api/badges/belak/python-seabird/status.svg)
AKA the bot formerly known as the bot formerly known as seabird
## Goals
* Simple framework
* Clean code
* Only stdlib in core (irc portion)## Setup
Required dependencies for core:
* python3.5 or greater
Install python plugin dependencies:
* pip install -r requirements.txt
The default distribution of seabird needs to be configured before it will do
anything. It will import the config module. The simplest option is to copy the
sample file provided at [config.dist.py](config.dist.py) to config.py, though
the important settings are outlined below:### Basic settings
| Setting | Required | Description |
|----------------------+----------+---------------------------------------------------------|
| NICK | Yes | IRC nickname |
| PASS | | IRC password |
| USER | Yes | IRC username |
| NAME | Yes | IRC full name |
| HOST | Yes | Hostname of the IRC server to connect to |
| PORT | Yes | Port of the IRC server to connect to |
| CMDS | | List of commands to run after a welcome msg is received |
| PLUGIN_CLASSES | | List of plugin classes to load |
| PLUGIN_MODULES | | List of plugin modules to load |
| RECONNECT_DELAY | | Delay between connection lost and reconnecting. |
| RECONNECT_ON_FAILURE | | Reconnect on connection lost |
| SSL | | True if the server needs SSL, False otherwise |
| SSL_VERIFY | | True if the server has a valid cert, False otherwise |### Plugin settings
| Setting | Required for plugin | Description |
|--------------+----------------------+---------------------------------------------|
| PREFIX | For commands to work | Prefix to look for in messages for commands |
| FORECAST_KEY | Weather | API key for forecast.io |
| DB_URI | DB, karma, weather | SQLAlchemy Database URI |### Running seabird
seabird can be run with the command `python -m seabird`
## asyncio
In order to start background processing, simply grab the event loop and add a
task. Events will be processed one at a time, but when you create a task it will
fall back to the main event loop. This allows IRC messages to be processed in
the order they come in, but still makes it possible to move time consuming
operations into the background.As an example:
``` python
async def callback(msg):
print('do a thing')loop = asyncio.get_event_loop()
loop.create_task(callback(msg))
```