From b5aeb3532ecc9d22ae69c01958f44ff8db9e9d7f Mon Sep 17 00:00:00 2001 From: Guillaume ARM Date: Sun, 26 May 2024 20:30:13 +0200 Subject: [PATCH] feat(notify): add libs/notify --- install.lua | 1 + libs/notify.lua | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 libs/notify.lua diff --git a/install.lua b/install.lua index 52f09ed..cba62a2 100644 --- a/install.lua +++ b/install.lua @@ -33,6 +33,7 @@ local LIST_LIBS_FILES = { 'libs/turtle-utils.lua', 'libs/robot.lua', 'libs/inferium.lua', + 'libs/notify.lua', 'libs/ui/CountersSelector.lua' } diff --git a/libs/notify.lua b/libs/notify.lua new file mode 100644 index 0000000..567fc27 --- /dev/null +++ b/libs/notify.lua @@ -0,0 +1,21 @@ +local net = require('libs/net') + +local notify = {} + +local DEFAULT_PREFIX = 'chatBox' + +notify.NOTIFY_SERVER = 'notify.com' + +notify.sendChatMessage = function(message, prefix) + prefix = prefix or DEFAULT_PREFIX + + return net.sendQuery(notify.NOTIFY_SERVER, { + type = 'notify-chat', + payload = { + prefix = prefix, + message = message + } + }) +end + +return notify \ No newline at end of file