irc-fun-bot-0.5.0.0: Library for writing fun IRC bots.

Safe HaskellNone
LanguageHaskell2010

Network.IRC.Fun.Bot

Description

This module allows you to define bot event handlers and commands, and then just run event source and sink threads in your main function and let them handle all the details.

Synopsis

Documentation

defConfig :: Config Source

A default bot configuration. You can use it with record syntax to override just the fields you need. It also allows your code to remain valid when a new config option is added, since you won't be using the Config constructor directy.

In the future the constructor may be removed, and then this function will be the only way to create a configuration. It allows adding a field without incrementing the library's major version and breaking compatibility.

runBot Source

Arguments

:: Config

IRC connection configuration

-> [EventMatcher e s]

Event detection (high-to-low priority)

-> Behavior e s

Behavior definition for IRC events

-> [EventSource e s a]

Additional event source threads to run

-> EventHandler e s a

Handler for events coming from those sources

-> e

Custom bot environment (read-only state)

-> s

Initial state to hold in the background

-> Session e s ()

Initialization action to run at the very beginning of the session

-> IO () 

Start the bot and run its event loop. The bot will listen to messages from the IRC server and other provided sources, and will respond according to the behavior definitions.