@@ -22,6 +22,26 @@ import { errorMessage, isDiscordAPIError, isDiscordHTTPError, SECONDS, successMe
22
22
import { loadYamlSafely } from "./utils/loadYamlSafely" ;
23
23
import { DecayingCounter } from "./utils/DecayingCounter" ;
24
24
25
+ // === START REST DEBUG ===
26
+ import fs from "fs" ;
27
+ import path from "path" ;
28
+ const APIRequest = require ( "discord.js/src/rest/APIRequest.js" ) ;
29
+
30
+ const dateStr = new Date ( ) . toISOString ( ) . replace ( / [: .] / g, "-" ) ;
31
+ const restDebugFile = path . join ( "../debug" , `rest_${ dateStr } .log` ) ;
32
+ fs . writeFileSync ( restDebugFile , "" ) ;
33
+
34
+ const originalMake = APIRequest . prototype . make ;
35
+ // tslint:disable-next-line:only-arrow-functions
36
+ APIRequest . prototype . make = function ( ...args ) {
37
+ const debugInfo = `${ new Date ( ) . toISOString ( ) } ${ this . method . toUpperCase ( ) } ${ this . route } ` ;
38
+ fs . appendFileSync ( restDebugFile , debugInfo + "\n" , { encoding : "utf8" } ) ;
39
+ // tslint:disable-next-line:no-console
40
+ console . log ( `[API REQUEST] ${ this . method } ${ this . route } ` ) ;
41
+ return originalMake . call ( this , ...args ) ;
42
+ } ;
43
+ // === END REST DEBUG ===
44
+
25
45
if ( ! process . env . KEY ) {
26
46
// tslint:disable-next-line:no-console
27
47
console . error ( "Project root .env with KEY is required!" ) ;
@@ -152,8 +172,8 @@ connect().then(async () => {
152
172
const client = new Client ( {
153
173
partials : [ "USER" , "CHANNEL" , "GUILD_MEMBER" , "MESSAGE" , "REACTION" ] ,
154
174
155
- restGlobalRateLimit : 20 ,
156
- restTimeOffset : 1000 ,
175
+ restGlobalRateLimit : 50 ,
176
+ // restTimeOffset: 1000,
157
177
158
178
// Disable mentions by default
159
179
allowedMentions : {
0 commit comments