Due to the migration of the TBGs, development of Nihonium has ceased permanently.

A bot for the TBGs

This page lists variables and functions used in Nihonium.


Last Updated: Aug. 3rd, 2021 (0.9.2)


(Note: this page is currently incomplete, and has only been uploaded due to the fact that the webpages and bot are in the same repository.)

main.py

Functions

logEntry(entry, timestamp)

Creates an entry in the logfiles.

getReq(*args, **kwargs)

Makes a GET request, stores the received cookies, and makes a log entry.

postReq(*args, **kwargs)

Makes a POST request, stores the received cookies, and makes a log entry.

update_sig(_motd, xline, misc)

Updates the bot's signature. Uses the

siggy
variable to store inputs, in case they are ommited later.

motd()

Used in

update_sig()
.

moveCursor(x, y)

Moves the terminal cursor.

writeText(x, y, text, fcolor, bcolor)

Displays text on the terminal, in a specified location, with specified colors. Crucial for managing a text-based display.

async writeTextA(x, y, text, fcolor, bcolor)

A wrapper for

writeText()
that allows you to
await
it.

bell()

Makes an audible noise.

clearLine(line)

Clears the specified line.

async clock()

Runs a clock in the top-right corner of the terminal.

validCommand()

Increases the valid command count, and then writes

data
to
data.json
.

assemble_botdata()

Used by

parse_command()
to generate data about the bot.
Returns a
dict
containing the following:

assemble_threaddata(tID)

Used by

parse_command()
to generate data about the thread the command was called in.
Returns a
dict
containing the contents of
post_ids[str(tID)]
, plus the following:

assemble_userdata(command)

Used by

parse_command()
to generate data about the user who called the command.
Returns a
dict
containing the following:

parse_command(command, tID)

Parses the given command.
Returns a string which contains the output to be displayed. This string may be empty, in which case no output is displayed for that command.

main_loop(tID, row)

Scrapes commands from the thread given by

tID
, passes them to
parse_command()
to be parse, and takes the outputs and posts them to the thread.

async true_main_loop()

Manages several things, including the calling

main_loop()
for each of the threads, keeping track of the sixty second and thity minute waits, and some of the terminal output.

async outerloop()

Starts both

true_main_loop()
and
clock()
.

final()

Used when the bot is closed with Ctrl+C.

async exit_script()

Stops both

true_main_loop()
and
clock()
.