// TODO: email people on ping word idea
email people on ping word idea
// TODO : email people on ping word idea
func main() {
	color.NoColor = false
	devbot = green.Sprint("devbot")
	var err error
	rand.Seed(time.Now().Unix())
	readBansAndUsers()
	c := make(chan os.Signal)
	signal.Notify(c, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGKILL)
	go func() {
		<-c
		fmt.Println("Shutting down...")
		saveBansAndUsers()
		logfile.Close()
		mainRoom.broadcast(devbot, "Server going down! This is probably because it is being updated. Try joining back immediately.  \n"+
			"If you still can't join, try joining back in 2 minutes. If you _still_ can't join, make an issue at github.com/quackduck/devzat/issues", true)
		os.Exit(0)
	}()
	ssh.Handle(func(s ssh.Session) {
		u := newUser(s)
		if u == nil {
			return
		}
		u.repl()
	})
	if os.Getenv("PORT") != "" {
		port, err = strconv.Atoi(os.Getenv("PORT"))
		if err != nil {
			fmt.Println(err)
			return
		}
	}
	fmt.Println(fmt.Sprintf("Starting chat server on port %d", port))
	go getMsgsFromSlack()
	go func() {
		if port == 22 {
			fmt.Println("Also starting chat server on port 443")
			err = ssh.ListenAndServe(
				":443",
				nil,
				ssh.HostKeyFile(os.Getenv("HOME")+"/.ssh/id_rsa"))
		}
	}()
	err = ssh.ListenAndServe(
		fmt.Sprintf(":%d", port),
		nil,
		ssh.HostKeyFile(os.Getenv("HOME")+"/.ssh/id_rsa"))
	if err != nil {
		fmt.Println(err)
	}
}
func main ( ) { color . NoColor = false devbot = green . Sprint ( " " ) var err error rand . Seed ( time . Now ( ) . Unix ( ) ) readBansAndUsers ( ) c := make ( chan os . Signal ) signal . Notify ( c , os . Interrupt , syscall . SIGTERM , syscall . SIGHUP , syscall . SIGKILL ) go func ( ) { <- c fmt . Println ( " " ) saveBansAndUsers ( ) logfile . Close ( ) mainRoom . broadcast ( devbot , " \n " + " " , true ) os . Exit ( 0 ) } ( ) ssh . Handle ( func ( s ssh . Session ) { u := newUser ( s ) if u == nil { return } u . repl ( ) } ) if os . Getenv ( " " ) != " " { port , err = strconv . Atoi ( os . Getenv ( " " ) ) if err != nil { fmt . Println ( err ) return } } fmt . Println ( fmt . Sprintf ( " " , port ) ) go getMsgsFromSlack ( ) go func ( ) { if port == 22 { fmt . Println ( " " ) err = ssh . ListenAndServe ( " " , nil , ssh . HostKeyFile ( os . Getenv ( " " ) + " " ) ) } } ( ) err = ssh . ListenAndServe ( fmt . Sprintf ( " " , port ) , nil , ssh . HostKeyFile ( os . Getenv ( " " ) + " " ) ) if err != nil { fmt . Println ( err ) } }
email people on ping word idea
email people on ping word idea