diff options
author | Teddy Wing | 2017-09-14 03:44:38 +0200 |
---|---|---|
committer | Teddy Wing | 2017-09-14 03:44:38 +0200 |
commit | ea190de02cea99347ae125d86cc22bf8cd926c88 (patch) | |
tree | 2c5756af9a7fe86128f12117f5948282d0be4103 /src/Plugin/GitRemoteSetOrigin.hs | |
parent | cd366dc004b82f0ea937da231cbc1c9abfdca934 (diff) | |
download | sorbot-ea190de02cea99347ae125d86cc22bf8cd926c88.tar.bz2 |
Add `Bot` to rest of plugins
Add our `Bot` monad to the rest of the plugins:
* Factorial
* GitRemoteSetOrigin
* Help
The only problem is with the Help plugin. Still trying to figure out how
to set up my list comprehension so that it works with the `Bot`-wrapped
`Plugin` list.
Diffstat (limited to 'src/Plugin/GitRemoteSetOrigin.hs')
-rw-r--r-- | src/Plugin/GitRemoteSetOrigin.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Plugin/GitRemoteSetOrigin.hs b/src/Plugin/GitRemoteSetOrigin.hs index 0fdb4ef..7d46e46 100644 --- a/src/Plugin/GitRemoteSetOrigin.hs +++ b/src/Plugin/GitRemoteSetOrigin.hs @@ -10,10 +10,12 @@ import qualified Data.Text as T import Database.SQLite.Simple import Text.Regex.TDFA ((=~)) +import Bot (Bot) import qualified Message as M import Plugin.Base -gitRemoteSetOrigin = defaultPlugin +gitRemoteSetOrigin :: Bot Plugin +gitRemoteSetOrigin = return defaultPlugin { matchRegex = "^git remote set origin ([^ ]+)$" , perform = gitRemoteSetOriginAction , command = "git remote set origin <url>" @@ -22,7 +24,8 @@ gitRemoteSetOrigin = defaultPlugin gitRemoteSetOriginAction :: PluginAction gitRemoteSetOriginAction message = do - case M.textStr message =~ matchRegex gitRemoteSetOrigin :: [[String]] of + plugin <- gitRemoteSetOrigin + case M.textStr message =~ matchRegex plugin :: [[String]] of [] -> return $ Left "blast" (m:_) -> do let url = last m |