aboutsummaryrefslogtreecommitdiffstats
path: root/src/Plugin/GitHubCommit.hs
diff options
context:
space:
mode:
authorTeddy Wing2017-08-03 20:15:19 +0200
committerTeddy Wing2017-08-03 20:15:19 +0200
commit5070ee3f46a7b9cd796594736ebd48d8270a7ff6 (patch)
treee1e761263cb4acf1d292bf7188df450abda8c9cb /src/Plugin/GitHubCommit.hs
parentec4e955566049551fb7b82cc9d935981eee7df01 (diff)
downloadsorbot-5070ee3f46a7b9cd796594736ebd48d8270a7ff6.tar.bz2
GitHubCommit.hs: Select row corresponding to correct channel
Ask for the row corresponding to the channel received from the chat message. This gets rid of the previously hard-coded SQL and allows us to dynamically get the right URL value.
Diffstat (limited to 'src/Plugin/GitHubCommit.hs')
-rw-r--r--src/Plugin/GitHubCommit.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Plugin/GitHubCommit.hs b/src/Plugin/GitHubCommit.hs
index a12087c..2786ca6 100644
--- a/src/Plugin/GitHubCommit.hs
+++ b/src/Plugin/GitHubCommit.hs
@@ -18,9 +18,12 @@ gitHubCommit = Plugin
gitHubCommitAction :: PluginAction
gitHubCommitAction message dbConn = do
- rs <- query_ dbConn "SELECT channel, repo_url \
+ rs <- query dbConn "SELECT channel, repo_url \
\ FROM plugin_github_commit_channel_repo_urls \
- \ LIMIT 1" :: IO [ChannelRepoUrl]
+ \ WHERE channel = ? \
+ \ LIMIT 1"
+ (Only (M.channel message))
+ :: IO [ChannelRepoUrl]
return $ response rs
where
response [] = ""