You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.2 KiB

  1. package main
  2. import (
  3. "bufio"
  4. "fmt"
  5. "os"
  6. "strings"
  7. )
  8. const version = "0.1-dev"
  9. func main() {
  10. c.Yellow("twFlock")
  11. fmt.Println("---------------")
  12. c.Cyan("twFlock initialized")
  13. c.Purple("https://github.com/arnaucode/twFlock")
  14. fmt.Println("version " + version)
  15. fmt.Println("Reading flockConfig.json file")
  16. flock := readConfigTokensAndConnect()
  17. c.Yellow("generating markov chains (may take some seconds)")
  18. text, _ := readTxt("text.txt")
  19. states := markov.train(text)
  20. c.Green("markov chains generated")
  21. //var flock Flock
  22. fmt.Println("---------------")
  23. newcommand := bufio.NewReader(os.Stdin)
  24. fmt.Print("Please select command number")
  25. options := `
  26. 1 - Tweet from flock of bots
  27. 2 - Markov
  28. 0 - Exit script
  29. option to select: `
  30. for {
  31. fmt.Print(options)
  32. option, _ := newcommand.ReadString('\n')
  33. option = strings.TrimSpace(option)
  34. switch option {
  35. case "1":
  36. fmt.Println("selected 1 - Tweet from flock of bots")
  37. optionTweetFromFlock(flock)
  38. break
  39. case "2":
  40. fmt.Println("selected 2 - Markov")
  41. optionTweetMarkov(states)
  42. break
  43. case "0":
  44. fmt.Println("selected 0 - exit script")
  45. os.Exit(3)
  46. break
  47. default:
  48. fmt.Println("Invalid option")
  49. break
  50. }
  51. }
  52. }