Skip to content

Commit 6f9cfe0

Browse files
committed
Improve & update README docs
1 parent ad39cd0 commit 6f9cfe0

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,11 @@ console.log(botData)
3535
* Posts your bots data to DisStat.
3636
* Warning: You shouldn't use this when autoposting.
3737
*
38-
* @param {Object} data - The data to post:
39-
* @param {number} data.servers - The amount of servers your bot is in, e.g. client.guilds.cache.size
40-
* @param {number} data.users - The amount of users your bot can see, e.g. client.users.cache.size
41-
* @param {number} data.shards - The amount of shards your bot is using, e.g. client.shard.count
38+
* @param {Object} data - The data to post
39+
* @see https://disstat.pages.dev/docs
40+
* @returns {Promise<Object>} - Only on error: The error object received from the API
4241
*/
43-
const newBotData = await disstat.postData({ servers: 42, users: 100, shards: 1 })
44-
console.log(newBotData)
42+
disstat.postData({ guilds: 42, users: 100, shards: 1 })
4543

4644
/*
4745
* Posts a command to DisStat using custom graphs.
@@ -59,17 +57,22 @@ disstat.postCommand("help", "581146486646243339", "1081089799324180490")
5957
* Posts data for a custom graph to DisStat.
6058
* Note that using a new type here creates the custom graph
6159
* on DisStat if you have enough unused graph slots.
60+
*
6261
* Don't use names like "servers" or "users" here, as they are reserved
6362
* for the main graphs, and would get overwritten.
6463
*
64+
* "type" must not be longer than 50 characters.
65+
* "value1", "value2" and "value3" must not be longer than 100 characters.
66+
*
6567
* @param {string} type - The name of the custom graph to post to
6668
* @param {string|Number} value1? - First custom value (e.g. an event name like "interactionCreate")
6769
* @param {string|Number} value2? - Second custom value (e.g. a user ID)
6870
* @param {string|Number} value3? - Third custom value (e.g. a guild ID)
6971
*/
7072
disstat.postCustom("events", "interactionCreate")
7173

72-
if (message.content.includes("<@" + bot.user.id + ">")) {
74+
if (message.content.includes("<@" + client.user.id + ">")) {
75+
message.reply("My prefix is `!` 🤖")
7376
disstat.postCustom("ping")
7477
}
7578
```
@@ -80,10 +83,10 @@ if (message.content.includes("<@" + bot.user.id + ">")) {
8083
const DisStat = require("disstat")
8184
const disstat = new DisStat(...)
8285

86+
// This event also gets emitted on autoposting.
8387
disstat.on("post", (error, data) => {
8488
if (error) console.log("An error occurred while posting:", error, data)
8589
else console.log("Posted data successfully:", data)
86-
// This event also gets emitted on autoposting.
8790
})
8891

8992
disstat.on("autopostStart", () => {
@@ -93,7 +96,6 @@ disstat.on("autopostError", (error, data) => {
9396
console.log("Autopost failed: " + error, data)
9497
})
9598
disstat.on("autopostSuccess", data => {
96-
console.log("Successfully posting data:", data)
99+
console.log("Successfully posted data:", data)
97100
})
98-
99101
```

0 commit comments

Comments
 (0)