Compare commits

...

6 Commits
main ... dev

@ -16,3 +16,4 @@ key = "/path/to/private.key"
[bot] [bot]
cogs=["cogs.essentials.commands"] cogs=["cogs.essentials.commands"]
guild_ids=["823188238260633600"] guild_ids=["823188238260633600"]

@ -1,4 +1,4 @@
import discord, os, sys, toml, time, datetime, logging, threading, asyncio, readline, importlib import discord, os, sys, toml, time, datetime, logging, threading, asyncio, importlib, sqlite3
from discord.ext import commands from discord.ext import commands
@ -43,7 +43,7 @@ except:
if token == "": if token == "":
log("err", 'Error no token is present type: export MEETOO_TOKEN="[Your token here]" into your terminall NOW!') log("err", 'Error no token is present type: export MEETOO_TOKEN="[Your token here]" into your terminall NOW!')
log("dbg", f"Token is: {token}")
start_time = time.time() start_time = time.time()
@ -55,7 +55,6 @@ logger.debug("Loaded the client.")
#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.. #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..
class API: class API:
#Returns config.tomls content in a array. #Returns config.tomls content in a array.
@ -64,7 +63,7 @@ class API:
#Dumps all the toml data from self.config and stores it inside toml.config #Dumps all the toml data from self.config and stores it inside toml.config
def save_config(self): def save_config(self):
try: try:
with open("config.toml", w) as f: with open("config.toml", "w") as f:
self.log("inf", "Saving the configuration file...") self.log("inf", "Saving the configuration file...")
toml.dump(self.config, f) toml.dump(self.config, f)
self.log("inf", "Config was saved to config.toml") self.log("inf", "Config was saved to config.toml")
@ -94,6 +93,8 @@ class API:
self.token = token self.token = token
self.guild_ids = config["bot"]["guild_ids"] self.guild_ids = config["bot"]["guild_ids"]
#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.. #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..
class CLI: class CLI:
@ -214,6 +215,7 @@ async def stop(ctx):
if __name__ == "__main__": if __name__ == "__main__":
api = API(config, bot, log, token) api = API(config, bot, log, token)
cli = CLI(api) cli = CLI(api)
bot.api = api bot.api = api
@ -313,20 +315,6 @@ if __name__ == "__main__":
cli.register_command("unload", cli_unload, "Unloads a cog takes a cog name as a arg example: unload cogs.example") cli.register_command("unload", cli_unload, "Unloads a cog takes a cog name as a arg example: unload cogs.example")
#start Starts the bot itself.
def cli_start(self):
print("Starting the bot...")
try:
self.api.bot.run(self.api.token)
except Exception as e:
print(e)
return 1
else:
print("Bot started.")
return 0
#cli.register_command("start", cli_start, "Starts the bot.")
for x in config["bot"]["cogs"]: for x in config["bot"]["cogs"]:
log("inf", f"Loading {x}...") log("inf", f"Loading {x}...")

@ -1,5 +1,4 @@
py-cord py-cord
pytoml pytoml
flask flask
quart quart
readline
Loading…
Cancel
Save