#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}")
return1
#Connect the main .log file to the api so plugins can log to latest.log w/o risking corrupting the file.
deflog(self,status,log):
self.logger(str(status),str(log))
defload(self,extension):
self.logger("inf",f"Loading {extension}...")
extension=str(extension)
ifextension.startswith("cogs."):
extension.replace("cogs.","",1)
try:
self.bot.load_extension(f"cogs.{extension}")
exceptExceptionase:
self.logger("wrn",f"Extension {extension} failed to load due to: {e}")