From 22e209211af34b264cb622d9e01bb951b86344d1 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Thu, 29 Jul 2021 21:02:05 +0300 Subject: [PATCH] add some quotes scripts --- inspiration_quotes-widget.lua | 10 ++++++++++ quotes-widget.lua | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 inspiration_quotes-widget.lua create mode 100644 quotes-widget.lua diff --git a/inspiration_quotes-widget.lua b/inspiration_quotes-widget.lua new file mode 100644 index 0000000..992cae9 --- /dev/null +++ b/inspiration_quotes-widget.lua @@ -0,0 +1,10 @@ +function onAlarm() + net:getText("https://inspiration.goprogram.ai/") +end + +function onNetworkResult(result) + local quote = json:getValue(result, "object string:quote") + local author = json:getValue(result, "object string:author") + + ui:showLinesWithAuthors({ quote }, { author }) +end diff --git a/quotes-widget.lua b/quotes-widget.lua new file mode 100644 index 0000000..fdb5059 --- /dev/null +++ b/quotes-widget.lua @@ -0,0 +1,10 @@ +function onAlarm() + net:getText("https://api.quotable.io/random") +end + +function onNetworkResult(result) + local quote = json:getValue(result, "object string:content") + local author = json:getValue(result, "object string:author") + + ui:showLinesWithAuthors({ quote }, { author }) +end