diff --git a/lib/clear.py b/lib/clear.py new file mode 100755 index 0000000..756002e --- /dev/null +++ b/lib/clear.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python +# Tiny little log clearer by neersighted +import sys +import os +import subprocess + +if os.path.isfile("./bot.log"): + clear = ": >./bot.log" +else: + clear = ":" + +subprocess.call(clear, shell=True) +sys.exit() diff --git a/plugins/admin.py b/plugins/admin.py index 8797982..3bccaec 100755 --- a/plugins/admin.py +++ b/plugins/admin.py @@ -37,6 +37,17 @@ def restart(inp, input=None, db=None, notice=None): sys.exit() +@hook.command +def clear(inp, input=None, db=None, notice=None): + ".clear -- Clears the bot's log" + if not input.nick in input.bot.config["admins"]: + notice("Only bot admins can use this command!") + return + time.sleep(3) + subprocess.call(['lib/clear.py']) + sys.exit() + + @hook.command def join(inp, input=None, db=None, notice=None): ".join -- Joins ."