<commit_before>package unison

import (
	"os"
	"os/signal"

	"github.com/bwmarrin/discordgo"
)

// Context is a type that is passed to every handler
// in a bot application.
// It can be used to refer back to main components.
type Context struct {
	Bot                *Bot
	Discord            *discordgo.Session
	SystemInteruptChan chan struct{}
}

func NewContext(bot *Bot, ds *discordgo.Session) *Context {
	is := make(chan struct{})

	// shutdown signal
	c := make(chan os.Signal, 1)
	signal.Notify(c, os.Interrupt)
	go func() {
		<-c
		close(is)
	}()

	return &Context{Bot: bot, Discord: ds, SystemInteruptChan: is}
}<commit_msg>Fixes #14<commit_after>package unison

import (
	"os"
	"os/signal"

	"github.com/bwmarrin/discordgo"
)

// Context is a type that is passed to every handler
// in a bot application.
// It can be used to refer back to main components.
type Context struct {
	Bot                *Bot
	Discord            *discordgo.Session
	SystemInteruptChan chan struct{}
}

// NewContext Create a new context class for the discord bot
// This will also hold a signal for system interupts
func NewContext(bot *Bot, ds *discordgo.Session) *Context {
	ctx := new(Context)
	ctx.Bot = bot
	ctx.Discord = ds
	ctx.SystemInteruptChan = make(chan struct{})

	// shutdown signal
	c := make(chan os.Signal, 1)
	signal.Notify(c, os.Interrupt)
	go func() {
		<-c
		close(ctx.SystemInteruptChan)
	}()

	return ctx
}
{'fraction_non_alphanumeric': 0.11150317572335922, 'fraction_numerical': 0.0028228652081863093, 'mean_word_length': 3.195266272189349, 'pattern_counts': {'":': 0, '<': 5, '<?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': '554788', 'n_tokens_mistral': 504, 'n_tokens_neox': 475, 'n_words': 157}