Skip to content

Commit 4d6be26

Browse files
committed
Remove ramTotal for now (pre8)
1 parent 2dfbaa7 commit 4d6be26

File tree

4 files changed

+13
-20
lines changed

4 files changed

+13
-20
lines changed

index.js

+6-9
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,9 @@ class DisStat extends EventEmitter {
4242
data.guilds = this.bot.guilds.cache.size
4343
data.shards = this.bot.shard ? this.bot.shard.count : 0
4444
data.users = this.bot.guilds.cache.filter(guild => guild.available).reduce((acc, cur) => acc + cur.memberCount, 0)
45-
data.apiPing = this.bot.ws.ping > 0 ? this.bot.ws.ping : void 0
45+
data.apiPing = this.bot.ws && this.bot.ws.ping > 0 ? this.bot.ws.ping : null
4646
}
47-
48-
const memory = process.memoryUsage()
49-
data.ramUsage = memory.heapUsed
50-
data.ramTotal = memory.heapTotal
47+
data.ramUsage = process.memoryUsage.rss()
5148

5249
const endUsage = process.cpuUsage()
5350
const elapTime = endUsage.user - this.startUsage.user + endUsage.system - this.startUsage.system
@@ -89,7 +86,7 @@ class DisStat extends EventEmitter {
8986
async postData(data = {}) {
9087
if (this.autoposting && !this.noManualWarningSent) {
9188
console.warn("[DisStat " + new Date().toLocaleTimeString() +
92-
"] You are using autoposting, but you are still manually posting data. This is not recommended, as it can cause duplication and data loss due to overwriting.")
89+
"] You are using autoposting, but still manually posting data. This is not recommended, as it can cause duplication and data loss due to overwriting.")
9390
this.noManualWarningSent = true
9491
}
9592

@@ -116,12 +113,12 @@ class DisStat extends EventEmitter {
116113
}
117114
}
118115

119-
async postCommand(command = "", userId = void 0, guildId = void 0) {
116+
postCommand(command = "", userId = void 0, guildId = void 0) {
120117
if (!command || command.trim() == "") return new TypeError("No command name provided to postCommand().")
121118
this.postCustom("command", command, userId, guildId)
122119
}
123120

124-
async postCustom(type = "", value1 = void 0, value2 = void 0, value3 = void 0) {
121+
postCustom(type = "", value1 = void 0, value2 = void 0, value3 = void 0) {
125122
if (!type || type.trim() == "") return new TypeError("No custom graph type provided to postCustom().")
126123

127124
const body = {
@@ -131,7 +128,7 @@ class DisStat extends EventEmitter {
131128
value3
132129
}
133130
if (this.autoposting) this.unpostedCustom.push(body)
134-
else await fetch(baseURL + "bot/" + this.botId + "/custom", {
131+
else fetch(baseURL + "bot/" + this.botId + "/custom", {
135132
method: "POST",
136133
headers: {
137134
"Content-Type": "application/json",

index.test.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,20 @@ test("postData with valid api key", async () => {
3636

3737
test("postCommand empty", async () => {
3838
const disstat = new DisStat("DS-jest", "jest")
39-
const data = await disstat.postCommand()
40-
expect(data).toBeInstanceOf(TypeError)
39+
expect(disstat.postCommand()).toBeInstanceOf(TypeError)
4140
})
4241

4342
test("postCommand with content", async () => {
4443
const disstat = new DisStat("DS-jest", "jest")
45-
const data = await disstat.postCommand("jest")
46-
expect(data).toBeUndefined()
44+
expect(disstat.postCommand("jest")).toBeUndefined()
4745
})
4846

4947
test("postCustom empty", async () => {
5048
const disstat = new DisStat("DS-jest", "jest")
51-
const data = await disstat.postCustom()
52-
expect(data).toBeInstanceOf(TypeError)
49+
expect(disstat.postCustom()).toBeInstanceOf(TypeError)
5350
})
5451

5552
test("postCustom with all four args", async () => {
5653
const disstat = new DisStat("DS-jest", "jest")
57-
const data = await disstat.postCustom("jest", "jest", "jest", "jest")
58-
expect(data).toBeUndefined()
54+
expect(disstat.postCustom("jest", "jest", "jest", "jest")).toBeUndefined()
5955
})

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "disstat",
3-
"version": "1.0.0-pre7",
3+
"version": "1.0.0-pre8",
44
"description": "Post data from a discord.js client automatically, or manually to DisStat for Discord bot statistic tracking.",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)