<commit_before>package main

import (
	"bufio"
	"fmt"
	"os"
	"flag"

	"github.com/nlopes/slack"
)

func main() {
	slackToken := flag.String("token", "", "slack token")
	slackChannel := flag.String("channel", "#random", "slack post message channelID or channelName")
	flag.Parse()

	var message string
	message += "```"
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		message += scanner.Text()
		message += "\n"
	}
	if err := scanner.Err(); err != nil {
		fmt.Fprintln(os.Stderr, "reading standard input:", err)
		os.Exit(2)
	}

	message += "```"

	slackClient := slack.New(*slackToken)
	_, _, err := slackClient.PostMessage(*slackChannel, message, slack.NewPostMessageParameters())
	if err != nil {
		fmt.Fprintln(os.Stderr, "slack post message error:", err)
		os.Exit(2)
	}
}
<commit_msg>fix post size<commit_after>package main

import (
	"bufio"
	"flag"
	"fmt"
	"os"

	"github.com/nlopes/slack"
)

var messageFormat = "```\n%s\n```"

type Slack struct {
	*slack.Slack
	channelName string
	dryRun      bool
}

func main() {
	slackToken := flag.String("token", "", "slack token")
	if *slackToken == "" {
		*slackToken = os.Getenv("SLACK_TOKEN")
	}
	slackChannel := flag.String("channel", "", "slack post message channelID or channelName")
	if *slackChannel == "" {
		*slackChannel = os.Getenv("SLACK_CHANNEL")
	}
	dryRun := flag.Bool("dry-run", false, "dry-run")
	flag.Parse()

	slackClient := Slack{
		Slack:       slack.New(*slackToken),
		channelName: *slackChannel,
		dryRun:      *dryRun,
	}

	var message string
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		message += scanner.Text()
		message += "\n"

		if len(message) >= 5000 {
			slackClient.postMessage(fmt.Sprintf(messageFormat, message))
			message = ""
		}
	}
	if err := scanner.Err(); err != nil {
		fmt.Fprintln(os.Stderr, "reading standard input:", err)
		os.Exit(2)
	}
}

func (s Slack) postMessage(message string) error {
	if s.dryRun {
		fmt.Println(message)
		return nil
	}
	_, _, err := s.Slack.PostMessage(s.channelName, message, slack.NewPostMessageParameters())
	return err
}
{'fraction_non_alphanumeric': 0.16954851104707014, 'fraction_numerical': 0.0033621517771373678, 'mean_word_length': 4.043583535108959, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5137613', 'n_tokens_mistral': 831, 'n_tokens_neox': 773, 'n_words': 165}