Compare commits

..

2 Commits
dev ... main

@ -1,19 +1,3 @@
#The config is auto generated in the web interface do not change unless you know what you are doing.
[webserver]
#set to false if you dont have a certificate
usessl = false
port = "5000"
#DO NOT USE IN PRODUCTION. Do not even use flask it is recomended to use a production ready wsgi server such as gunicorn
debug = false
#Leave it like this if you dont know what your doing.
ip = "0.0.0.0"
crt = "/path/to/certificate.crt"
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, importlib, sqlite3 import discord, os, sys, toml, time, datetime, logging, threading, asyncio, readline, importlib
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,6 +55,7 @@ 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.
@ -63,7 +64,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")
@ -93,8 +94,6 @@ 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:
@ -215,7 +214,6 @@ 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
@ -315,6 +313,20 @@ 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}...")

@ -2,3 +2,4 @@ py-cord
pytoml pytoml
flask flask
quart quart
readline

Loading…
Cancel
Save