Harmonial is a Python 3.5+ module that allows for the simple creation of Python Discord bots. Harmonial focuses to be easy to use with a vast array of functions at the users' disposal.
Documentation
harmonial.Function(function_type, params=None)
A Function class, which defines a bot function.
Parameters:
function_type(str) - The type of function that this class should be. A list offunction_types can be found at the bottom of the documentation.params- The parameters that the function should have. Differentfunction_types will require different variable types.
harmonial.Event(event, functions)
An Event class, which defines a bot event.
Parameters:
event(str) - The type of event that will activate the functionsfunctions.functions(list[harmonial.Function]) - A list ofFunctions that will be activated, in order, upon the event's activation.
harmonial.Command(commandname, functions)
A Command class, which defines a bot command.
Parameters:
commandname(str) - The name of the command. This will be used to activate thefunctionsby means of chat.functions(list[harmonial.Function]) - A list ofFunctions that will be activated, in order, upon the command's activation.
harmonial.special(special_type, params=None)
A function that returns data based on the special_type and params provided.
Parameters:
special_type(str) - A string that defines which function should be executed.params- Parameters for the function.
harmonial.build(filename, prefix, commands)
A function that compiles the list of Commands, commands, into finalized code. Note: after compilation, you will need to supply a bot token in the generated file.
Parameters:
filename(str) - File path that the final bot code will be written to.prefix(str) - Prefix for the commands.commands(list[harmonial.Command]) - A list of commands that will be in the bot.
function_type:
'say'(paramsas str) - Say a stringparamsin the channel as a response.'writeFile'(paramsas tuple) - Write a stringparams[1]to file pathparams[0].'uploadFile'(paramsas str or file object) - Upload a fileparamsto the channel as a response.'define'(paramsas tuple(str, *)) - Define a variable nameparams[0]with dataparams[1].'raw'(paramsas str) - Add a line of raw Python code.
special_type:
'randomNumber'(paramsas tuple(int, int )) - Returns string combiner that will return a random number between the range as defined in the tuple.'contentsOf'(paramsas str) - Returns the contents of a file at pathparams.'variableString'(paramsas str) - Returns a string combiner that will return the result of a variableparamsin string form.'rawVariable'(paramsas str) - Returns the raw contents of a variableparams.
- When '$argument' is used in a function inside of a
Command, it will return the contents after the command. - When '$+' is used in
harmonial.special()with aspecial_typeof 'define', numbers that come after the flag will be appended onto the variable (ex.'$+142'will add 142 to the variable).