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