<commit_before>// Example usage of papaBot.
package main

import (
	"flag"
	"fmt"
	"github.com/pawelszydlo/papa-bot"
	"github.com/pawelszydlo/papa-bot/extensions"
	"time"
)

var (
	configFile = flag.String("c", "config.ini", "Path to TOML configuration file for the bot.")
	textsFile  = flag.String("t", "texts.ini", "Path to TOML configuration file with the bot texts.")
)

func init() {
	flag.Parse()
}

// Create your own extension simply by embedding the Extension struct.
type MyExtension struct {
	extensions.Extension
	startTime time.Time
}

// Override any methods you need. For more help please take a look at bot's built in extensions.

// Will be run on bot's init or when extension is registered after bot's init.
func (ext *MyExtension) Init(bot *papaBot.Bot) error {
	ext.startTime = time.Now()
	return nil
}

// Will be run every 5 minutes. Daily will be set to true once per day.
func (ext *MyExtension) Tick(bot *papaBot.Bot, daily bool) {
	bot.SendMassNotice(
		fmt.Sprintf("I have been running for %.0f minutes now.", time.Since(ext.startTime).Minutes()))
}

// Will be run whenever an URL is found in the message.
// func (ext *MyExtension) ProcessURL(bot *papaBot.Bot, info *papaBot.UrlInfo, channel, sender, msg string) {}

// Will be run on every public message the bot receives.
// func (ext *MyExtension) ProcessMessage(bot *papaBot.Bot, channel, nick, msg string) {}

// Entry point
func main() {
	bot := papaBot.New(*configFile, *textsFile)
	extensions.RegisterBuiltinExtensions(bot)
	bot.MustRegisterExtension(new(MyExtension))
	bot.Run()
}
<commit_msg>Reformat example.<commit_after>// Example usage of papaBot.
package main

import (
	"flag"
	"fmt"
	"github.com/pawelszydlo/papa-bot"
	"github.com/pawelszydlo/papa-bot/extensions"
	"time"
)

var (
	configFile = flag.String("c", "config.ini", "Path to TOML configuration file for the bot.")
	textsFile  = flag.String("t", "texts.ini", "Path to TOML configuration file with the bot texts.")
)

func init() {
	flag.Parse()
}

// Create your own extension simply by embedding the Extension struct.
type MyExtension struct {
	extensions.Extension
	startTime time.Time
}

// Override any methods you need. For more help please take a look at bot's built in extensions.

// Will be run on bot's init or when extension is registered after bot's init.
func (ext *MyExtension) Init(bot *papaBot.Bot) error {
	ext.startTime = time.Now()
	return nil
}

// Will be run every 5 minutes. Daily will be set to true once per day.
func (ext *MyExtension) Tick(bot *papaBot.Bot, daily bool) {
	bot.SendMassNotice(
		fmt.Sprintf("I have been running for %.0f minutes now.", time.Since(ext.startTime).Minutes()))
}

// Will be run whenever an URL is found in the message.
// func (ext *MyExtension) ProcessURL(bot *papaBot.Bot, info *papaBot.UrlInfo, channel, sender, msg string) {}

// Will be run on every public message the bot receives.
// func (ext *MyExtension) ProcessMessage(bot *papaBot.Bot, channel, nick, msg string) {}

// Entry point
func main() {
	// This will create bot's structures. Feel free to modify what you need afterwards.
	bot := papaBot.New(*configFile, *textsFile)

	// As an example, change the name.
	bot.Config.Name = "David"

	// Add all built-in extensions.
	extensions.RegisterBuiltinExtensions(bot)

	// Add your own custom extension.
	bot.MustRegisterExtension(new(MyExtension))

	// This will init the bot's mechanisms and run the bot's main loop.
	bot.Run()
}

{'fraction_non_alphanumeric': 0.11780028943560057, 'fraction_numerical': 0.0011577424023154848, 'mean_word_length': 4.023255813953488, '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': '4467623', 'n_tokens_mistral': 1120, 'n_tokens_neox': 1104, 'n_words': 403}