Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Commit

Permalink
v0.2.0: Add getGroup caching, and production build
Browse files Browse the repository at this point in the history
  • Loading branch information
Neztore committed Aug 6, 2020
1 parent e53b59b commit cdefa55
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 18 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,17 @@ local client = Cetus({
### Client Methods
> More Documentation coming soon
#### setRank
`client.setRank(userId: number)`
`client:setRank(userId: number)`

#### getRank
`client.getRank(userId: number)`
`client:getRank(userId: number)`

#### exile
`client:exile(userId: number)`

#### shout
`client:shout(message: string)`
Post string `message` to the Group shout. Pass an empty string to remove the Group shout.

## To-do list
* Add rate limit support
Expand Down
16 changes: 2 additions & 14 deletions default.project.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
{
"name": "cetus-rbx",
"tree": {
"$className": "DataModel",

"ServerStorage": {
"$className": "ServerStorage",
"$path": "src"
},
"HttpService": {
"$className": "HttpService",
"$properties": {
"HttpEnabled": true
}
}
"$path": "src"

}


}
19 changes: 19 additions & 0 deletions dev.project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "cetus-rbx",
"tree": {
"$className": "DataModel",

"ServerStorage": {
"$className": "ServerStorage",
"$path": "src"
},
"HttpService": {
"$className": "HttpService",
"$properties": {
"HttpEnabled": true
}
}
}


}
2 changes: 1 addition & 1 deletion src/cetus/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ local assertConfig = require(script.util.assertConfig)
Availible client options:
* token (required): Your authorisation token for your group. Get one here: https://cetus.app/dashboard
Version: v0.10.
Version: v0.2.0
]]

local clientPrototype = {}
Expand Down
21 changes: 20 additions & 1 deletion src/cetus/methods/getGroup.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
local cache = nil
local cacheSetAt = 0
return function (client)
return client:makeRequest("GET", "/v1/roblox/info/")
if cache then
-- 20 minutes cache time
if (os.time() - cacheSetAt) < 1200 then
return cache
else
cacheSetAt = 0
cache = nil
end
end
local result = client:makeRequest("GET", "/v1/roblox/info/")
if result.error then
return result
else
cache = result
client._groupId = result.id
cacheSetAt = os.time()
return result
end
end

0 comments on commit cdefa55

Please sign in to comment.