1
1
const baseURL = "https://disstat-api.tomatenkuchen.com/v1/"
2
2
const autopostInterval = 90000
3
3
4
- const EventEmitter = require ( "node:events" )
4
+ const { EventEmitter } = require ( "node:events" )
5
5
const os = require ( "node:os" )
6
6
7
7
class DisStat extends EventEmitter {
@@ -29,7 +29,7 @@ class DisStat extends EventEmitter {
29
29
30
30
this . autoposting = true
31
31
this . bot = botInput
32
- setTimeout ( this . autopost , 30000 )
32
+ setTimeout ( ( ) => this . autopost ( ) , 30000 )
33
33
}
34
34
35
35
this . emit ( "ready" )
@@ -38,7 +38,9 @@ class DisStat extends EventEmitter {
38
38
async autopost ( ) {
39
39
this . emit ( "autopostStart" )
40
40
41
- const data = this . unpostedCustom
41
+ const data = {
42
+ custom : this . unpostedCustom
43
+ }
42
44
if ( this . bot ) {
43
45
data . guildCount = this . bot . guilds . cache . size
44
46
data . shardCount = this . bot . shard ? this . bot . shard . count : 0
@@ -65,11 +67,11 @@ class DisStat extends EventEmitter {
65
67
this . emit ( "autopostError" , e , data )
66
68
console . warn ( "[DisStat " + new Date ( ) . toLocaleTimeString ( ) + "] Failed to post data to DisStat API. Error: " + e . message , result )
67
69
68
- setTimeout ( this . autopost , autopostInterval / 2 )
70
+ setTimeout ( ( ) => this . autopost ( ) , autopostInterval )
69
71
return
70
72
}
71
73
72
- setTimeout ( this . autopost , autopostInterval )
74
+ setTimeout ( ( ) => this . autopost ( ) , autopostInterval )
73
75
this . unpostedCustom = [ ]
74
76
75
77
this . emit ( "autopostSuccess" , data )
0 commit comments