aboutsummaryrefslogtreecommitdiffstats
path: root/src/Plugin.hs
diff options
context:
space:
mode:
authorTeddy Wing2017-07-30 19:40:25 +0200
committerTeddy Wing2017-07-30 19:40:25 +0200
commit459ede29282b268d60a3ef73a54098df81816b60 (patch)
treefaf03aebf48abfb65c717b9fefc702c42459efbc /src/Plugin.hs
parente4b00259ec4c1338f766561aba3b7a3a3159d216 (diff)
downloadsorbot-459ede29282b268d60a3ef73a54098df81816b60.tar.bz2
Move GitHub Commit plugin to its own module
Extract the GitHub commit plugin code from "Plugin.hs" into its own module. Now that we have things more set up and working to a certain degree, we can split the code out.
Diffstat (limited to 'src/Plugin.hs')
-rw-r--r--src/Plugin.hs9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/Plugin.hs b/src/Plugin.hs
index 41b0296..da38943 100644
--- a/src/Plugin.hs
+++ b/src/Plugin.hs
@@ -7,6 +7,7 @@ module Plugin
import Text.Regex.TDFA
import Plugin.Base
+import Plugin.GitHubCommit
matchPlugin :: String -> Maybe Plugin
matchPlugin message = firstPlugin $ matchPlugins message plugins
@@ -20,14 +21,6 @@ matchPlugins message plugins = [p | p <- plugins, message =~ matchRegex p]
performPlugin :: Plugin -> String -> String
performPlugin p message = perform p $ message =~ matchRegex p
-gitHubCommit = Plugin
- { matchRegex = "^[0-9a-f]{40}$"
- , perform = gitHubCommitAction
- }
-
-gitHubCommitAction :: PluginAction
-gitHubCommitAction match = "https://github.com/" ++ match
-
plugins :: [Plugin]
plugins =
[ gitHubCommit