mirror of
https://github.com/osmarks/autobotrobot
synced 2025-01-24 06:06:52 +00:00
config reload command
This commit is contained in:
parent
9562f66f32
commit
c4fdf3d17a
@ -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!")
|
@ -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())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user