<commit_before>package main

import (
	"fmt"
	"image"
	_ "image/jpeg"
	"net/http"

	"github.com/paked/configure"
	"github.com/paked/gg"
	"github.com/paked/messenger"
)

type MessageState int

var (
	conf        = configure.New()
	verifyToken = conf.String("verify-token", "<PASSWORD>", "The token used to verify facebook")
	verify      = conf.Bool("should-verify", false, "Whether or not the app should verify itself")
	pageToken   = conf.String("page-token", "not <PASSWORD>", "The token that is used to verify the page on facebook")
	font        = conf.String("font", "fonts/Economica-Bold.ttf", "The font you want the meme maker to use")

	states map[int64]MessageState
	memes  map[int64]*Meme

	client *messenger.Messenger
)

const (
	NoAction MessageState = iota
	MakingMeme

	fontSize = 20
)

func init() {
	conf.Use(configure.NewFlag())
	conf.Use(configure.NewEnvironment())
	conf.Use(configure.NewJSONFromFile("config.json"))
}

func main() {
	conf.Parse()

	memes = make(map[int64]*Meme)
	states = make(map[int64]MessageState)

	client = messenger.New(messenger.Options{
		Verify:      *verify,
		VerifyToken: *verifyToken,
		Token:       *pageToken,
	})

	client.HandleMessage(messages)

	fmt.Println("Serving messenger bot on localhost:8080")

	http.ListenAndServe("localhost:8080", client.Handler())
}

func messages(m messenger.Message, r *messenger.Response) {
	from, err := client.ProfileByID(m.Sender.ID)
	if err != nil {
		fmt.Println("error getting profile:", err)
		return
	}

	fmt.Println(m.Sender.ID)

	state := messageState(m.Sender)

	switch state {
	case NoAction:
		r.Text(fmt.Sprintf("Greetings, %v? You're here to make a meme?", from.FirstName))
		r.Text("If so, you are in just the right place.")
		r.Text("All you need to do is send me a picture and a line of text to put on that picture!")

		setState(m.Sender, MakingMeme)
	case MakingMeme:
		meme := messageMeme(m.Sender)

		if len(m.Attachments) > 0 {
			a := m.Attachments[0]
			if a.Type != "image" {
				r.Text("Sorry to be a sad pepe. Unfortunately you're going to need to send an image")
			}

			meme.ImageURL = a.Payload.URL
		}

		if m.Text != "" {
			meme.Text = m.Text
		}

		if meme.Ready() {
			err = r.Image(meme.Make())
			if err != nil {
				fmt.Println("error encoding image:", err)
				return
			}
<commit_msg>Convert text to caps<commit_after>package main

import (
	"fmt"
	"image"
	_ "image/jpeg"
	"net/http"
	"strings"

	"github.com/paked/configure"
	"github.com/paked/gg"
	"github.com/paked/messenger"
)

type MessageState int

var (
	conf        = configure.New()
	verifyToken = conf.String("verify-token", "<PASSWORD>", "The token used to verify facebook")
	verify      = conf.Bool("should-verify", false, "Whether or not the app should verify itself")
	pageToken   = conf.String("page-token", "not <PASSWORD>", "The token that is used to verify the page on facebook")
	font        = conf.String("font", "fonts/Economica-Bold.ttf", "The font you want the meme maker to use")

	states map[int64]MessageState
	memes  map[int64]*Meme

	client *messenger.Messenger
)

const (
	NoAction MessageState = iota
	MakingMeme

	fontSize = 20
)

func init() {
	conf.Use(configure.NewFlag())
	conf.Use(configure.NewEnvironment())
	conf.Use(configure.NewJSONFromFile("config.json"))
}

func main() {
	conf.Parse()

	memes = make(map[int64]*Meme)
	states = make(map[int64]MessageState)

	client = messenger.New(messenger.Options{
		Verify:      *verify,
		VerifyToken: *verifyToken,
		Token:       *pageToken,
	})

	client.HandleMessage(messages)

	fmt.Println("Serving messenger bot on localhost:8080")

	http.ListenAndServe("localhost:8080", client.Handler())
}

func messages(m messenger.Message, r *messenger.Response) {
	from, err := client.ProfileByID(m.Sender.ID)
	if err != nil {
		fmt.Println("error getting profile:", err)
		return
	}

	fmt.Println(m.Sender.ID)

	state := messageState(m.Sender)

	switch state {
	case NoAction:
		r.Text(fmt.Sprintf("Greetings, %v? You're here to make a meme?", from.FirstName))
		r.Text("If so, you are in just the right place.")
		r.Text("All you need to do is send me a picture and a line of text to put on that picture!")

		setState(m.Sender, MakingMeme)
	case MakingMeme:
		meme := messageMeme(m.Sender)

		if len(m.Attachments) > 0 {
			a := m.Attachments[0]
			if a.Type != "image" {
				r.Text("Sorry to be a sad pepe. Unfortunately you're going to need to send an image")
			}

			meme.ImageURL = a.Payload.URL
		}

		if m.Text != "" {
			meme.Text = strings.ToUpper(m.Text)
		}

		if meme.Ready() {
			err = r.Image(meme.Make())
			if err != nil {
				fmt.Println("error encoding image:", err)
				return
			}

{'fraction_non_alphanumeric': 0.1377013963480129, 'fraction_numerical': 0.008592910848549946, 'mean_word_length': 3.717325227963526, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '1701800', 'n_tokens_mistral': 1803, 'n_tokens_neox': 1632, 'n_words': 428}