1
0
mirror of https://github.com/osmarks/autobotrobot synced 2025-01-24 06:06:52 +00:00

config reload command

This commit is contained in:
osmarks 2020-11-25 19:04:10 +00:00
parent 9562f66f32
commit c4fdf3d17a
2 changed files with 13 additions and 2 deletions

View File

@ -46,4 +46,9 @@ def setup(bot):
await ctx.send(util.gen_codeblock(out))
await bot.database.commit()
except Exception as e:
await ctx.send(embed=util.error_embed(util.gen_codeblock(traceback.format_exc())))
await ctx.send(embed=util.error_embed(util.gen_codeblock(traceback.format_exc())))
@magic.command()
async def reload_config(ctx):
util.load_config()
ctx.send("Done!")

View File

@ -12,7 +12,13 @@ import os.path
from discord.ext import commands
import hashlib
config = toml.load(open("config.toml", "r"))
config = {}
# update in place for runtime config reload
def load_config():
for k, v in toml.load(open("config.toml", "r")).items(): config[k] = v
load_config()
def timestamp(): return int(datetime.datetime.now(tz=datetime.timezone.utc).timestamp())