#Api used mainly for plugins so getting uptime, loading, unloading, reloading plugins, getting status of plugins, get plugin info, stopping the bot, getting bot name and tag, getting cpm/commands per minute, get if there is web plugin, if there is web plugin register api, get if plugin supports web and so on..
classAPI:
#Returns config.tomls content in a array.
defget_config(self):
returnself.config
#Dumps all the toml data from self.config and stores it inside toml.config
defsave_config(self):
try:
withopen("config.toml",w)asf:
self.log("inf","Saving the configuration file...")
toml.dump(self.config,f)
self.log("inf","Config was saved to config.toml")
#aok
return0
#In case file doesnt exist
exceptExceptionase:
self.log("err",f"Failed to save to config.toml. {e}")
#Connect the main .log file to the api so plugins can log to latest.log w/o risking corrupting the file. Absolutly useless as you can do: self.bot.api.logger("inf", "Hello w/o some useless function")
#This is the most basic interface CLI wich is basically a comand line that appears when you launch the app it will have commands like stop, help, commands, cogs, load, unload and so on..
print(f"The uptime of the bot is {uptime} HH:MM:SS.")
cli.register_command("uptime",cli_uptime,"Shows the uptime of the bot in seconds.")
#info
defcli_info(self):
print(f"You are running version 0.0.0 - Pre Release. Created by supopur under the GNUv3 license. Git repo: https://git.nazev.eu:8443/ Our discord link: https://discord.gg/dVVVSM4z")
cli.register_command("info",cli_info,"Shows the info about the bot.")
#shutdown
defcli_sd(self):
print("Shutting down the bot. You still must do CTRL+C to exit this terminal!!")
try:
sys.exit("Terminated from the cli..")
except:pass
cli.register_command("stop",cli_sd,"Terminates the bot.")
defcli_clear(self):
os.system('cls'ifos.name=='nt'else'clear')
cli.register_command("clear",cli_clear,"Clears the terminal output")