<commit_before>require "cuba"
require "rack/protection"

require_relative "lib/goban"
require_relative "lib/slack"

Cuba.define do
  def forbidden!
    res.status = 403
    halt res.finish
  end

  on post, "boards" do
    forbidden! unless req.params["token"] == ENV.fetch("SLACK_TOKEN")

    puts req.params.inspect

    board_url = Goban.create

    payload = {
      channel:    "#test-integrations",
      username:   "Goban",
      icon_emoji: ":black_circle:",
      text:       board_url
    }

    Slack.post(payload)
  end
end<commit_msg>Change bot message to include the name of the user who ran the command<commit_after>require "cuba"
require "rack/protection"

require_relative "lib/goban"
require_relative "lib/slack"

Cuba.define do
  def forbidden!
    res.status = 403
    halt res.finish
  end

  on post, "boards" do
    forbidden! unless req.params["token"] == ENV.fetch("SLACK_TOKEN")

    puts req.params.inspect

    board_url = Goban.create

    payload = {
      channel:    "#test-integrations",
      username:   "Goban",
      icon_emoji: ":black_circle:",
      text:       "#{req.params["user_name"]} started a new game: <#{board_url}>"
    }

    Slack.post(payload)
  end
end
{'fraction_non_alphanumeric': 0.115990057995029, 'fraction_numerical': 0.004971002485501243, 'mean_word_length': 3.0, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 4, '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': '7596502', 'n_tokens_mistral': 426, 'n_tokens_neox': 411, 'n_words': 99}