I’m making a kahoot botter and this is the code:
from colorama import Fore
from kahoot import client
import pyfiglet
import sys
def joinHandle():
pass
print(Fore.BLUE + pyfiglet.figlet_format("Kahoot Bot"))
print(Fore.BLUE + "Coded by AsyncCode <3 | https://discord.gg/99KDZYwn2c")
username = input(Fore.BLUE + "Tell me the Bots name. > ")
code = input(Fore.BLUE + "Tell me the Kahoot's Game Code. > ")
int(code)
if code.isdigit() is False:
print(Fore.BLUE + "Error, the Code must be an Integer.")
sys.exit(1)
logging = input(Fore.BLUE + "Tell me if you want to enable logging. y / n > ")
bots = input(Fore.BLUE + "How many bots do you want? ")
for x in bots:
bot = client()
BotID = x
BotID = str(BotID)
bot.join(code, username + " - " + BotID)
bot.on("joined", joinHandle)
if logging == "y":
print(Fore.BLUE + "Log: Joining the Game (" + code + ") with Name: " + username + " - " + BotID + ".")
BotID = int(BotID)
If i enter 10 it will make bot – 1 and bot – 0 and not a range from 1 to ten
>Solution :
The bots variable is a string:
bots = input(Fore.BLUE + "How many bots do you want? ")
Your current code iterates over each character in the string.
Assuming you want to run as many iterations as the input value, you should first convert the string to an integer, and then iterate over a range with the same length as this integer:
bots = int(input(Fore.BLUE + "How many bots do you want? "))
for i in range(bots):
...