API Reference¶
The API documentation is where you find how to do basically anything.
Utilities¶
Dotenv¶
MS¶
-
class
ms¶ -
static
years(years)¶ Get the amount of milliseconds in x years
- Parameters
years (number) –
- Return type
number
-
static
weeks(weeks)¶ Get the amount of milliseconds in x weeks
- Parameters
weeks (number) –
- Return type
number
-
static
days(days)¶ Get the amount of milliseconds in x days
- Parameters
days (number) –
- Return type
number
-
static
hours(hours)¶ Get the amount of milliseconds in x hours
- Parameters
hours (number) –
- Return type
number
-
static
minutes(minutes)¶ Get the amount of milliseconds in x minutes
- Parameters
minutes (number) –
- Return type
number
-
static
seconds(seconds)¶ Get the amount of milliseconds in x seconds
- Parameters
seconds (number) –
- Return type
number
-
static
formatLong(milliseconds)¶ Format the milliseconds in a long way eg 10 seconds
- Parameters
milliseconds (number) –
- Return type
str
-
static
plural(mili, msAbs, n, name)¶ Pluralize an amount of time
- Parameters
mili (number) –
msAbs (number) –
n (number) –
name (str) –
- Return type
str
-
static
Stringx¶
-
class
stringx¶ -
static
split(str, separator)¶ Split a string by a separator
- Parameters
str (str) – The string to split
separator (str) – The separator
- Return type
list[str]
-
static
trim(str)¶ Trim whitespace around a string
- Parameters
str (str) – String to trim
- Return type
str
-
static
startswith(str, start)¶ Check if a string starts with another string
- Parameters
str (str) – String to check
start (str) – What to check for
- Return type
boolean
-
static
endswith(str, ends)¶ Check if a string ends with another string
- Parameters
str (str) – String to check
ends (str) – What to check for
- Return type
boolean
-
static
random(len, mn, mx)¶ Return a string of random characters with the length of len and between min and max
- Parameters
len (number) – The length of the random string
mn (number) – Must be at least 0
mx (number) – Must be at most 255
- Return type
str
-
static
pad(str, len, align, pattern)¶ Put spaces around a string
- Parameters
str (str) – The string to pad
len (number) – How much to pad
align (str) – The align of the padding
pattern (str) – The pattern to pad by
- Return type
str
-
static
levenshtein(str1, str2)¶ Get the difference between 2 strings
- Parameters
str1 (str) – The string to compare to str2
str2 (str) – The string to compare to str1
- Return type
number
-
static
shorten(str, width, tail)¶ Shorten a string to be prefixed or suffixed by ellipsis
- Parameters
str (str) – The string to shorten
width (number) – The max size allowed
tail (boolean) – Show the front of the string when false and back of the string when true
- Return type
str
-
static
fancyformat(str)¶ Makes a factory to “fancy” format a string
- Parameters
str (str) – The pattern string
- Return type
function
-
static
Classes¶
Properties prefixed with an _ are private so you can’t access them.
Array¶
-
class
ArgParser¶ -
_flags: list[ArgParser.modifiers]¶
-
__init()¶
-
attach(command)¶ Attach the parser to a command, should be after all flags and arguments
-
arg(func, name)¶ Register a function to check a passed argument
- Parameters
func (function) –
name (str) –
- Return type
-
arg(func) Register a function to check a passed argument
- Parameters
func (function) –
- Return type
-
flag(name, func, typeName)¶ Register a function to check a passed flag
If the flag type is set as a boolean, the presence of the flag is counted as true
- Parameters
name (str) –
func (function) –
typeName (str) –
- Return type
ArgParser.modifiers
-
flag(name, func) Register a function to check a passed flag
If the flag type is set as a boolean, the presence of the flag is counted as true
- Parameters
name (str) –
func (function) –
- Return type
ArgParser.modifiers
-
parse(str, client)¶ Parse the input, typechecking it along the way
- Parameters
str (str) –
client (Client) –
- Return type
table or nil or str or nil
-
Array¶
-
class
Array¶ -
__init(starting)¶ - Parameters
starting (any) –
-
__pairs()¶ Loop over the array
-
get(k)¶ Get an item at a specific index
- Parameters
k (number) – The key to get the value of
- Return type
any
-
set(k, v)¶ Set an item at a specific index
- Parameters
k (number) –
v (any) –
-
iter()¶ Iterate over an array
-
unpack()¶ Unpack the array
-
push(item)¶ Add an item to the end of an array
- Parameters
item (any) – The item to add
-
concat(sep)¶ Concat an array
- Parameters
sep (str) –
-
pop(pos)¶ Pop the item from the end of the array and return it
- Parameters
pos (number) – The position to pop
-
forEach(fn)¶ Loop over the array and call the function each time
- Parameters
fn (fun(any, number):void) –
-
filter(fn)¶ Loop through each item and each item that satisfies the function gets added to an array and gets returned
- Parameters
fn (fun(any):void) –
- Return type
-
find(fn)¶ Return the first value which satisfies the function
- Parameters
fn (fun(any):boolean) –
- Return type
any or number or nil
-
search(fn)¶ Similar to array:find except returns what the function returns as long as its truthy
- Parameters
fn (fun(any):any) –
- Return type
any or number or nil
-
map(fn)¶ Create a new array based on the results of the passed function
- Parameters
fn (fun(any):any) –
- Return type
-
slice(start, stop, step)¶ Slice an array using start, stop, and step
- Parameters
start (number) – The point to start the slice
stop (number) – The point to stop the slice
step (number) – The amount to step by
- Return type
-
Client¶
Command¶
-
class
Command¶ -
isSub: boolean¶
-
name: str¶
-
description: str¶
-
usage: str¶
-
cooldown: number¶
-
flags: dict[str, boolean]¶
-
aliases: list[str]¶
-
examples: list[str]¶
-
user_permissions: list[str]¶
-
bot_permissions: list[str]¶
-
subcommands: list[Subcommand]¶
-
rawExecute: function¶
-
parent: Plugin or Subcommand or nil¶
-
toRun(message, args, client)¶ Check a message to see if it matches all the criteria listed
- Parameters
message (Message) –
args (list[str]) –
client (SuperToastClient) –
- Return type
boolean
-
description(desc) Attach a description to a command
- Parameters
desc (str) –
- Return type
-
usage(usage) Attach a usage to a command
- Parameters
usage (str) –
- Return type
-
cooldown(cooldown) Set the cooldown of the command
- Parameters
cooldown (number) –
- Return type
-
check(check)¶ Add a custom check to the command
- Parameters
check (fun(Message, list[str], SuperToastClient):str or boolean or str) –
- Return type
-
has_permission(perm)¶ Add permission check for users
- Parameters
perm (str or number) –
- Return type
-
has_permissions(...)¶ Add multiple permission checks for users
- Parameters
vararg (str or number) –
- Return type
-
bot_has_permission(perm)¶ Add permission check for the bot
- Parameters
perm (str or number) –
- Return type
-
bot_has_permissions(...)¶ Add multiple permission checks for the bot
- Parameters
vararg (str or number) –
- Return type
-
add_subcommand(subcommand)¶ Add a subcommand to the function
- Parameters
subcommand (Subcommand) –
- Return type
-