parent
582145b479
commit
bfa0e3da5c
@ -1,4 +1,7 @@ |
|||||||
{ |
{ |
||||||
"token": "YOUR_TOKEN_HERE", |
"token": "YOUR_TOKEN_HERE", |
||||||
"plugin_path": "./plugins" |
"plugin_path": "./plugins", |
||||||
|
"authed": [ |
||||||
|
|
||||||
|
] |
||||||
} |
} |
@ -0,0 +1,12 @@ |
|||||||
|
hooks = ["MESSAGE_CREATE"] |
||||||
|
def run(event, ctx, bot): |
||||||
|
if ctx["content"].startswith(":") and not(int(ctx["author"]["id"]) in bot.config["authed"]): |
||||||
|
bot.send_msg(ctx["channel_id"], "you lack the proper authentication") |
||||||
|
return |
||||||
|
if ctx["content"] == ":ops": |
||||||
|
bot.send_msg(ctx["channel_id"], ", ".join([str(ident) for ident in bot.config["authed"]])) |
||||||
|
elif ctx["content"].startswith(":op"): |
||||||
|
for mention in ctx["mentions"]: |
||||||
|
bot.config["authed"].append(int(mention["id"])) |
||||||
|
bot.send_msg(ctx["channel_id"], f"added {mention['username']} to the session authed!") |
||||||
|
bot.logger.write(f"added auth {mention['id']} {mention['username']}") |
@ -0,0 +1,20 @@ |
|||||||
|
from importlib import reload |
||||||
|
hooks = ["MESSAGE_CREATE"] |
||||||
|
def run(event, ctx, bot): |
||||||
|
if ctx["content"].startswith(":") and not(int(ctx["author"]["id"]) in bot.config["authed"]): |
||||||
|
bot.send_msg(ctx["channel_id"], "you lack the proper authentication") |
||||||
|
return |
||||||
|
plugin_manager = bot.plugman |
||||||
|
if ctx["content"].startswith(":reload"): |
||||||
|
cmd = ctx["content"].split(" ")[1] |
||||||
|
if not(cmd in [m.__name__ for m in plugin_manager.plugins_loaded]): |
||||||
|
bot.send_msg(ctx["channel_id"], f"plugin {cmd} could not be found for reloading!") |
||||||
|
else: |
||||||
|
for m in plugin_manager.plugins_loaded: |
||||||
|
if m.__name__ == cmd: |
||||||
|
reload(m) |
||||||
|
bot.send_msg(ctx["channel_id"], f"reloaded plugin {cmd}!") |
||||||
|
bot.logger.write(f"reloaded {cmd}") |
||||||
|
elif ctx["content"] ==":plugins": |
||||||
|
plugins = ", ".join([m.__name__ for m in plugin_manager.plugins_loaded]) |
||||||
|
bot.send_msg(ctx["channel_id"], f"{plugins}") |
Loading…
Reference in new issue