<commit_before>require "houston/slack/channel"
require "houston/slack/conversation"
require "houston/slack/driver"
require "houston/slack/event"
require "houston/slack/listener"
require "houston/slack/user"
require "houston/slack/errors"
require "faraday"

module Houston
  module Slack
    class Connection
      EVENT_MESSAGE = "message".freeze
      EVENT_GROUP_JOINED = "group_joined".freeze
      EVENT_USER_JOINED = "team_join".freeze
      ME = "@houston".freeze
      
      def initialize
        @user_ids_dm_ids = {}
        @users_by_id = {}
        @user_id_by_name = {}
        @groups_by_id = {}
        @group_id_by_name = {}
        @channels_by_id = {}
        @channel_id_by_name = {}
      end
      
      
      
      def send_message(message, options={})
        channel = options.fetch(:channel) { raise ArgumentError, "Missing parameter :channel" }
        attachments = Array(options[:attachments])
        params = {
          channel: to_channel_id(channel),
          text: message,
          as_user: true, # post as the authenticated user (rather than as slackbot)
          link_names: 1} # find and link channel names and user names
        params.merge!(attachments: MultiJson.dump(attachments)) if attachments.any?
        api("chat.postMessage", params)
      end<commit_msg>[skip] Allowed passing more options to Slack.send_message (8m)<commit_after>require "houston/slack/channel"
require "houston/slack/conversation"
require "houston/slack/driver"
require "houston/slack/event"
require "houston/slack/listener"
require "houston/slack/user"
require "houston/slack/errors"
require "faraday"

module Houston
  module Slack
    class Connection
      EVENT_MESSAGE = "message".freeze
      EVENT_GROUP_JOINED = "group_joined".freeze
      EVENT_USER_JOINED = "team_join".freeze
      ME = "@houston".freeze
      
      def initialize
        @user_ids_dm_ids = {}
        @users_by_id = {}
        @user_id_by_name = {}
        @groups_by_id = {}
        @group_id_by_name = {}
        @channels_by_id = {}
        @channel_id_by_name = {}
      end
      
      
      
      def send_message(message, options={})
        channel = options.fetch(:channel) { raise ArgumentError, "Missing parameter :channel" }
        attachments = Array(options[:attachments])
        params = {
          channel: to_channel_id(channel),
          text: message,
          as_user: true, # post as the authenticated user (rather than as slackbot)
          link_names: 1} # find and link channel names and user names
        params.merge!(attachments: MultiJson.dump(attachments)) if attachments.any?
        params.merge!(options.slice(:username, :as_user, :parse, :link_names,
          :unfurl_links, :unfurl_media, :icon_url, :icon_emoji))
        api("chat.postMessage", params)
      end
{'fraction_non_alphanumeric': 0.10404829545454546, 'fraction_numerical': 0.001065340909090909, 'mean_word_length': 2.8016194331983804, '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': '3928321', 'n_tokens_mistral': 877, 'n_tokens_neox': 862, 'n_words': 184}