<commit_before>package lib

import (
	"encoding/json"
	"fmt"
	"log"
	"os"
	"strings"

	"github.com/jh-bate/fantail-bot/Godeps/_workspace/src/github.com/tucnak/telebot"
)

const (
	//being a good citizen
	start_cmd, help_cmd = "/start", "/help"

	chat_cmd, remind_cmd, say_cmd, reminders_cmd, said_cmd = "/chat", "/remind", "/say", "/reminders", "/said"

	remind_cmd_hint, say_cmd_hint = "/remind me in <days> to <message>", "/say [what you want to say]"

	default_script = "default"
)

type QProcess struct {
	s    *session
	lang struct {
		questions `json:"QandA"`
	}
	next *Question
}

func NewQProcess(b *telebot.Bot, s *Storage) *QProcess {
	return &QProcess{s: newSession(b, s)}
}

func (this *QProcess) Run(input <-chan telebot.Message) {
	for msg := range input {
		this.s.User = msg.Chat
		this.quickWinFirst(msg).
			determineScript(msg).
			findNextQuestion(msg).
			andAsk()
	}
}

func (this *QProcess) checkForDefaults(msg telebot.Message) *QProcess {

	if isCmd(msg.Text, start_cmd, help_cmd) {
		this.s.send(
			"Fantail is your companion that is here to help you get the help you want quicker",
			"You can control me by sending these commands:",
			chat_cmd,
			say_cmd_hint,
			said_cmd,
			remind_cmd_hint,
			reminders_cmd,
		)
	}
	return this
}

func (this *QProcess) quickWinFirst(msg telebot.Message) *QProcess {

	if hasSubmisson(msg.Text, say_cmd) {
		log.Println("save something said ", msg.Text)
		this.s.save(msg, say_cmd)
	} else if hasSubmisson(msg.Text, remind_cmd) {
		log.Println("save a reminder ", msg.Text)
		this.s.saveAsReminder(msg)
	} else if hasSubmisson(msg.Text, reminders_cmd) || isCmd(msg.Text, reminders_cmd) {
		log.Println("showing reminders ", msg.Text)<commit_msg>tidy up help<commit_after>package lib

import (
	"encoding/json"
	"fmt"
	"log"
	"os"
	"strings"

	"github.com/jh-bate/fantail-bot/Godeps/_workspace/src/github.com/tucnak/telebot"
)

const (
	//being a good citizen
	start_cmd, help_cmd = "/start", "/help"

	chat_cmd, remind_cmd, say_cmd, reminders_cmd, said_cmd = "/chat", "/remind", "/say", "/reminders", "/said"

	remind_cmd_hint, say_cmd_hint = "/remind me in <days> to <message>", "/say [what you want to say]"

	default_script = "default"
)

type QProcess struct {
	s    *session
	lang struct {
		questions `json:"QandA"`
	}
	next *Question
}

func NewQProcess(b *telebot.Bot, s *Storage) *QProcess {
	return &QProcess{s: newSession(b, s)}
}

func (this *QProcess) Run(input <-chan telebot.Message) {
	for msg := range input {
		this.s.User = msg.Chat
		this.
			quickWinFirst(msg).
			determineScript(msg).
			findNextQuestion(msg).
			andAsk()
	}
}

func (this *QProcess) quickWinFirst(msg telebot.Message) *QProcess {

	if isCmd(msg.Text, start_cmd, help_cmd) {
		this.s.send(
			"Fantail is your companion that is here to help you get the help you want quicker",
			"You can control me by sending these commands:",
			chat_cmd,
			say_cmd_hint,
			said_cmd,
			remind_cmd_hint,
			reminders_cmd,
		)
	} else if hasSubmisson(msg.Text, say_cmd) {
		log.Println("save something said ", msg.Text)
		this.s.save(msg, say_cmd)
	} else if hasSubmisson(msg.Text, remind_cmd) {
		log.Println("save a reminder ", msg.Text)
		this.s.saveAsReminder(msg)
	} else if hasSubmisson(msg.Text, reminders_cmd) || isCmd(msg.Text, reminders_cmd) {
		log.Println("showing reminders ", msg.Text)
{'fraction_non_alphanumeric': 0.13785885167464115, 'fraction_numerical': 0.0, 'mean_word_length': 4.075872534142641, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '179063', 'n_tokens_mistral': 1360, 'n_tokens_neox': 1264, 'n_words': 307}