diff --git a/Examples/CustomEndpoint.md b/Examples/CustomEndpoint.md index cdce306..79a6154 100644 --- a/Examples/CustomEndpoint.md +++ b/Examples/CustomEndpoint.md @@ -1,14 +1,12 @@
@@ -22,25 +20,25 @@
```javascript
-import \* as ramapi from "ram-api.js"; // typescript
+import * as ramapi from "ram-api.js"; // typescript
const ramapi = require("ram-api.js"); // javascript
const lang = "english"; // "spanish" for spanish
-//demo v14+
+// demo uses the latest api version
+// hello returns { text }
new ramapi.Utils().customAsync("/hello", "demo", { params: { lang: lang } }).then(data => { console.log(data); }).catch(err => { });
-//basic v13 or under
+//basic ended at v13, and v13 is retired
-new ramapi.Utils().customAsync("/hello", "basic", { version: "v13", params: { lang: lang } }).then(data => { console.log(data); }).catch(err => { });
+//pro, normal, or extended are also available options instead of demo below are examples NOTICE: extended only exists in v14 and v15
-//pro, normal, or extended are also available options instead of demo or basic below are examples NOTICE: extended only exists in v14 and above
+//v17
+new ramapi.Utils().customAsync("/hello", "normal", { version: "v17", params: { lang: lang }, headers: {"token": "api key here"} }).then(data => { console.log(data); }).catch(err => { });
-//v16 & up
-new ramapi.Utils().customAsync("/hello", "normal", { params: { lang: lang }, headers: {"token": "api key here"} }).then(data => { console.log(data); }).catch(err => { });
-//provide version ex v16 (v16 and up)
+//v16 still uses the token header
new ramapi.Utils().customAsync("/hello", "normal", { version: "v16", params: { lang: lang }, headers: {"token": "api key here"} }).then(data => { console.log(data); }).catch(err => { });
-//provide version ex v13 (v15 and under)
+//v15 and under use the api-key header
new ramapi.Utils().customAsync("/hello", "normal", { version: "v15", params: { lang: lang }, headers: {"api-key": "api key here"} }).then(data => { console.log(data); }).catch(err => { });
diff --git a/Examples/Demo.md b/Examples/Demo.md
index 76d478c..62d0970 100644
--- a/Examples/Demo.md
+++ b/Examples/Demo.md
@@ -1,14 +1,12 @@
@@ -18,62 +16,141 @@
> Demo Examples
+Returns below are the objects the methods resolve with.
+
```javascript
-import \* as ramapi from "ram-api.js"; // typescript
+import * as ramapi from "ram-api.js"; // typescript
const ramapi = require("ram-api.js"); // javascript
const lang = "english"; // "spanish" for spanish
let RamApi = new ramapi.DemoEndpoints(60000, 1);
+// { url }
+RamApi.laughAsync().then((data) => { console.log(data); }).catch((error) => {});
+
+// { version, outdated, supported, latest }
+// { version: "v17", outdated: false, supported: true, latest: "v17" }
+RamApi.versionInfoAsync("v17").then(data => { console.log(data); }).catch(error => {});
+
+// { text, url }
+RamApi.birthdayAsync(lang).then(data => { console.log(data); }).catch(error => {});
+
+// { url, text }
+RamApi.cryAsync(lang).then(data => { console.log(data); }).catch(error => {});
+
+// { url }
+RamApi.tiredAsync().then(data => { console.log(data); }).catch(error => {});
+
+// { url }
+RamApi.sickAsync().then(data => { console.log(data); }).catch(error => {});
+
+// { url, text, text2, text3, text4, textFormatted }
+// textFormatted is "Ada Had slapped Bea". text2, text3, and text4 may be "NULL"
+RamApi.slapAsync("Ada", "Bea").then(data => { console.log(data); }).catch(error => {});
+
+// { url }
+RamApi.kissAsync().then(data => { console.log(data); }).catch(error => {});
+
+// { url }
+RamApi.hugAsync().then(data => { console.log(data); }).catch(error => {});
+
+// { url, text }
+RamApi.goodNightAsync(lang).then(data => { console.log(data); }).catch(error => {});
+
+// { url, text }
+RamApi.goodMorningAsync(lang).then(data => { console.log(data); }).catch(error => {});
+
+// { url }
+RamApi.cuddleAsync().then(data => { console.log(data); }).catch(error => {});
+
+// { text: "Hi, How are you?" }
+RamApi.helloAsync(lang).then(data => { console.log(data); }).catch(error => {});
+
+// { api_choice: "rock", your_choice: "paper" }
+RamApi.rpsAsync("paper").then(data => { console.log(data); }).catch(error => {});
+
+// { text }
+RamApi._8ballAsync(lang).then(data => { console.log(data); }).catch(error => {});
-RamApi.laughAsync()
-.then((data) => {
-console.log(data);
-})
-.catch((error) => {});
+// { limit, current, remaining, resetTime, resetTimeFormated }
+// { limit: 2, current: 1, remaining: 1, resetTime: "2026-10-21T05:12:05.972Z", resetTimeFormated: "Today at 5:12 AM" }
+RamApi.rateLimitAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.versionInfoAsync("v14").then(data => {console.log(data)}).catch(error => {})
+// { Number, roundedNumber, flooredNumber, enteredNumbers }
+// { Number: 4.09, roundedNumber: 4, flooredNumber: 4, enteredNumbers: "Min: 1 Max: 10" }
+RamApi.randomNumberAsync(1, 10).then(data => { console.log(data); }).catch(error => {});
-RamApi.birthdayAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// "Completed!"
+RamApi.suggestionAsync("This is a suggestion", "Example User").then(data => { console.log(data); }).catch(error => {});
-RamApi.cryAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { ping: "108ms" }
+RamApi.pingAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.tiredAsync().then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.ramAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.sickAsync().then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.nekoparaAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.slapAsync("user1", "user2").then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.mikuAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.kissAsync().then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.memeAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.hugAsync().then(data => {console.log(data)}).catch(error => {})
+// { text }
+RamApi.roastAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.goodNightAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { text }
+RamApi.complimentAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.goodMorningAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { setup, punchline }
+RamApi.dadJokeAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.cuddleAsync().then(data => {console.log(data)}).catch(error => {})
+// topic: space, food, animals, places, or science
+// { id: "fact_01", topic: "space", text }
+RamApi.factAsync("space").then(data => { console.log(data); }).catch(error => {});
-RamApi.helloAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { text }
+RamApi.fortuneAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.rpsAsync("paper").then(data => {console.log(data)}).catch(error => {})
+// { name, scientificName, habitat, diet, fact, image }
+RamApi.animalAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi._8ballAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// category: general, science, history, or games. difficulty: easy, medium, or hard
+// The answer is not included. Check it with quizCheckAsync
+// { id, category, difficulty, question, choices: ["Venus", "Mars", "Jupiter", "Mercury"] }
+RamApi.triviaAsync("science", "easy").then(data => { console.log(data); }).catch(error => {});
-RamApi.rateLimitAsync().then(data => {console.log(data)}).catch(error => {})
+// { id, prompt }
+RamApi.wyrAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.randomNumberAsync(9, 7).then(data => {console.log(data)}).catch(error => {})
+// { id, prompt }
+RamApi.neverHaveIEverAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.suggestionAsync("This is a suggestion", "Example User").then(data => {console.log(data)}).catch(error => {})
+// type: truth, dare, or any. rating: pg or teen
+// { type: "truth", rating: "pg", prompt }
+RamApi.truthOrDareAsync("truth", "pg").then(data => { console.log(data); }).catch(error => {});
-RamApi.pingAsync().then(data => {console.log(data)}).catch(error => {})
+// pass "yes" to include hint
+// { id, scrambled, length, hint }
+RamApi.wordScrambleAsync("yes").then(data => { console.log(data); }).catch(error => {});
-RamApi.ramAsync().then(data => {console.log(data)}).catch(error => {})
+// { id, min: 1, max: 20, attempts: 8, prompt }
+RamApi.guessNumberAsync(20).then(data => { console.log(data); }).catch(error => {});
-RamApi.nekoparaAsync().then(data => {console.log(data)}).catch(error => {})
+// trivia or scramble: { id, correct, answer }
+// wrong number guess: { id, correct: false, direction: "higher", attemptsLeft: 7 }
+RamApi.quizCheckAsync("question id", "answer").then(data => { console.log(data); }).catch(error => {});
-RamApi.mikuAsync().then(data => {console.log(data)}).catch(error => {})
+// game: guess, trivia, or scramble
+// { sessionId, game: "guess", status: "lobby", host: "Ada", players: [{ name: "Ada", score: 0 }], expiresAt }
+RamApi.gameSessionAsync("guess", "Ada").then(data => { console.log(data); }).catch(error => {});
-RamApi.memeAsync().then(data => { console.log(data)}).catch(error => {})
+// action: join, start, guess, or answer. value is the guess or answer
+// join: { sessionId, game, status: "lobby", host, players, expiresAt, result: "joined" }
+// start: { sessionId, game, status: "active", host, players, expiresAt, round: { prompt, attemptsLeft }, result: "started" }
+// guess: { sessionId, game, status: "active", host, players, expiresAt, round: { prompt, attemptsLeft }, result: "higher" }
+RamApi.gameMoveAsync("session id", "Ada", "guess", "10").then(data => { console.log(data); }).catch(error => {});
```
diff --git a/Examples/Events.md b/Examples/Events.md
index 90d7b68..166e41f 100644
--- a/Examples/Events.md
+++ b/Examples/Events.md
@@ -1,14 +1,12 @@
diff --git a/Examples/ExecuteLogger.md b/Examples/ExecuteLogger.md
index fe5826a..81d4376 100644
--- a/Examples/ExecuteLogger.md
+++ b/Examples/ExecuteLogger.md
@@ -1,14 +1,12 @@
@@ -19,7 +17,7 @@
> Execute Examples
```javascript
-import \* as ramapi from "ram-api.js"; // typescript
+import * as ramapi from "ram-api.js"; // typescript
const ramapi = require("ram-api.js"); // javascript
new ramapi.ExecuteLogger("Test Logger").infoAsync("testing without a process name")
diff --git a/Examples/Extended.md b/Examples/Extended.md
index 4864d3a..c7c0236 100644
--- a/Examples/Extended.md
+++ b/Examples/Extended.md
@@ -1,14 +1,12 @@
@@ -16,66 +14,86 @@
[Back to readme](../README.md)
-This is not supported past v15
+This is not supported past v15. v16 and v17 use NormalEndpoints. v13 is retired.
> Extended Examples
+Returns below are the objects the methods resolve with.
+
```javascript
-import \* as ramapi from "ram-api.js"; // typescript
+import * as ramapi from "ram-api.js"; // typescript
const ramapi = require("ram-api.js"); // javascript
const lang = "english"; // "spanish" for spanish
let RamApi = new ramapi.ExtendedEndpoints("api key here", "v14", 60000, 1);
+// { url }
+RamApi.laughAsync().then((data) => { console.log(data); }).catch((error) => {});
-RamApi.laughAsync()
-.then((data) => {
-console.log(data);
-})
-.catch((error) => {});
-
-RamApi.versionInfoAsync().then(data => {console.log(data)}).catch(error => {})
+// { version, outdated, supported, latest }
+RamApi.versionInfoAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.birthdayAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { text, url }
+RamApi.birthdayAsync(lang).then(data => { console.log(data); }).catch(error => {});
-RamApi.cryAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { url, text }
+RamApi.cryAsync(lang).then(data => { console.log(data); }).catch(error => {});
-RamApi.tiredAsync().then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.tiredAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.sickAsync().then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.sickAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.slapAsync("user1", "user2").then(data => {console.log(data)}).catch(error => {})
+// { url, text, text2, text3, text4, textFormatted }
+RamApi.slapAsync("Ada", "Bea").then(data => { console.log(data); }).catch(error => {});
-RamApi.kissAsync().then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.kissAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.hugAsync().then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.hugAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.goodNightAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { url, text }
+RamApi.goodNightAsync(lang).then(data => { console.log(data); }).catch(error => {});
-RamApi.goodMorningAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { url, text }
+RamApi.goodMorningAsync(lang).then(data => { console.log(data); }).catch(error => {});
-RamApi.cuddleAsync().then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.cuddleAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.helloAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { text }
+RamApi.helloAsync(lang).then(data => { console.log(data); }).catch(error => {});
-RamApi.rpsAsync("paper").then(data => {console.log(data)}).catch(error => {})
+// { api_choice, your_choice }
+RamApi.rpsAsync("paper").then(data => { console.log(data); }).catch(error => {});
-RamApi._8ballAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { text }
+RamApi._8ballAsync(lang).then(data => { console.log(data); }).catch(error => {});
-RamApi.rateLimitAsync().then(data => {console.log(data)}).catch(error => {})
+// { limit, current, remaining, resetTime, resetTimeFormated }
+RamApi.rateLimitAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.randomNumberAsync(9, 7).then(data => {console.log(data)}).catch(error => {})
+// { Number, roundedNumber, flooredNumber, enteredNumbers }
+RamApi.randomNumberAsync(1, 10).then(data => { console.log(data); }).catch(error => {});
-RamApi.suggestionAsync("This is a suggestion", "Example User").then(data => {console.log(data)}).catch(error => {})
+// "Completed!"
+RamApi.suggestionAsync("This is a suggestion", "Example User").then(data => { console.log(data); }).catch(error => {});
-RamApi.pingAsync().then(data => {console.log(data)}).catch(error => {})
+// { ping: "108ms" }
+RamApi.pingAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.ramAsync().then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.ramAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.nekoparaAsync().then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.nekoparaAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.mikuAsync().then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.mikuAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.memeAsync().then(data => { console.log(data)}).catch(error => {})
+// { url }
+RamApi.memeAsync().then(data => { console.log(data); }).catch(error => {});
```
diff --git a/Examples/Normal.md b/Examples/Normal.md
index 32d1455..d6d74c3 100644
--- a/Examples/Normal.md
+++ b/Examples/Normal.md
@@ -1,14 +1,12 @@
@@ -18,62 +16,141 @@
> Normal Examples
+Returns below are the objects the methods resolve with. v16 and v17 use the token header.
+
```javascript
-import \* as ramapi from "ram-api.js"; // typescript
+import * as ramapi from "ram-api.js"; // typescript
const ramapi = require("ram-api.js"); // javascript
const lang = "english"; // "spanish" for spanish
-let RamApi = new ramapi.NormalEndpoints("api key here", "v14", 60000, 1);
+let RamApi = new ramapi.NormalEndpoints("api key here", "v17", 60000, 1);
+
+// { url }
+RamApi.laughAsync().then((data) => { console.log(data); }).catch((error) => {});
+
+// { version, outdated, supported, latest }
+// { version: "v17", outdated: false, supported: true, latest: "v17" }
+RamApi.versionInfoAsync().then(data => { console.log(data); }).catch(error => {});
+
+// { text, url }
+RamApi.birthdayAsync(lang).then(data => { console.log(data); }).catch(error => {});
+
+// { url, text }
+RamApi.cryAsync(lang).then(data => { console.log(data); }).catch(error => {});
+
+// { url }
+RamApi.tiredAsync().then(data => { console.log(data); }).catch(error => {});
+
+// { url }
+RamApi.sickAsync().then(data => { console.log(data); }).catch(error => {});
+
+// { url, text, text2, text3, text4, textFormatted }
+// textFormatted is "Ada Had slapped Bea". text2, text3, and text4 may be "NULL"
+RamApi.slapAsync("Ada", "Bea").then(data => { console.log(data); }).catch(error => {});
+
+// { url }
+RamApi.kissAsync().then(data => { console.log(data); }).catch(error => {});
+
+// { url }
+RamApi.hugAsync().then(data => { console.log(data); }).catch(error => {});
+
+// { url, text }
+RamApi.goodNightAsync(lang).then(data => { console.log(data); }).catch(error => {});
+
+// { url, text }
+RamApi.goodMorningAsync(lang).then(data => { console.log(data); }).catch(error => {});
+
+// { url }
+RamApi.cuddleAsync().then(data => { console.log(data); }).catch(error => {});
+
+// { text: "Hi, How are you?" }
+RamApi.helloAsync(lang).then(data => { console.log(data); }).catch(error => {});
+
+// { api_choice: "rock", your_choice: "paper" }
+RamApi.rpsAsync("paper").then(data => { console.log(data); }).catch(error => {});
+// { text }
+RamApi._8ballAsync(lang).then(data => { console.log(data); }).catch(error => {});
-RamApi.laughAsync()
-.then((data) => {
-console.log(data);
-})
-.catch((error) => {});
+// { limit, current, remaining, resetTime, resetTimeFormated }
+// { limit: 2, current: 1, remaining: 1, resetTime: "2026-10-21T05:12:05.972Z", resetTimeFormated: "Today at 5:12 AM" }
+RamApi.rateLimitAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.versionInfoAsync().then(data => {console.log(data)}).catch(error => {})
+// { Number, roundedNumber, flooredNumber, enteredNumbers }
+// { Number: 4.09, roundedNumber: 4, flooredNumber: 4, enteredNumbers: "Min: 1 Max: 10" }
+RamApi.randomNumberAsync(1, 10).then(data => { console.log(data); }).catch(error => {});
-RamApi.birthdayAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// "Completed!"
+RamApi.suggestionAsync("This is a suggestion", "Example User").then(data => { console.log(data); }).catch(error => {});
-RamApi.cryAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { ping: "108ms" }
+RamApi.pingAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.tiredAsync().then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.ramAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.sickAsync().then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.nekoparaAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.slapAsync("user1", "user2").then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.mikuAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.kissAsync().then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.memeAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.hugAsync().then(data => {console.log(data)}).catch(error => {})
+// { text }
+RamApi.roastAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.goodNightAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { text }
+RamApi.complimentAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.goodMorningAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { setup, punchline }
+RamApi.dadJokeAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.cuddleAsync().then(data => {console.log(data)}).catch(error => {})
+// topic: space, food, animals, places, or science
+// { id: "fact_01", topic: "space", text }
+RamApi.factAsync("space").then(data => { console.log(data); }).catch(error => {});
-RamApi.helloAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { text }
+RamApi.fortuneAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.rpsAsync("paper").then(data => {console.log(data)}).catch(error => {})
+// { name, scientificName, habitat, diet, fact, image }
+RamApi.animalAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi._8ballAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// category: general, science, history, or games. difficulty: easy, medium, or hard
+// The answer is not included. Check it with quizCheckAsync
+// { id, category, difficulty, question, choices: ["Venus", "Mars", "Jupiter", "Mercury"] }
+RamApi.triviaAsync("science", "easy").then(data => { console.log(data); }).catch(error => {});
-RamApi.rateLimitAsync().then(data => {console.log(data)}).catch(error => {})
+// { id, prompt }
+RamApi.wyrAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.randomNumberAsync(9, 7).then(data => {console.log(data)}).catch(error => {})
+// { id, prompt }
+RamApi.neverHaveIEverAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.suggestionAsync("This is a suggestion", "Example User").then(data => {console.log(data)}).catch(error => {})
+// type: truth, dare, or any. rating: pg or teen
+// { type: "truth", rating: "pg", prompt }
+RamApi.truthOrDareAsync("truth", "pg").then(data => { console.log(data); }).catch(error => {});
-RamApi.pingAsync().then(data => {console.log(data)}).catch(error => {})
+// pass "yes" to include hint
+// { id, scrambled, length, hint }
+RamApi.wordScrambleAsync("yes").then(data => { console.log(data); }).catch(error => {});
-RamApi.ramAsync().then(data => {console.log(data)}).catch(error => {})
+// { id, min: 1, max: 20, attempts: 8, prompt }
+RamApi.guessNumberAsync(20).then(data => { console.log(data); }).catch(error => {});
-RamApi.nekoparaAsync().then(data => {console.log(data)}).catch(error => {})
+// trivia or scramble: { id, correct, answer }
+// wrong number guess: { id, correct: false, direction: "higher", attemptsLeft: 7 }
+RamApi.quizCheckAsync("question id", "answer").then(data => { console.log(data); }).catch(error => {});
-RamApi.mikuAsync().then(data => {console.log(data)}).catch(error => {})
+// game: guess, trivia, or scramble
+// { sessionId, game: "guess", status: "lobby", host: "Ada", players: [{ name: "Ada", score: 0 }], expiresAt }
+RamApi.gameSessionAsync("guess", "Ada").then(data => { console.log(data); }).catch(error => {});
-RamApi.memeAsync().then(data => { console.log(data)}).catch(error => {})
+// action: join, start, guess, or answer. value is the guess or answer
+// join: { sessionId, game, status: "lobby", host, players, expiresAt, result: "joined" }
+// start: { sessionId, game, status: "active", host, players, expiresAt, round: { prompt, attemptsLeft }, result: "started" }
+// guess: { sessionId, game, status: "active", host, players, expiresAt, round: { prompt, attemptsLeft }, result: "higher" }
+RamApi.gameMoveAsync("session id", "Ada", "guess", "10").then(data => { console.log(data); }).catch(error => {});
```
diff --git a/Examples/Pro.md b/Examples/Pro.md
index b048d3b..e319987 100644
--- a/Examples/Pro.md
+++ b/Examples/Pro.md
@@ -1,14 +1,12 @@
@@ -16,65 +14,86 @@
[Back to readme](../README.md)
-This is not supported past v15
+This is not supported past v15. v16 and v17 use NormalEndpoints. v13 is retired.
> Pro Examples
+Returns below are the objects the methods resolve with.
+
```javascript
-import \* as ramapi from "ram-api.js"; // typescript
+import * as ramapi from "ram-api.js"; // typescript
const ramapi = require("ram-api.js"); // javascript
const lang = "english"; // "spanish" for spanish
let RamApi = new ramapi.ProEndpoints("api key here", "v14", 60000, 1);
+// { url }
+RamApi.laughAsync().then((data) => { console.log(data); }).catch((error) => {});
-RamApi.laughAsync()
-.then((data) => {
-console.log(data);
-})
-.catch((error) => {});
+// { version, outdated, supported, latest }
+RamApi.versionInfoAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.versionInfoAsync().then(data => {console.log(data)}).catch(error => {})
+// { text, url }
+RamApi.birthdayAsync(lang).then(data => { console.log(data); }).catch(error => {});
-RamApi.birthdayAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { url, text }
+RamApi.cryAsync(lang).then(data => { console.log(data); }).catch(error => {});
-RamApi.cryAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.tiredAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.tiredAsync().then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.sickAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.sickAsync().then(data => {console.log(data)}).catch(error => {})
+// { url, text, text2, text3, text4, textFormatted }
+RamApi.slapAsync("Ada", "Bea").then(data => { console.log(data); }).catch(error => {});
-RamApi.slapAsync("user1", "user2").then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.kissAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.kissAsync().then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.hugAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.hugAsync().then(data => {console.log(data)}).catch(error => {})
+// { url, text }
+RamApi.goodNightAsync(lang).then(data => { console.log(data); }).catch(error => {});
-RamApi.goodNightAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { url, text }
+RamApi.goodMorningAsync(lang).then(data => { console.log(data); }).catch(error => {});
-RamApi.goodMorningAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.cuddleAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.cuddleAsync().then(data => {console.log(data)}).catch(error => {})
+// { text }
+RamApi.helloAsync(lang).then(data => { console.log(data); }).catch(error => {});
-RamApi.helloAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { api_choice, your_choice }
+RamApi.rpsAsync("paper").then(data => { console.log(data); }).catch(error => {});
-RamApi.rpsAsync("paper").then(data => {console.log(data)}).catch(error => {})
+// { text }
+RamApi._8ballAsync(lang).then(data => { console.log(data); }).catch(error => {});
-RamApi._8ballAsync(lang).then(data => {console.log(data)}).catch(error => {})
+// { limit, current, remaining, resetTime, resetTimeFormated }
+RamApi.rateLimitAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.rateLimitAsync().then(data => {console.log(data)}).catch(error => {})
+// { Number, roundedNumber, flooredNumber, enteredNumbers }
+RamApi.randomNumberAsync(1, 10).then(data => { console.log(data); }).catch(error => {});
-RamApi.randomNumberAsync(9, 7).then(data => {console.log(data)}).catch(error => {})
+// "Completed!"
+RamApi.suggestionAsync("This is a suggestion", "Example User").then(data => { console.log(data); }).catch(error => {});
-RamApi.suggestionAsync("This is a suggestion", "Example User").then(data => {console.log(data)}).catch(error => {})
+// { ping: "108ms" }
+RamApi.pingAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.pingAsync().then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.ramAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.ramAsync().then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.nekoparaAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.nekoparaAsync().then(data => {console.log(data)}).catch(error => {})
+// { url }
+RamApi.mikuAsync().then(data => { console.log(data); }).catch(error => {});
-RamApi.mikuAsync().then(data => {console.log(data)}).catch(error => {})
-RamApi.memeAsync().then(data => { console.log(data)}).catch(error => {})
+// { url }
+RamApi.memeAsync().then(data => { console.log(data); }).catch(error => {});
```
diff --git a/Examples/Utils.md b/Examples/Utils.md
index e5f0455..47e0653 100644
--- a/Examples/Utils.md
+++ b/Examples/Utils.md
@@ -1,14 +1,12 @@
@@ -20,12 +18,13 @@
```javascript
-import \* as ramapi from "ram-api.js"; // typescript
+import * as ramapi from "ram-api.js"; // typescript
const ramapi = require("ram-api.js"); // javascript
-new ramapi.Utils().VersionCheck("v13", "60000", 6)
+new ramapi.Utils().VersionCheck("v17", "60000", 6)
-new ramapi.Utils().pingAsync().then(data => (console.log(data))).catch(err => {})
+// { ping: "108ms" }
+new ramapi.Utils().pingAsync().then(data => { console.log(data); }).catch(err => {})
diff --git a/README.md b/README.md
index ca9ee40..71c52ae 100644
--- a/README.md
+++ b/README.md
@@ -1,14 +1,12 @@
@@ -22,17 +20,19 @@ We understand using ram api can be hard as it has alot this package calls the ap
`npm i ram-api.js` or `yarn add ram-api.js`
-> Update to 15.0.x
+> Update
```text
use Normal for v16 and up
-no other changes
+current api version is v17
+
+v13 is retired
```
> api key
-for a api key join the discord and go to #request-api-keys https://discord.gg/q3ycRjBG9q
+for a api key join the discord and go to #request-api-keys https://discord.gamearoo.dev
@@ -56,7 +56,7 @@ for a api key join the discord and go to #request-api-keys https://discord.gg/q3
> Missing endpoint
-current api version is v16 if v17 is out then contact support
+current api version is v17. v13 is retired
ram api endpoints can be found at https://api.rambot.xyz
@@ -64,4 +64,4 @@ ram api endpoints can be found at https://api.rambot.xyz
email : support@rambot.xyz
-discord: https://discord.gg/q3ycRjBG9q
+discord: https://discord.gamearoo.dev
diff --git a/Src/Demo.ts b/Src/Demo.ts
index 43d3af1..b771239 100644
--- a/Src/Demo.ts
+++ b/Src/Demo.ts
@@ -19,7 +19,7 @@ export class DemoEndpoints {
this.retryAfter = retryAfter;
this.retry = retry;
this.baseURL = "https://api.rambot.xyz/demo"
- this.version = "v15"
+ this.version = "v17"
this.headers = {};
}
private async _newErrors(endpoint: string, error: any, resolve: any, reject: any, type: string, _options: any, loop = 0) {
@@ -82,7 +82,9 @@ export class DemoEndpoints {
private _apiRequest(
endpoint: string,
_options?: {
- params?: {}
+ params?: {},
+ method?: "get" | "post",
+ data?: any
}
) {
@@ -90,8 +92,8 @@ export class DemoEndpoints {
_options = _options || {};
- const supportedVersions = ["v15"];
- const outdatedVersions = ["v12", "v13", "v14"];
+ const supportedVersions = ["v17"];
+ const outdatedVersions = ["v14", "v15", "v16"];
const notsupported = [
"v0",
"v1",
@@ -104,9 +106,11 @@ export class DemoEndpoints {
"v8",
"v9",
"v10",
- "v11"
+ "v11",
+ "v12",
+ "v13"
];
- const requestedVersion = this.version || "v15";
+ const requestedVersion = this.version || "v17";
if (supportedVersions.includes(requestedVersion)) {
} else if (outdatedVersions.includes(requestedVersion)) {
@@ -123,9 +127,10 @@ export class DemoEndpoints {
try {
const response = await axios({
- method: "get",
+ method: _options.method || "get",
url: endpoint,
params: _options.params || {},
+ data: _options.data,
baseURL: this.baseURL,
headers: this.headers
});
@@ -137,14 +142,14 @@ export class DemoEndpoints {
error,
resolve,
reject,
- "get",
+ _options.method || "get",
_options
);
}
});
}
async versionInfoAsync(version?: string): Promise<{ version: string; outdated: boolean; supported: boolean; latest: string }> {
- if (!version) version = "v15";
+ if (!version) version = "v17";
return await this._apiRequest("/versionCheck", { params: { version: version } }) as Promise<{ version: string; outdated: boolean; supported: boolean; latest: string }>;
}
@@ -185,7 +190,7 @@ export class DemoEndpoints {
return await this._apiRequest("/hug") as Promise<{ url: string }>;
}
async goodNightAsync(lang = "english"): Promise<{ text: string, url: string }> {
- return await this._apiRequest("/goodNight") as Promise<{ text: string, url: string }>;
+ return await this._apiRequest("/goodNight", { params: { lang } }) as Promise<{ text: string, url: string }>;
}
async goodMorningAsync(lang = "english"): Promise<{ text: string, url: string }> {
return await this._apiRequest("/goodMorning", { params: { lang } }) as Promise<{ text: string, url: string }>;
@@ -203,7 +208,7 @@ export class DemoEndpoints {
return await this._apiRequest("/8ball", { params: { lang } }) as Promise<{ text: string }>;
}
async rateLimitAsync(): Promise<{ limit: number, current: number, remaining: number, resetTime: string, resetTimeFormated: string }> {
- return await this._apiRequest("/ratelimit") as Promise<{ limit: number, current: number, remaining: number, resetTime: string, resetTimeFormated: string }>;
+ return await this._apiRequest("/rateLimit") as Promise<{ limit: number, current: number, remaining: number, resetTime: string, resetTimeFormated: string }>;
}
async randomNumberAsync(min: number, max: number): Promise<{ Number: number, roundedNumber: number, flooredNumber: number, enteredNumbers: string }> {
return await this._apiRequest("/randomNumber", {
@@ -244,4 +249,60 @@ export class DemoEndpoints {
async mikuAsync(): Promise<{ url: string }> {
return await this._apiRequest("/miku") as Promise<{ url: string }>;
}
+ async roastAsync(): Promise<{ text: string }> {
+ return await this._apiRequest("/roast") as Promise<{ text: string }>;
+ }
+ async complimentAsync(): Promise<{ text: string }> {
+ return await this._apiRequest("/compliment") as Promise<{ text: string }>;
+ }
+ async dadJokeAsync(): Promise<{ setup: string, punchline: string }> {
+ return await this._apiRequest("/dadJoke") as Promise<{ setup: string, punchline: string }>;
+ }
+ async factAsync(topic?: string): Promise<{ id: string, topic: string, text: string }> {
+ return await this._apiRequest("/fact", { params: { topic } }) as Promise<{ id: string, topic: string, text: string }>;
+ }
+ async fortuneAsync(): Promise<{ text: string }> {
+ return await this._apiRequest("/fortune") as Promise<{ text: string }>;
+ }
+ async animalAsync(): Promise<{ name: string, scientificName: string, habitat: string, diet: string, fact: string, image: string }> {
+ return await this._apiRequest("/animal") as Promise<{ name: string, scientificName: string, habitat: string, diet: string, fact: string, image: string }>;
+ }
+ async triviaAsync(category?: string, difficulty?: string): Promise<{ id: string, category: string, difficulty: string, question: string, choices: string[] }> {
+ return await this._apiRequest("/trivia", { params: { category, difficulty } }) as Promise<{ id: string, category: string, difficulty: string, question: string, choices: string[] }>;
+ }
+ async wyrAsync(): Promise<{ id: string, prompt: string }> {
+ return await this._apiRequest("/wyr") as Promise<{ id: string, prompt: string }>;
+ }
+ async neverHaveIEverAsync(): Promise<{ id: string, prompt: string }> {
+ return await this._apiRequest("/neverHaveIEver") as Promise<{ id: string, prompt: string }>;
+ }
+ async truthOrDareAsync(type?: string, rating?: string): Promise<{ type: string, rating: string, prompt: string }> {
+ return await this._apiRequest("/truthOrDare", { params: { type, rating } }) as Promise<{ type: string, rating: string, prompt: string }>;
+ }
+ async wordScrambleAsync(hint?: string): Promise<{ id: string, scrambled: string, length: number, hint?: string }> {
+ return await this._apiRequest("/wordScramble", { params: { hint } }) as Promise<{ id: string, scrambled: string, length: number, hint?: string }>;
+ }
+ async guessNumberAsync(max?: number): Promise<{ id: string, min: number, max: number, attempts: number, prompt: string }> {
+ return await this._apiRequest("/guessNumber", { params: { max } }) as Promise<{ id: string, min: number, max: number, attempts: number, prompt: string }>;
+ }
+ async quizCheckAsync(id: string, answer: string): Promise<{ id: string, correct: boolean, answer?: string, direction?: string, attemptsLeft?: number }> {
+ return await this._apiRequest("/quiz/check", {
+ method: "post",
+ data: { id, answer }
+ }) as Promise<{ id: string, correct: boolean, answer?: string, direction?: string, attemptsLeft?: number }>;
+ }
+ async gameSessionAsync(game: string, player: string): Promise<{ sessionId: string, game: string, status: string, host: string, players: { name: string, score: number }[], expiresAt: string }> {
+ return await this._apiRequest("/game/session", {
+ method: "post",
+ data: { game, player }
+ }) as Promise<{ sessionId: string, game: string, status: string, host: string, players: { name: string, score: number }[], expiresAt: string }>;
+ }
+ async gameMoveAsync(sessionId: string, player: string, action: string, value?: string): Promise<{ sessionId: string, game: string, status: string, host: string, players: { name: string, score: number }[], expiresAt: string, result: string, round?: { prompt: string, attemptsLeft: number } }> {
+ const data: { sessionId: string, player: string, action: string, value?: string } = { sessionId, player, action };
+ if (value !== undefined) data.value = value;
+ return await this._apiRequest("/game/move", {
+ method: "post",
+ data
+ }) as Promise<{ sessionId: string, game: string, status: string, host: string, players: { name: string, score: number }[], expiresAt: string, result: string, round?: { prompt: string, attemptsLeft: number } }>;
+ }
}
\ No newline at end of file
diff --git a/Src/Extended.ts b/Src/Extended.ts
index 3d341ff..2a930bc 100644
--- a/Src/Extended.ts
+++ b/Src/Extended.ts
@@ -90,8 +90,8 @@ var logger = new ExecuteLogger("Ram Bot Development");
_options = _options || {};
- const supportedVersions = ["v16"];
- const outdatedVersions = [ "v13", "v14", "v15"];
+ const supportedVersions = ["v15"];
+ const outdatedVersions = ["v14"];
const notsupported = [
"v0",
"v1",
@@ -105,10 +105,12 @@ var logger = new ExecuteLogger("Ram Bot Development");
"v9",
"v10",
"v11",
- "v12"
+ "v12",
+ "v13"
];
- const requestedVersion = this.version || "v14";
- if(requestedVersion === "v16") return reject("This is not supported past v15 use normal endpoint for v16+")
+ const requestedVersion = this.version || "v15";
+ const versionNumber = parseInt(String(requestedVersion).replace(/\D/g, ""), 10);
+ if (versionNumber >= 16) return reject("This is not supported past v15 use normal endpoint for v16+")
if (supportedVersions.includes(requestedVersion)) {
} else if (outdatedVersions.includes(requestedVersion)) {
@@ -181,7 +183,7 @@ var logger = new ExecuteLogger("Ram Bot Development");
return await this._apiRequest("/hug") as Promise<{ url: string }>;
}
async goodNightAsync(lang = "english"): Promise<{ text: string, url: string }> {
- return await this._apiRequest("/goodNight") as Promise<{ text: string, url: string }>;
+ return await this._apiRequest("/goodNight", { params: { lang } }) as Promise<{ text: string, url: string }>;
}
async goodMorningAsync(lang = "english"): Promise<{ text: string, url: string }> {
return await this._apiRequest("/goodMorning", { params: { lang } }) as Promise<{ text: string, url: string }>;
@@ -199,7 +201,7 @@ var logger = new ExecuteLogger("Ram Bot Development");
return await this._apiRequest("/8ball", { params: { lang } }) as Promise<{ text: string }>;
}
async rateLimitAsync(): Promise<{ limit: number, current: number, remaining: number, resetTime: string, resetTimeFormated: string }> {
- return await this._apiRequest("/ratelimit") as Promise<{ limit: number, current: number, remaining: number, resetTime: string, resetTimeFormated: string }>;
+ return await this._apiRequest("/rateLimit") as Promise<{ limit: number, current: number, remaining: number, resetTime: string, resetTimeFormated: string }>;
}
async randomNumberAsync(min: number, max: number): Promise<{ Number: number, roundedNumber: number, flooredNumber: number, enteredNumbers: string}> {
return await this._apiRequest("/randomNumber", {
@@ -215,7 +217,7 @@ var logger = new ExecuteLogger("Ram Bot Development");
try {
await axios({
method: "post",
- url: `/suggestion/${suggestion}`,
+ url: `/${this.version}/suggestion/${suggestion}`,
data: {}, // Replace {} with the actual request body you want to send
params: params || {},
baseURL: this.baseURL,
diff --git a/Src/Normal.ts b/Src/Normal.ts
index 2759e61..c5c5f01 100644
--- a/Src/Normal.ts
+++ b/Src/Normal.ts
@@ -14,7 +14,7 @@ var logger = new ExecuteLogger("Ram Bot Development");
- constructor(apikey: string, version = "v14", retryAfter = 60000, retry = 6) {
+ constructor(apikey: string, version = "v17", retryAfter = 60000, retry = 6) {
logger = new ExecuteLogger("Ram Bot Development");
this.retryAfter = retryAfter;
this.retry = retry;
@@ -22,7 +22,7 @@ var logger = new ExecuteLogger("Ram Bot Development");
this.version = version;
this.headers = {"api-key": apikey};
- if(version === "v16") this.headers = {"token": apikey};
+ if (Number(String(version).replace(/\D/g, "")) >= 16) this.headers = {"token": apikey};
}
@@ -86,7 +86,9 @@ var logger = new ExecuteLogger("Ram Bot Development");
private _apiRequest(
endpoint: string,
_options?: {
- params?: {}
+ params?: {},
+ method?: "get" | "post",
+ data?: any
}
) {
@@ -94,8 +96,8 @@ var logger = new ExecuteLogger("Ram Bot Development");
_options = _options || {};
- const supportedVersions = ["v16"];
- const outdatedVersions = [ "v13", "v14", "v15"];
+ const supportedVersions = ["v17"];
+ const outdatedVersions = ["v14", "v15", "v16"];
const notsupported = [
"v0",
"v1",
@@ -109,9 +111,10 @@ var logger = new ExecuteLogger("Ram Bot Development");
"v9",
"v10",
"v11",
- "v12"
+ "v12",
+ "v13"
];
- const requestedVersion = this.version || "v16";
+ const requestedVersion = this.version || "v17";
if (supportedVersions.includes(requestedVersion)) {
} else if (outdatedVersions.includes(requestedVersion)) {
@@ -128,9 +131,10 @@ var logger = new ExecuteLogger("Ram Bot Development");
try {
const response = await axios({
- method: "get",
+ method: _options.method || "get",
url: `/${requestedVersion}/` + endpoint,
params: _options.params || {},
+ data: _options.data,
baseURL: this.baseURL,
headers: this.headers
});
@@ -142,7 +146,7 @@ var logger = new ExecuteLogger("Ram Bot Development");
error,
resolve,
reject,
- "get",
+ _options.method || "get",
_options
);
}
@@ -184,7 +188,7 @@ var logger = new ExecuteLogger("Ram Bot Development");
return await this._apiRequest("/hug") as Promise<{ url: string }>;
}
async goodNightAsync(lang = "english"): Promise<{ text: string, url: string }> {
- return await this._apiRequest("/goodNight") as Promise<{ text: string, url: string }>;
+ return await this._apiRequest("/goodNight", { params: { lang } }) as Promise<{ text: string, url: string }>;
}
async goodMorningAsync(lang = "english"): Promise<{ text: string, url: string }> {
return await this._apiRequest("/goodMorning", { params: { lang } }) as Promise<{ text: string, url: string }>;
@@ -202,7 +206,7 @@ var logger = new ExecuteLogger("Ram Bot Development");
return await this._apiRequest("/8ball", { params: { lang } }) as Promise<{ text: string }>;
}
async rateLimitAsync(): Promise<{ limit: number, current: number, remaining: number, resetTime: string, resetTimeFormated: string }> {
- return await this._apiRequest("/ratelimit") as Promise<{ limit: number, current: number, remaining: number, resetTime: string, resetTimeFormated: string }>;
+ return await this._apiRequest("/rateLimit") as Promise<{ limit: number, current: number, remaining: number, resetTime: string, resetTimeFormated: string }>;
}
async randomNumberAsync(min: number, max: number): Promise<{ Number: number, roundedNumber: number, flooredNumber: number, enteredNumbers: string}> {
return await this._apiRequest("/randomNumber", {
@@ -218,7 +222,7 @@ var logger = new ExecuteLogger("Ram Bot Development");
try {
await axios({
method: "post",
- url: `/suggestion/${suggestion}`,
+ url: `/${this.version}/suggestion/${suggestion}`,
data: {}, // Replace {} with the actual request body you want to send
params: params || {},
baseURL: this.baseURL,
@@ -248,4 +252,60 @@ var logger = new ExecuteLogger("Ram Bot Development");
}) as Promise<{ url: string }>;
}
+ async roastAsync(): Promise<{ text: string }> {
+ return await this._apiRequest("/roast") as Promise<{ text: string }>;
+ }
+ async complimentAsync(): Promise<{ text: string }> {
+ return await this._apiRequest("/compliment") as Promise<{ text: string }>;
+ }
+ async dadJokeAsync(): Promise<{ setup: string, punchline: string }> {
+ return await this._apiRequest("/dadJoke") as Promise<{ setup: string, punchline: string }>;
+ }
+ async factAsync(topic?: string): Promise<{ id: string, topic: string, text: string }> {
+ return await this._apiRequest("/fact", { params: { topic } }) as Promise<{ id: string, topic: string, text: string }>;
+ }
+ async fortuneAsync(): Promise<{ text: string }> {
+ return await this._apiRequest("/fortune") as Promise<{ text: string }>;
+ }
+ async animalAsync(): Promise<{ name: string, scientificName: string, habitat: string, diet: string, fact: string, image: string }> {
+ return await this._apiRequest("/animal") as Promise<{ name: string, scientificName: string, habitat: string, diet: string, fact: string, image: string }>;
+ }
+ async triviaAsync(category?: string, difficulty?: string): Promise<{ id: string, category: string, difficulty: string, question: string, choices: string[] }> {
+ return await this._apiRequest("/trivia", { params: { category, difficulty } }) as Promise<{ id: string, category: string, difficulty: string, question: string, choices: string[] }>;
+ }
+ async wyrAsync(): Promise<{ id: string, prompt: string }> {
+ return await this._apiRequest("/wyr") as Promise<{ id: string, prompt: string }>;
+ }
+ async neverHaveIEverAsync(): Promise<{ id: string, prompt: string }> {
+ return await this._apiRequest("/neverHaveIEver") as Promise<{ id: string, prompt: string }>;
+ }
+ async truthOrDareAsync(type?: string, rating?: string): Promise<{ type: string, rating: string, prompt: string }> {
+ return await this._apiRequest("/truthOrDare", { params: { type, rating } }) as Promise<{ type: string, rating: string, prompt: string }>;
+ }
+ async wordScrambleAsync(hint?: string): Promise<{ id: string, scrambled: string, length: number, hint?: string }> {
+ return await this._apiRequest("/wordScramble", { params: { hint } }) as Promise<{ id: string, scrambled: string, length: number, hint?: string }>;
+ }
+ async guessNumberAsync(max?: number): Promise<{ id: string, min: number, max: number, attempts: number, prompt: string }> {
+ return await this._apiRequest("/guessNumber", { params: { max } }) as Promise<{ id: string, min: number, max: number, attempts: number, prompt: string }>;
+ }
+ async quizCheckAsync(id: string, answer: string): Promise<{ id: string, correct: boolean, answer?: string, direction?: string, attemptsLeft?: number }> {
+ return await this._apiRequest("/quiz/check", {
+ method: "post",
+ data: { id, answer }
+ }) as Promise<{ id: string, correct: boolean, answer?: string, direction?: string, attemptsLeft?: number }>;
+ }
+ async gameSessionAsync(game: string, player: string): Promise<{ sessionId: string, game: string, status: string, host: string, players: { name: string, score: number }[], expiresAt: string }> {
+ return await this._apiRequest("/game/session", {
+ method: "post",
+ data: { game, player }
+ }) as Promise<{ sessionId: string, game: string, status: string, host: string, players: { name: string, score: number }[], expiresAt: string }>;
+ }
+ async gameMoveAsync(sessionId: string, player: string, action: string, value?: string): Promise<{ sessionId: string, game: string, status: string, host: string, players: { name: string, score: number }[], expiresAt: string, result: string, round?: { prompt: string, attemptsLeft: number } }> {
+ const data: { sessionId: string, player: string, action: string, value?: string } = { sessionId, player, action };
+ if (value !== undefined) data.value = value;
+ return await this._apiRequest("/game/move", {
+ method: "post",
+ data
+ }) as Promise<{ sessionId: string, game: string, status: string, host: string, players: { name: string, score: number }[], expiresAt: string, result: string, round?: { prompt: string, attemptsLeft: number } }>;
+ }
}
\ No newline at end of file
diff --git a/Src/Pro.ts b/Src/Pro.ts
index ae6a5b2..9deaf3c 100644
--- a/Src/Pro.ts
+++ b/Src/Pro.ts
@@ -90,8 +90,8 @@ var logger = new ExecuteLogger("Ram Bot Development");
_options = _options || {};
- const supportedVersions = ["v16"];
- const outdatedVersions = [ "v13", "v14", "v15"];
+ const supportedVersions = ["v15"];
+ const outdatedVersions = ["v14"];
const notsupported = [
"v0",
"v1",
@@ -105,14 +105,16 @@ var logger = new ExecuteLogger("Ram Bot Development");
"v9",
"v10",
"v11",
- "v12"
+ "v12",
+ "v13"
];
- const requestedVersion = this.version || "v14";
- if(requestedVersion === "v16") return reject("This is not supported past v15 use normal endpoints for v16+")
+ const requestedVersion = this.version || "v15";
+ const versionNumber = parseInt(String(requestedVersion).replace(/\D/g, ""), 10);
+ if (versionNumber >= 16) return reject("This is not supported past v15 use normal endpoints for v16+")
if (supportedVersions.includes(requestedVersion)) {
} else if (outdatedVersions.includes(requestedVersion)) {
logger.warnAsync(
@@ -184,7 +186,7 @@ var logger = new ExecuteLogger("Ram Bot Development");
return await this._apiRequest("/hug") as Promise<{ url: string }>;
}
async goodNightAsync(lang = "english"): Promise<{ text: string, url: string }> {
- return await this._apiRequest("/goodNight") as Promise<{ text: string, url: string }>;
+ return await this._apiRequest("/goodNight", { params: { lang } }) as Promise<{ text: string, url: string }>;
}
async goodMorningAsync(lang = "english"): Promise<{ text: string, url: string }> {
return await this._apiRequest("/goodMorning", { params: { lang } }) as Promise<{ text: string, url: string }>;
@@ -202,7 +204,7 @@ var logger = new ExecuteLogger("Ram Bot Development");
return await this._apiRequest("/8ball", { params: { lang } }) as Promise<{ text: string }>;
}
async rateLimitAsync(): Promise<{ limit: number, current: number, remaining: number, resetTime: string, resetTimeFormated: string }> {
- return await this._apiRequest("/ratelimit") as Promise<{ limit: number, current: number, remaining: number, resetTime: string, resetTimeFormated: string }>;
+ return await this._apiRequest("/rateLimit") as Promise<{ limit: number, current: number, remaining: number, resetTime: string, resetTimeFormated: string }>;
}
async randomNumberAsync(min: number, max: number): Promise<{ Number: number, roundedNumber: number, flooredNumber: number, enteredNumbers: string}> {
return await this._apiRequest("/randomNumber", {
@@ -218,7 +220,7 @@ var logger = new ExecuteLogger("Ram Bot Development");
try {
await axios({
method: "post",
- url: `/suggestion/${suggestion}`,
+ url: `/${this.version}/suggestion/${suggestion}`,
data: {}, // Replace {} with the actual request body you want to send
params: params || {},
baseURL: this.baseURL,
diff --git a/Src/Utils.ts b/Src/Utils.ts
index 14934ae..d665128 100644
--- a/Src/Utils.ts
+++ b/Src/Utils.ts
@@ -3,10 +3,10 @@ import {ExecuteLocalLogger as ExecuteLogger } from "./ExecuteLocalLogger";
import { DemoEndpoints } from "./Demo";
var logger = new ExecuteLogger("Ram Bot Development");
-const latestVersion = "v16";
+const latestVersion = "v17";
-const supportedVersions = ["v16"];
-const outdatedVersions = ["v13", "v14", "v15"];
+const supportedVersions = ["v17"];
+const outdatedVersions = ["v14", "v15", "v16"];
const notsupported = [
"v0",
"v1",
@@ -20,7 +20,8 @@ const notsupported = [
"v9",
"v10",
"v11",
- "v12"
+ "v12",
+ "v13"
];
@@ -51,7 +52,7 @@ export class Utils {
async customAsync(endpoint: string, accessLevel = "demo", _options: {version?: string, params?: {}, headers?: {}}): Promise