From 6961ef49cbcb88e4f3466a5852a4cf90d95a587a Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 19 Nov 2017 19:22:19 +0100 Subject: Lib: Test application of Bot reader A test to try to get _something_ to compile. And it does! Here we try to run a plugin with `runReaderT` and `runBot` to pass `Options` to the plugin, using the "help" plugin as an example. It feeds hard-coded `Options` to the plugin and outputs its response to STDOUT. Also get an implementation of `initializePlugins` working that will allow us to build a list of plugins with `Options` applied to the reader. This commit comments out the whole of IRC.hs in order to get the code to compile. That file still has a bunch of `Bot` monad-related type errors. To build the final plugin list, I think what we'll want to do is use something like `initializePlugins` in Lib to apply all our plugins with the `Options` and then feed that to `connectIRC`. In order to build the "help" plugin, the plan is to re-apply the `Options` after `ask`ing for them inside the `PluginAction` for "help" to all plugins, thus enabling us to get a plugin list with the applied reader for proper localisation of the help output. --- src/Plugin/Help.hs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/Plugin/Help.hs') diff --git a/src/Plugin/Help.hs b/src/Plugin/Help.hs index ebe3760..7694e87 100644 --- a/src/Plugin/Help.hs +++ b/src/Plugin/Help.hs @@ -32,5 +32,7 @@ helpAction _ = do where longestCommandLen plugins = foldr (max) 0 (map (T.length . command) plugins) +-- TODO: Build a new plugin list _in the help plugin_ that applies Config to a +-- list of plugins and uses that to render the text plugins :: [Bot Plugin] plugins = PL.plugins ++ [help] -- cgit v1.2.3