ComputerCraft Forums

ComputerCraft => Programs => APIs and Utilities => Topic started by: UnixTM on Aug 11, 2022, 06:58 AM

Title: (Unofficial) ntfy.sh API!
Post by: UnixTM on Aug 11, 2022, 06:58 AM
pastebin get 3dutQQeD ntfy (https://pastebin.com/3dutQQeD)
Finally, an (unofficial) ntfy.sh API! You can load my API with:
local ntfy = require("ntfy")It has 1 function:
ntfy.send()The arguments are as follows:
ntfy.send("topic", "message", "title")"topic" is as in http://ntfy.sh/topic.
"message" is the "body" of the notification.
"title" is the title of the notification. (If the title is not supplied, it will be:
ntfy.sh/[topic].)
Example for sending a notification to "lol" upon redstone:
while true do
     if os.pullEvent() == "redstone" then
          sleep(1)
          ntfy.send("lol", "sussy bussy box", "mincrafet")
     end
end

To send to a phone, use the "ntfy" app.
To send to computer, just go to
ntfy.sh/[topic]
in its browser.

Enjoy the API I quickly whipped up!
pastebin get 3dutQQeD ntfy (https://pastebin.com/3dutQQeD)
Title: (Unofficial) ntfy.sh API!
Post by: Lupus590 on Aug 11, 2022, 09:39 AM
os.loadAPI is the old way of doing things, you may want to convert your API into a require module.

It's not difficult to do, tweaked.cc has a guide on it (https://tweaked.cc/guide/using_require.html).




Otherwise, this looks good.

A couple of recommendations:


Title: (Unofficial) ntfy.sh API!
Post by: TesoMayn on Nov 21, 2022, 12:27 PM
Did you test this before posting?

Because it doesn't work lol

You're returning a boolean, at the bottom add

return { send = send }