revbot.js 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -3
- package/dist/index.mjs +7 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -233,6 +233,8 @@ interface ClientEvents {
|
|
|
233
233
|
interface clientOptions {
|
|
234
234
|
/** Whether to fetch all members of a server. */
|
|
235
235
|
fetchMembers?: boolean;
|
|
236
|
+
/** wether to use X-Session-Token or X-Bot-Token*/
|
|
237
|
+
isBot?: boolean;
|
|
236
238
|
/** Configuration for REST API requests. */
|
|
237
239
|
rest?: {
|
|
238
240
|
/** The timeout for REST requests in milliseconds. */
|
package/dist/index.d.ts
CHANGED
|
@@ -233,6 +233,8 @@ interface ClientEvents {
|
|
|
233
233
|
interface clientOptions {
|
|
234
234
|
/** Whether to fetch all members of a server. */
|
|
235
235
|
fetchMembers?: boolean;
|
|
236
|
+
/** wether to use X-Session-Token or X-Bot-Token*/
|
|
237
|
+
isBot?: boolean;
|
|
236
238
|
/** Configuration for REST API requests. */
|
|
237
239
|
rest?: {
|
|
238
240
|
/** The timeout for REST requests in milliseconds. */
|
package/dist/index.js
CHANGED
|
@@ -3091,7 +3091,7 @@ var import_node_events = require("events");
|
|
|
3091
3091
|
var import_axios3 = __toESM(require("axios"));
|
|
3092
3092
|
|
|
3093
3093
|
// package.json
|
|
3094
|
-
var version = "0.0.
|
|
3094
|
+
var version = "0.0.7";
|
|
3095
3095
|
|
|
3096
3096
|
// src/rest/restClient.ts
|
|
3097
3097
|
var RestClient = class {
|
|
@@ -3110,13 +3110,14 @@ var RestClient = class {
|
|
|
3110
3110
|
return __async(this, null, function* () {
|
|
3111
3111
|
try {
|
|
3112
3112
|
if (!this.client.token) throw new Error("Token is required");
|
|
3113
|
+
const authHeader = this.client.bot ? "X-Bot-Token" : "X-Session-Token";
|
|
3113
3114
|
const config = {
|
|
3114
3115
|
method,
|
|
3115
3116
|
url: `${apiUrl}${url}`,
|
|
3116
3117
|
params: query,
|
|
3117
3118
|
data: body == null ? void 0 : body.body,
|
|
3118
3119
|
headers: {
|
|
3119
|
-
|
|
3120
|
+
[authHeader]: this.client.token,
|
|
3120
3121
|
"User-Agent": `RevBot.js/${version}`
|
|
3121
3122
|
}
|
|
3122
3123
|
};
|
|
@@ -3206,6 +3207,7 @@ var CDNClient = class {
|
|
|
3206
3207
|
return __async(this, null, function* () {
|
|
3207
3208
|
try {
|
|
3208
3209
|
if (!this.client.token) throw new Error("Token is required");
|
|
3210
|
+
const authHeader = this.client.bot ? "X-Bot-Token" : "X-Session-Token";
|
|
3209
3211
|
const config = {
|
|
3210
3212
|
method,
|
|
3211
3213
|
url: `${cdnUrl}${url}`,
|
|
@@ -3213,7 +3215,7 @@ var CDNClient = class {
|
|
|
3213
3215
|
data,
|
|
3214
3216
|
maxBodyLength: Infinity,
|
|
3215
3217
|
headers: __spreadValues({
|
|
3216
|
-
|
|
3218
|
+
[authHeader]: this.client.token,
|
|
3217
3219
|
"Content-Type": "multipart/form-data",
|
|
3218
3220
|
"User-Agent": `RevBot.js/${version}`
|
|
3219
3221
|
}, data.getHeaders())
|
|
@@ -3249,12 +3251,14 @@ var BaseClient = class extends import_node_events.EventEmitter {
|
|
|
3249
3251
|
* @param {clientOptions} [options={}] - The options for configuring the client.
|
|
3250
3252
|
*/
|
|
3251
3253
|
constructor(options = {}) {
|
|
3254
|
+
var _a;
|
|
3252
3255
|
super();
|
|
3253
3256
|
/** The authentication token for the client. */
|
|
3254
3257
|
__privateAdd(this, _token, null);
|
|
3255
3258
|
/** Whether the client is a bot. */
|
|
3256
3259
|
this.bot = true;
|
|
3257
3260
|
this.options = __spreadValues({}, options);
|
|
3261
|
+
this.bot = (_a = this.options.isBot) != null ? _a : true;
|
|
3258
3262
|
this.api = new RestClient(this);
|
|
3259
3263
|
this.cdn = new CDNClient(this);
|
|
3260
3264
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -3018,7 +3018,7 @@ import { EventEmitter } from "node:events";
|
|
|
3018
3018
|
import axios3 from "axios";
|
|
3019
3019
|
|
|
3020
3020
|
// package.json
|
|
3021
|
-
var version = "0.0.
|
|
3021
|
+
var version = "0.0.7";
|
|
3022
3022
|
|
|
3023
3023
|
// src/rest/restClient.ts
|
|
3024
3024
|
var RestClient = class {
|
|
@@ -3037,13 +3037,14 @@ var RestClient = class {
|
|
|
3037
3037
|
return __async(this, null, function* () {
|
|
3038
3038
|
try {
|
|
3039
3039
|
if (!this.client.token) throw new Error("Token is required");
|
|
3040
|
+
const authHeader = this.client.bot ? "X-Bot-Token" : "X-Session-Token";
|
|
3040
3041
|
const config = {
|
|
3041
3042
|
method,
|
|
3042
3043
|
url: `${apiUrl}${url}`,
|
|
3043
3044
|
params: query,
|
|
3044
3045
|
data: body == null ? void 0 : body.body,
|
|
3045
3046
|
headers: {
|
|
3046
|
-
|
|
3047
|
+
[authHeader]: this.client.token,
|
|
3047
3048
|
"User-Agent": `RevBot.js/${version}`
|
|
3048
3049
|
}
|
|
3049
3050
|
};
|
|
@@ -3133,6 +3134,7 @@ var CDNClient = class {
|
|
|
3133
3134
|
return __async(this, null, function* () {
|
|
3134
3135
|
try {
|
|
3135
3136
|
if (!this.client.token) throw new Error("Token is required");
|
|
3137
|
+
const authHeader = this.client.bot ? "X-Bot-Token" : "X-Session-Token";
|
|
3136
3138
|
const config = {
|
|
3137
3139
|
method,
|
|
3138
3140
|
url: `${cdnUrl}${url}`,
|
|
@@ -3140,7 +3142,7 @@ var CDNClient = class {
|
|
|
3140
3142
|
data,
|
|
3141
3143
|
maxBodyLength: Infinity,
|
|
3142
3144
|
headers: __spreadValues({
|
|
3143
|
-
|
|
3145
|
+
[authHeader]: this.client.token,
|
|
3144
3146
|
"Content-Type": "multipart/form-data",
|
|
3145
3147
|
"User-Agent": `RevBot.js/${version}`
|
|
3146
3148
|
}, data.getHeaders())
|
|
@@ -3176,12 +3178,14 @@ var BaseClient = class extends EventEmitter {
|
|
|
3176
3178
|
* @param {clientOptions} [options={}] - The options for configuring the client.
|
|
3177
3179
|
*/
|
|
3178
3180
|
constructor(options = {}) {
|
|
3181
|
+
var _a;
|
|
3179
3182
|
super();
|
|
3180
3183
|
/** The authentication token for the client. */
|
|
3181
3184
|
__privateAdd(this, _token, null);
|
|
3182
3185
|
/** Whether the client is a bot. */
|
|
3183
3186
|
this.bot = true;
|
|
3184
3187
|
this.options = __spreadValues({}, options);
|
|
3188
|
+
this.bot = (_a = this.options.isBot) != null ? _a : true;
|
|
3185
3189
|
this.api = new RestClient(this);
|
|
3186
3190
|
this.cdn = new CDNClient(this);
|
|
3187
3191
|
}
|
package/package.json
CHANGED