aboutsummaryrefslogtreecommitdiffstats
path: root/src/Plugin
diff options
context:
space:
mode:
Diffstat (limited to 'src/Plugin')
-rw-r--r--src/Plugin/Base.hs3
-rw-r--r--src/Plugin/GitHubCommit.hs5
2 files changed, 6 insertions, 2 deletions
diff --git a/src/Plugin/Base.hs b/src/Plugin/Base.hs
index fe3a0f8..4e63fdd 100644
--- a/src/Plugin/Base.hs
+++ b/src/Plugin/Base.hs
@@ -9,7 +9,8 @@ import Database.SQLite.Simple
import Message
-- TODO: Replace Connection with a type class
-type PluginAction = Message -> Connection -> IO (Either String String)
+-- type PluginAction = Message -> Connection -> IO (Either String String)
+type PluginAction = Message -> IO (Either String String)
data Plugin = Plugin
{ matchRegex :: String
diff --git a/src/Plugin/GitHubCommit.hs b/src/Plugin/GitHubCommit.hs
index 492fd30..9773690 100644
--- a/src/Plugin/GitHubCommit.hs
+++ b/src/Plugin/GitHubCommit.hs
@@ -17,13 +17,16 @@ gitHubCommit = Plugin
}
gitHubCommitAction :: PluginAction
-gitHubCommitAction message dbConn = do
+gitHubCommitAction message = do
+ dbConn <- open "db/sorbot_development.sqlite3"
rs <- query dbConn "SELECT repo_url \
\ FROM plugin_github_commit_channel_repo_urls \
\ WHERE channel = ? \
\ LIMIT 1"
(Only (M.channel message))
:: IO [RepoUrlRow]
+ close dbConn
+
return $ respond rs
where
respond [] =