Sonnet

LeXdPyK (Bot kernel) API

Revised for LeXdPyK 1.3.1

discord.py: on-*

Supported Events:

Event kwargs (Kernel args)

Name Description
kernel_version The current kernels version string
bot_start The unix timestamp of when the bot started
client The discord.py client
ramfs A ramfs that is cleared every module reload
kernel_ramfs A ramfs that is not cleared until restarted
command_modules=[command_modules, command_modules_dict] A list of the command modules an a hmap of their functions, to be used as an implementation of discord commands.
dynamiclib_modules=[dynamiclib_modules, dynamiclib_modules_dict] A list of the dynamiclib modules and a hmap of their functions, used for event handlers

Kernel ramfs format

Note: '..' '.' and '/' directory locations are not supported in parser as all actions occur in the root directory.

Name Description
ramfs.mkdir(dir) Makes a directory at the specified path
ramfs.rmdir(dir) Removes a directory at the specified path
ramfs.tree([dir]) Returns a treemap of every folder and file from origin
ramfs.ls([dir]) Returns a listmap of every folder and file in current directory
ramfs.create_f(path, f_type=io.BytesIO, f_args=[]) Creates a file in location, if folders do not exist it will make them, specify object type and args if you wish to store a non file like object
ramfs.read_f(path) Returns a file in a location, raises FileNotFoundError if directory of file does not exist
ramfs.remove_f(path) Deletes a file, raises FileNotFoundError if directory or file does not exist

Passing from kernel to event handlers

dynamiclib_modules_dict[event-name](*args-of-dpy-event, **kernel-kwargs)

Additional functions can be run per event with the syntax event-name-X where X is the count from 0 of the order to run the command