diff options
author | Teddy Wing | 2017-08-03 20:15:19 +0200 |
---|---|---|
committer | Teddy Wing | 2017-08-03 20:15:19 +0200 |
commit | 5070ee3f46a7b9cd796594736ebd48d8270a7ff6 (patch) | |
tree | e1e761263cb4acf1d292bf7188df450abda8c9cb | |
parent | ec4e955566049551fb7b82cc9d935981eee7df01 (diff) | |
download | sorbot-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.
-rw-r--r-- | src/Plugin/GitHubCommit.hs | 7 |
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 [] = "" |