main :: IO ()
main = do
  apiToken <- fromMaybe (error "SLACK_API_TOKEN not set")
               <$> lookupEnv "SLACK_API_TOKEN"
  args <- getArgs
  scripts <- mapM getLines args

  let opts = defaults & param "token" .~ [T.pack apiToken]
  r <- getWith opts "https://slack.com/api/channels.list"
  let generalId' = r ^? responseBody . key "channels"
                                     . values
                                     . filtered (\c -> c ^. key "name" . _String == "general")
                                     . key "id" . _String
      generalId = maybe (error "#general not found") id generalId'

      bot = filterBot (\i -> view getId i /= generalId) $ textBot (reply scripts)

  runBot (myConfig apiToken) bot ()
main :: IO ()
main = do
  apiToken <- fromMaybe (error "SLACK_API_TOKEN not set")
               <$> lookupEnv "SLACK_API_TOKEN"
  args <- getArgs
  scripts <- mapM getLines args

  let opts = defaults & param "token" .~ [T.pack apiToken]
  r <- getWith opts "https://slack.com/api/channels.list"
  let generalId' = r ^? responseBody . key "channels"
                                     . values
                                     . filtered (\c -> c ^. key "name" . _String == "general")
                                     . key "id" . _String
      generalId = maybe (error "#general not found") id generalId'

      bot = filterBot (\i -> view getId i /= generalId) $ textBot (reply scripts)

  runBot (myConfig apiToken) bot ()
main = do
  apiToken <- fromMaybe (error "SLACK_API_TOKEN not set")
               <$> lookupEnv "SLACK_API_TOKEN"
  args <- getArgs
  scripts <- mapM getLines args

  let opts = defaults & param "token" .~ [T.pack apiToken]
  r <- getWith opts "https://slack.com/api/channels.list"
  let generalId' = r ^? responseBody . key "channels"
                                     . values
                                     . filtered (\c -> c ^. key "name" . _String == "general")
                                     . key "id" . _String
      generalId = maybe (error "#general not found") id generalId'

      bot = filterBot (\i -> view getId i /= generalId) $ textBot (reply scripts)

  runBot (myConfig apiToken) bot ()