Compare commits

...

6 Commits
main ... dev

@ -16,3 +16,4 @@ key = "/path/to/private.key"
[bot]
cogs=["cogs.essentials.commands"]
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
@ -43,7 +43,7 @@ except:
if token == "":
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()
@ -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..
class API:
#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
def save_config(self):
try:
with open("config.toml", w) as f:
with open("config.toml", "w") as f:
self.log("inf", "Saving the configuration file...")
toml.dump(self.config, f)
self.log("inf", "Config was saved to config.toml")
@ -94,6 +93,8 @@ class API:
self.token = token
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..
class CLI:
@ -214,6 +215,7 @@ async def stop(ctx):
if __name__ == "__main__":
api = API(config, bot, log, token)
cli = CLI(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")
#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"]:
log("inf", f"Loading {x}...")

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