mirror of
https://github.com/osmarks/autobotrobot
synced 2025-06-11 11:04:10 +00:00
config reload command
This commit is contained in:
parent
9562f66f32
commit
c4fdf3d17a
@ -47,3 +47,8 @@ def setup(bot):
|
|||||||
await bot.database.commit()
|
await bot.database.commit()
|
||||||
except Exception as e:
|
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
|
from discord.ext import commands
|
||||||
import hashlib
|
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())
|
def timestamp(): return int(datetime.datetime.now(tz=datetime.timezone.utc).timestamp())
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user