Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.
Shuppin edited this page Nov 17, 2020 · 4 revisions

Welcome to The Bot Library wiki!

THIS WIKI IS NOT FINISHED AND MAY BE MISSING CRITICAL INFO

Here you will find info on what this program does and how it works.

Imports

Python Standard Libraries

import random - Used for random value generation
import time as t - Used to slow down the program to give time for the user to read prompts
import os - Used for locating files within the program and (hopefully) a program reload feature (coming soon)

3rd Party Imports

import kahoot (pip install kahootpy) - Used for interacting with Kahoot! and the Kahoot! client
import selenium (pip install selenium) - Used for interacting with the web browser
import colorama (pip install colorama) - Used for colouration of text

Console()

This is the main way of interacting with the program

Commands

  • help - Displays help page
  • status - Displays status of specified function/process
  • exit/escape/stop - Exits the console and in most cases stops the program
  • execute - Runs a specified function (Usage: execute OR execute [pid:])

Sub-sections

Welcome Screen

The welcome screen is an essential part to helping the user get started with the program.

In this section we use colorama (import colorama as c) which has been set to the variable 'c'.

Command Input

A somewhat simple input() function here, the print statement which comes just before it (print(consoleSyntaxInput, end='')) is used to display the 'bots@main:~$' prefix to the input. It has been done this way because colorama doesn't support colouring inside of inputs as of now.

Command Processing

This section finds all the brackets in the command and then adds spaces on either sides of them, this is done so that the split() function used just after it regards it as a space.

For example: execute kahootbot() --> ["execute", "kahootbot", "(", ")"]

This list is then assigned to the variable 'command'.

The variable 'arguments' is assigned to the result of splitting 'console' into separate values with the separator being a comma.

arguments = tempConsole.split(",")

Executing the Command

This section is basically a lot of if statements checking what the command is, then executing it.

Not much to be said here, apart from the filtering done for the execute command

All it does is it finds the arguments passed in kahootbot(arg1, arg2, arg3) for example and sets it to a list named arguments. This then proceeds to execute KahootBot() with the amount of variables given (maximum 3).

Passed Command Boolean

All this basically is, is it's just checking whether Console() was called with an argument or not e.g. Console("arg1") | passedCommand = True OR Console() | passedCommand = False

KahootBot class

This class holds all the functions which make KahootBot do what it does

__init__()

Assigns the variables 'pin', 'user' and 'quiz_name' to whatever was set when the function was initialised

__call__()

**Unfinished**