Adds note module

This commit is contained in:
Gap
2015-01-14 18:31:44 +01:00
parent 86756713a1
commit 8b5b90513e

View File

@@ -6,9 +6,11 @@ an_permission = "utils.an";
notes = open_json_file("adminnotes", [])
continued_messages = {}
def save_notes():
save_json_file("adminnotes", notes)
def r_ago(unit, i):
# Return ago + plural
i = i
@@ -16,6 +18,7 @@ def r_ago(unit, i):
unit +="s"
return str(i)+" "+unit+" ago"
def calc_diff(time_ago):
current = time.time()
s = current-time_ago
@@ -34,6 +37,7 @@ def calc_diff(time_ago):
ago = r_ago("day", s/60/60/12)
return ago
def show_all_notes(sender):
if len(notes) == 0:
msg(sender, "&aNo open notes at the moment!")
@@ -48,6 +52,7 @@ def show_all_notes(sender):
msg(sender, "&6#%s - &e%s&6, %s:" % (str(i+1), name, ago))
msg(sender, "&7%s" % colorify(message))
def show_an_help(sender):
msg(sender, "&6AdminNotes Help:")
msg(sender, "&e- /an")
@@ -117,6 +122,7 @@ def adminnotes_command(sender, args):
except:
print(print_traceback())
@hook.event("player.PlayerJoinEvent", "monitor")
def on_an_join(event):
if len(notes) > 0: