relay
An irc micro-framework that smells too much like a web framework.
Relay is a toy project, its goals were for me to try out framework design, learn more about the IRC protocol, and to be a replacement for the available irc python libraries: most of them did not please me.
Installation
I suggest you use a virtualenv
$ pip install relay-framework
Example
This is an example of a bot that sends whatever is send after ‘!echo ‘ in a PRIVMSG:
from relay import Relay, auto_join, auto_pong
from relay.constants import privmsg
bot = Relay("echobot")
@bot.handler(privmsg)
def echo(target, message, sender, *args, **kwargs):
if not message.startswith("!echo "):
return
sender_nick = sender.split('@')[0].split('!')[0] # We just want the nick
message = message[6:] # We just want whatever is after '!echo '
if target == bot.client['nick']:
result = "PRIVMSG {sender_nick} :{sender_nick}: {message}"
else:
result = "PRIVMSG {{target}} :{sender_nick}: {message}"
yield result.format(sender_nick=sender_nick, message=message)
if __name__ == "__main__":
bot.register(auto_pong)
bot.register(auto_join(['#tests']))
bot.config(from_env=True).run()
And to run it:
$ RELAY_HOST=irc.example.net RELAY_NICK=echobot python echobot.py
Changelog
- 0.1.0:
Initial version, client accepts handlers, connects and matches data with those.
Todo
Write a decent IRC client implementation
Write tests for the Relay class
Write documentation
Subclass Relay to allow regexp routes
Metadata
Release files for relay-framework 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| relay-framework-0.2.0.tar.gz | 5.3 kB | Without provenance | Details for relay-framework-0.2.0.tar.gz |
Release files / relay-framework-0.2.0.tar.gz
| Download URL | relay-framework-0.2.0.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e6a9ce04c6f210134530793a89055716a905f8a4fd17794457edeab172f9a83
|
|
BLAKE2b-256 checksum How to use checksums |
ed92868a960594aca70ae2a3ddfc4c68bae21b5cc784969d1e8a4e29c231942e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for relay-framework 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.