From 07eaf3cc262beb57f97330121fd725770b3e670e Mon Sep 17 00:00:00 2001 From: zmv7 <72821250+zmv7@users.noreply.github.com> Date: Fri, 25 Mar 2022 02:01:18 +0500 Subject: [PATCH] Add files via upload --- init.lua | 19 +++++++++++++++++++ mod.conf | 1 + 2 files changed, 20 insertions(+) create mode 100644 init.lua create mode 100644 mod.conf diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..63dac81 --- /dev/null +++ b/init.lua @@ -0,0 +1,19 @@ +local storage = minetest.get_mod_storage() +--if not storage:get_string('pmhist') then storage:set_string('pmhist','') end +minetest.register_on_receiving_chat_message(function(message) +if message:match('DM from %S') or message:match('PM from %S') then +storage:set_string('pmhist',storage:get_string('pmhist')..os.date()..' '..message..'\n\n') +end +end) +minetest.register_chatcommand("pmhist", { + description = "View PM history", + func = function(param) +core.show_formspec('pmhist',"size[16,9]textarea[0.2,0;16.1,10;hist;PM History:;"..storage:get_string('pmhist').."]button[7,8.5;2,1;save;Edit]") +end}) +core.register_on_formspec_input(function(formname, fields) + if formname == "pmhist" then + if fields.save then + storage:set_string('pmhist',fields.hist) + end + end +end) diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..d0fdaf5 --- /dev/null +++ b/mod.conf @@ -0,0 +1 @@ +name = pmhistory