Skip to content

Conversation

@lucyllewy
Copy link

I've used typescript for this PR so running the bot will require compiling the .ts files into .js first.

Plugins are all stored in ./plugins/<messageType>/<arbitraryName>.

The messageType is any IRC message type as sent from irc.Client (the bot object) in it's events. i.e. if you would normally handle with code like:

bot.addEventListener('registered', function(message: string) {
    // handle the registered event
});

Then you can instead add a file into ./plugins/registered with content similar to:

export default (bot: irc.Client) => {
    return ([message]: [string]) => {
        // Handle the event here
    }
}

You need to have an export called default which is a function accepting a single argument to store the bot object. This function should then return a closure which accepts the arguments appropriate for the specific event the plugin is handling as raised by the irc module.

Daniel Llewellyn added 3 commits December 16, 2016 16:56
- currently only covers commands
- some commands which need to maintain state such as seen might not work properly yet!
plugins now handle filtering (kinda)
this is awesome. and won't eat your babies!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant