diff options
Diffstat (limited to 'src/Plugin')
-rw-r--r-- | src/Plugin/Base.hs | 4 | ||||
-rw-r--r-- | src/Plugin/GitHubCommit.hs | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/Plugin/Base.hs b/src/Plugin/Base.hs index 6ba4ca5..62900c7 100644 --- a/src/Plugin/Base.hs +++ b/src/Plugin/Base.hs @@ -4,11 +4,13 @@ module Plugin.Base , Plugin(..) ) where +import qualified Data.Text as T + import Database.SQLite.Simple import Message -type PluginAction = Message -> IO (Either String String) +type PluginAction = Message -> IO (Either T.Text T.Text) data Plugin = Plugin { matchRegex :: String diff --git a/src/Plugin/GitHubCommit.hs b/src/Plugin/GitHubCommit.hs index 9773690..ee694b4 100644 --- a/src/Plugin/GitHubCommit.hs +++ b/src/Plugin/GitHubCommit.hs @@ -4,6 +4,8 @@ module Plugin.GitHubCommit ( gitHubCommit ) where +import qualified Data.Text as T + import Database.SQLite.Simple import Database.SQLite.Simple.FromRow import Text.Regex.TDFA @@ -33,11 +35,12 @@ gitHubCommitAction message = do Left "I couldn't find a repo URL for this channel. \ \Try `git remote set origin REPO_URL`." respond ((RepoUrlRow r):_) = - Right $ r ++ "/commits/" ++ M.text message =~ matchRegex gitHubCommit + Right $ r `T.append` "/commits/" `T.append` T.pack ( + (T.unpack $ M.text message) =~ matchRegex gitHubCommit) type Id = Int -type RepoUrl = String +type RepoUrl = T.Text -- | A type to match the database table for this plugin. data RepoUrlRow = RepoUrlRow RepoUrl |