Ejemplo n.º 1
0
func main() {
	var pin string
	var nickname string
	fmt.Print("Enter game pin: ")
	fmt.Scanln(&pin)
	fmt.Print("Enter nickname: ")
	fmt.Scanln(&nickname)
	fmt.Println("Connecting...")
	conn, err := kahoot.NewConnection(pin)
	if err != nil {
		fmt.Println("Error:", err)
		os.Exit(1)
	}
	if err := conn.Register(nickname); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	fmt.Println("Awaiting questions...")
	for {
		if conn.WaitQuestion() != nil {
			fmt.Println("Done question loop:", err)
			os.Exit(1)
		}
		fmt.Print("Got question. Answer: ")
		var number string
		fmt.Scanln(&number)
		parsed, _ := strconv.Atoi(number)
		if err := conn.SendAnswer(parsed); err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
	}
}
Ejemplo n.º 2
0
func main() {
	var pin string
	var nickname string
	var answer string
	fmt.Print("Game pin: ")
	fmt.Scanln(&pin)
	fmt.Print("Nickname: ")
	fmt.Scanln(&nickname)
	fmt.Println("Connecting...")
	conn, err := kahoot.NewConnection(pin)
	if err != nil {
		fmt.Println("Error:", err)
		os.Exit(1)
	}
	if err := conn.Register(nickname); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	for {
		fmt.Print("Enter to answer question: ")
		fmt.Scanln(&answer)
		fmt.Print("Answer: ")
		var number string
		fmt.Scanln(&number)
		parsed, _ := strconv.Atoi(number)
		if err := conn.SendAnswer(parsed); err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
	}
}
Ejemplo n.º 3
0
func main() {
	var pin string
	var nickname string
	var numNames string
	fmt.Print("Game pin: ")
	fmt.Scanln(&pin)
	fmt.Print("Nickname: ")
	fmt.Scanln(&nickname)
	fmt.Print("Count: ")
	fmt.Scanln(&numNames)
	count, err := strconv.Atoi(numNames)
	if err != nil {
		fmt.Println("Invalid count:", numNames)
		os.Exit(1)
	}
	for i := 0; i < count; i++ {
		istr := strconv.Itoa(i + 1)
		newNick := nickname + istr
		fmt.Println("Registering", newNick, "...")
		conn, err := kahoot.NewConnection(pin)
		if err != nil {
			fmt.Println("Error:", err)
			os.Exit(1)
		}
		if err := conn.Register(newNick); err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
		go func() {
			for {
				_, err := conn.Read()
				if err != nil {
					return
				}
			}
		}()
	}
	fmt.Println("Done. Hit enter to exit.")
	fmt.Scanln()
}
Ejemplo n.º 4
0
func main() {
	var pin string
	var nickname string
	var crash string
	fmt.Print("Game code: ")
	fmt.Scanln(&pin)
	fmt.Print("Nickname: ")
	fmt.Scanln(&nickname)
	fmt.Println("Connecting...")
	conn, err := kahoot.NewConnection(pin)
	if err != nil {
		fmt.Println("Error:", err)
		os.Exit(1)
	}
	if err := conn.Register(nickname); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	fmt.Println("Enter to start crash (must be while a question is asked):")
	fmt.Scanln(&crash)
	fmt.Println("CRASHING!")
	conn.SendCrashAnswer()
}
Ejemplo n.º 5
0
func main() {
	var pin string
	var nickname string
	var crash string
	fmt.Print("Padnezz Kahoot-hack-mod")
	fmt.Print("Enter game pin: ")
	fmt.Scanln(&pin)
	fmt.Print("Enter nickname: ")
	fmt.Scanln(&nickname)
	fmt.Println("Connecting...")
	conn, err := kahoot.NewConnection(pin)
	if err != nil {
		fmt.Println("Error:", err)
		os.Exit(1)
	}
	if err := conn.Register(nickname); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	fmt.Println("Enter to start crash:")
	fmt.Scanln(&crash)
	fmt.Println("CRASHING!")
	conn.SendCrashAnswer()
}