<commit_before>require "slack"

module Janky
  module ChatService
    class Slack
      def initialize(settings)
        team = settings["JANKY_CHAT_SLACK_TEAM"]

        if team.nil? || team.empty?
          raise Error, "JANKY_CHAT_SLACK_TEAM setting is required"
        end

        token = settings["JANKY_CHAT_SLACK_TOKEN"]

        if token.nil? || token.empty?
          raise Error, "JANKY_CHAT_SLACK_TOKEN setting is required"
        end

        @client = ::Slack::Client.new(team, token)
      end

      def speak(message, room_id, options = {})
        @client.post_message(room_id, message, options)
      end

      def rooms
        @rooms ||= @client.channels.map do |channel|
          Room.new(channel['id'], channel['name'])
        end
      end
    end
  end
end<commit_msg>Adds missing chat service registration for slack<commit_after>require "slack"

module Janky
  module ChatService
    class Slack
      def initialize(settings)
        team = settings["JANKY_CHAT_SLACK_TEAM"]

        if team.nil? || team.empty?
          raise Error, "JANKY_CHAT_SLACK_TEAM setting is required"
        end

        token = settings["JANKY_CHAT_SLACK_TOKEN"]

        if token.nil? || token.empty?
          raise Error, "JANKY_CHAT_SLACK_TOKEN setting is required"
        end

        @client = ::Slack::Client.new(team, token)
      end

      def speak(message, room_id, options = {})
        @client.post_message(room_id, message, options)
      end

      def rooms
        @rooms ||= @client.channels.map do |channel|
          Room.new(channel['id'], channel['name'])
        end
      end
    end
  end

  register_chat_service "slack", ChatService::Slack
end
{'fraction_non_alphanumeric': 0.09679334916864608, 'fraction_numerical': 0.0, 'mean_word_length': 2.417849898580122, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6622728', 'n_tokens_mistral': 534, 'n_tokens_neox': 525, 'n_words': 126}