numberoverzero / bottom

asyncio-based rfc2812-compliant IRC Client
http://bottom-docs.readthedocs.io
MIT License
74 stars 23 forks source link

Support aliasing irc commands #30

Open numberoverzero opened 8 years ago

numberoverzero commented 8 years ago

(first proposed in #29)

Following the rfc2812 spec leaves some particular warts, especially when it comes to the historical command names like RPL_WHOREPLY and RPL_NAMREPLY.

There should be an easy way to specify a set of aliases when hooking into the rfc commands, so that reading the code is more natural.

This isn't the intended implementation, just a quick example of how the bot.on would hook up for some alias:

@bot.on("who_response")
def handle(...):
    ...

bot.aliases["RPL_WHOREPLY"].add("who_response")

I don't know if there's a risk of confusing a custom event for an irc command, but I think that's always been possible since there's no restriction on what the client can trigger. Worth considering but probably not an issue.