revbot.js 0.0.2 → 0.0.4
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 +2481 -0
- package/dist/index.d.ts +2481 -0
- package/dist/index.js +4219 -22
- package/dist/index.mjs +4146 -0
- package/package.json +2 -1
- package/dist/client/baseClient.js +0 -66
- package/dist/client/baseClient.js.map +0 -1
- package/dist/client/client.js +0 -120
- package/dist/client/client.js.map +0 -1
- package/dist/client/events/bulkMessageDelete.js +0 -22
- package/dist/client/events/bulkMessageDelete.js.map +0 -1
- package/dist/client/events/channelCreate.js +0 -42
- package/dist/client/events/channelCreate.js.map +0 -1
- package/dist/client/events/channelDelete.js +0 -30
- package/dist/client/events/channelDelete.js.map +0 -1
- package/dist/client/events/channelGroupJoin.js +0 -39
- package/dist/client/events/channelGroupJoin.js.map +0 -1
- package/dist/client/events/channelGroupLeave.js +0 -39
- package/dist/client/events/channelGroupLeave.js.map +0 -1
- package/dist/client/events/channelStarttyping.js +0 -27
- package/dist/client/events/channelStarttyping.js.map +0 -1
- package/dist/client/events/channelStopTyping.js +0 -27
- package/dist/client/events/channelStopTyping.js.map +0 -1
- package/dist/client/events/channelUpdate.js +0 -26
- package/dist/client/events/channelUpdate.js.map +0 -1
- package/dist/client/events/event.js +0 -21
- package/dist/client/events/event.js.map +0 -1
- package/dist/client/events/eventManager.js +0 -82
- package/dist/client/events/eventManager.js.map +0 -1
- package/dist/client/events/index.js +0 -39
- package/dist/client/events/index.js.map +0 -1
- package/dist/client/events/message.js +0 -43
- package/dist/client/events/message.js.map +0 -1
- package/dist/client/events/messageDelete.js +0 -31
- package/dist/client/events/messageDelete.js.map +0 -1
- package/dist/client/events/messageReact.js +0 -47
- package/dist/client/events/messageReact.js.map +0 -1
- package/dist/client/events/messageUnreact.js +0 -52
- package/dist/client/events/messageUnreact.js.map +0 -1
- package/dist/client/events/messageUpdate.js +0 -29
- package/dist/client/events/messageUpdate.js.map +0 -1
- package/dist/client/events/serverCreate.js +0 -37
- package/dist/client/events/serverCreate.js.map +0 -1
- package/dist/client/events/serverDelete.js +0 -27
- package/dist/client/events/serverDelete.js.map +0 -1
- package/dist/client/events/serverMemberJoin.js +0 -41
- package/dist/client/events/serverMemberJoin.js.map +0 -1
- package/dist/client/events/serverMemberLeave.js +0 -31
- package/dist/client/events/serverMemberLeave.js.map +0 -1
- package/dist/client/events/serverMemberUpdate.js +0 -45
- package/dist/client/events/serverMemberUpdate.js.map +0 -1
- package/dist/client/events/serverRoleDelete.js +0 -31
- package/dist/client/events/serverRoleDelete.js.map +0 -1
- package/dist/client/events/serverRoleUpdate.js +0 -29
- package/dist/client/events/serverRoleUpdate.js.map +0 -1
- package/dist/client/events/serverupdate.js +0 -26
- package/dist/client/events/serverupdate.js.map +0 -1
- package/dist/client/events/userUpdate.js +0 -28
- package/dist/client/events/userUpdate.js.map +0 -1
- package/dist/client/webSocket.js +0 -285
- package/dist/client/webSocket.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/managers/baseManager.js +0 -44
- package/dist/managers/baseManager.js.map +0 -1
- package/dist/managers/channelManager.js +0 -113
- package/dist/managers/channelManager.js.map +0 -1
- package/dist/managers/index.js +0 -25
- package/dist/managers/index.js.map +0 -1
- package/dist/managers/messageManager.js +0 -218
- package/dist/managers/messageManager.js.map +0 -1
- package/dist/managers/roleManager.js +0 -52
- package/dist/managers/roleManager.js.map +0 -1
- package/dist/managers/serverChannelManager.js +0 -81
- package/dist/managers/serverChannelManager.js.map +0 -1
- package/dist/managers/serverManager.js +0 -72
- package/dist/managers/serverManager.js.map +0 -1
- package/dist/managers/serverMemberManager.js +0 -128
- package/dist/managers/serverMemberManager.js.map +0 -1
- package/dist/managers/userManager.js +0 -56
- package/dist/managers/userManager.js.map +0 -1
- package/dist/rest/restClient.js +0 -113
- package/dist/rest/restClient.js.map +0 -1
- package/dist/rest/restUtils/queue.js +0 -22
- package/dist/rest/restUtils/queue.js.map +0 -1
- package/dist/struct/attachment.js +0 -42
- package/dist/struct/attachment.js.map +0 -1
- package/dist/struct/base.js +0 -88
- package/dist/struct/base.js.map +0 -1
- package/dist/struct/category.js +0 -65
- package/dist/struct/category.js.map +0 -1
- package/dist/struct/channel.js +0 -111
- package/dist/struct/channel.js.map +0 -1
- package/dist/struct/clientUser.js +0 -69
- package/dist/struct/clientUser.js.map +0 -1
- package/dist/struct/dmChannel.js +0 -87
- package/dist/struct/dmChannel.js.map +0 -1
- package/dist/struct/emoji.js +0 -49
- package/dist/struct/emoji.js.map +0 -1
- package/dist/struct/groupChannel.js +0 -203
- package/dist/struct/groupChannel.js.map +0 -1
- package/dist/struct/index.js +0 -37
- package/dist/struct/index.js.map +0 -1
- package/dist/struct/interfaces/baseChannel.js +0 -3
- package/dist/struct/interfaces/baseChannel.js.map +0 -1
- package/dist/struct/invite.js +0 -67
- package/dist/struct/invite.js.map +0 -1
- package/dist/struct/mentions.js +0 -86
- package/dist/struct/mentions.js.map +0 -1
- package/dist/struct/message.js +0 -249
- package/dist/struct/message.js.map +0 -1
- package/dist/struct/messageEmbed.js +0 -106
- package/dist/struct/messageEmbed.js.map +0 -1
- package/dist/struct/notesChannel.js +0 -92
- package/dist/struct/notesChannel.js.map +0 -1
- package/dist/struct/presence.js +0 -30
- package/dist/struct/presence.js.map +0 -1
- package/dist/struct/role.js +0 -107
- package/dist/struct/role.js.map +0 -1
- package/dist/struct/server.js +0 -164
- package/dist/struct/server.js.map +0 -1
- package/dist/struct/serverChannel.js +0 -118
- package/dist/struct/serverChannel.js.map +0 -1
- package/dist/struct/serverMember.js +0 -205
- package/dist/struct/serverMember.js.map +0 -1
- package/dist/struct/textChannel.js +0 -83
- package/dist/struct/textChannel.js.map +0 -1
- package/dist/struct/user.js +0 -172
- package/dist/struct/user.js.map +0 -1
- package/dist/struct/voiceChannels.js +0 -54
- package/dist/struct/voiceChannels.js.map +0 -1
- package/dist/test.js +0 -42
- package/dist/test.js.map +0 -1
- package/dist/utils/UUID.js +0 -53
- package/dist/utils/UUID.js.map +0 -1
- package/dist/utils/badges.js +0 -22
- package/dist/utils/badges.js.map +0 -1
- package/dist/utils/bitField.js +0 -79
- package/dist/utils/bitField.js.map +0 -1
- package/dist/utils/constants.js +0 -105
- package/dist/utils/constants.js.map +0 -1
- package/dist/utils/index.js +0 -22
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/permissions.js +0 -68
- package/dist/utils/permissions.js.map +0 -1
package/dist/rest/restClient.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.RestClient = void 0;
|
|
16
|
-
const axios_1 = __importDefault(require("axios"));
|
|
17
|
-
const utils_1 = require("../utils");
|
|
18
|
-
class RestClient {
|
|
19
|
-
constructor(client) {
|
|
20
|
-
this.client = client;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Helper function to handle API requests.
|
|
24
|
-
* @param method The HTTP method (GET, POST, PATCH, PUT, DELETE).
|
|
25
|
-
* @param url The URL for the request.
|
|
26
|
-
* @param body The request body (if applicable).
|
|
27
|
-
* @param query Query parameters (if applicable).
|
|
28
|
-
* @returns The API response.
|
|
29
|
-
*/
|
|
30
|
-
request(method, url, body, query) {
|
|
31
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
try {
|
|
33
|
-
if (!this.client.token)
|
|
34
|
-
throw new Error("Token is required");
|
|
35
|
-
const config = {
|
|
36
|
-
method,
|
|
37
|
-
url: `${utils_1.apiUrl}${url}`,
|
|
38
|
-
params: query,
|
|
39
|
-
data: body === null || body === void 0 ? void 0 : body.body,
|
|
40
|
-
headers: {
|
|
41
|
-
"X-Bot-Token": this.client.token,
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
const response = yield (0, axios_1.default)(config);
|
|
45
|
-
return response.data;
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
console.error("API call failed:", error);
|
|
49
|
-
throw error;
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* GET request.
|
|
55
|
-
* @param url The URL for the request.
|
|
56
|
-
* @param query Query parameters (if applicable).
|
|
57
|
-
* @returns The API response.
|
|
58
|
-
*/
|
|
59
|
-
get(url, query) {
|
|
60
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
return this.request("GET", url, undefined, query);
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* POST request.
|
|
66
|
-
* @param url The URL for the request.
|
|
67
|
-
* @param body The request body.
|
|
68
|
-
* @param query Query parameters (if applicable).
|
|
69
|
-
* @returns The API response.
|
|
70
|
-
*/
|
|
71
|
-
post(url, body, query) {
|
|
72
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
return this.request("POST", url, body, query);
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* PATCH request.
|
|
78
|
-
* @param url The URL for the request.
|
|
79
|
-
* @param body The request body.
|
|
80
|
-
* @param query Query parameters (if applicable).
|
|
81
|
-
* @returns The API response.
|
|
82
|
-
*/
|
|
83
|
-
patch(url, body, query) {
|
|
84
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
return this.request("PATCH", url, body, query);
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* PUT request.
|
|
90
|
-
* @param url The URL for the request.
|
|
91
|
-
* @param body The request body.
|
|
92
|
-
* @param query Query parameters (if applicable).
|
|
93
|
-
* @returns The API response.
|
|
94
|
-
*/
|
|
95
|
-
put(url, body, query) {
|
|
96
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
-
return this.request("PUT", url, body, query);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* DELETE request.
|
|
102
|
-
* @param url The URL for the request.
|
|
103
|
-
* @param query Query parameters (if applicable).
|
|
104
|
-
* @returns The API response.
|
|
105
|
-
*/
|
|
106
|
-
delete(url, body, query) {
|
|
107
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
return this.request("DELETE", url, body, query);
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
exports.RestClient = RestClient;
|
|
113
|
-
//# sourceMappingURL=restClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"restClient.js","sourceRoot":"","sources":["../../src/rest/restClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAAiE;AAEjE,oCAAkC;AAGlC,MAAa,UAAU;IACrB,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAEnD;;;;;;;OAOG;IACW,OAAO,CACnB,MAAmD,EACnD,GAAW,EACX,IAAU,EACV,KAAuC;;YAEvC,IAAI,CAAC;gBACH,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;oBAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;gBAE7D,MAAM,MAAM,GAAuB;oBACjC,MAAM;oBACN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AO,IAAI,CAAC,OAAO,CAAI,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QACrD,CAAC;KAAA;CACF;AA7GD,gCA6GC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Queue = void 0;
|
|
4
|
-
class Queue extends Array {
|
|
5
|
-
get remaining() {
|
|
6
|
-
return this.length;
|
|
7
|
-
}
|
|
8
|
-
wait() {
|
|
9
|
-
var _a, _b;
|
|
10
|
-
const next = (_b = (_a = this[this.length - 1]) === null || _a === void 0 ? void 0 : _a.promise) !== null && _b !== void 0 ? _b : Promise.resolve();
|
|
11
|
-
let resolve;
|
|
12
|
-
const promise = new Promise((res) => (resolve = res));
|
|
13
|
-
this.push({ resolve: resolve, promise });
|
|
14
|
-
return next;
|
|
15
|
-
}
|
|
16
|
-
next() {
|
|
17
|
-
var _a;
|
|
18
|
-
(_a = this.shift()) === null || _a === void 0 ? void 0 : _a.resolve();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.Queue = Queue;
|
|
22
|
-
//# sourceMappingURL=queue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../../../src/rest/restUtils/queue.ts"],"names":[],"mappings":";;;AAKA,MAAa,KAAM,SAAQ,KAAsB;IAC/C,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI;;QACF,MAAM,IAAI,GAAG,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,0CAAE,OAAO,mCAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QAEjE,IAAI,OAAmB,CAAC;QAExB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC;QAE5D,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;QAE1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI;;QACF,MAAA,IAAI,CAAC,KAAK,EAAE,0CAAE,OAAO,EAAE,CAAC;IAC1B,CAAC;CACF;AApBD,sBAoBC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Attachment = void 0;
|
|
4
|
-
const base_1 = require("./base");
|
|
5
|
-
/**
|
|
6
|
-
* Represents an attachment, such as a file or image, in a message or channel.
|
|
7
|
-
*
|
|
8
|
-
* @extends Base
|
|
9
|
-
*/
|
|
10
|
-
class Attachment extends base_1.Base {
|
|
11
|
-
/**
|
|
12
|
-
* Creates a new Attachment instance.
|
|
13
|
-
*
|
|
14
|
-
* @param {client} client - The client instance.
|
|
15
|
-
* @param {File} data - The raw data for the attachment from the API.
|
|
16
|
-
*/
|
|
17
|
-
constructor(client, data) {
|
|
18
|
-
super(client);
|
|
19
|
-
this._patch(data);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Updates the attachment instance with new data from the API.
|
|
23
|
-
*
|
|
24
|
-
* @param {File} data - The raw data for the attachment from the API.
|
|
25
|
-
* @returns {this} The updated attachment instance.
|
|
26
|
-
* @protected
|
|
27
|
-
*/
|
|
28
|
-
_patch(data) {
|
|
29
|
-
super._patch(data);
|
|
30
|
-
if (data.filename)
|
|
31
|
-
this.filename = data.filename;
|
|
32
|
-
if (data.content_type)
|
|
33
|
-
this.type = data.content_type;
|
|
34
|
-
if (typeof data.size === "number")
|
|
35
|
-
this.size = data.size;
|
|
36
|
-
if (data.metadata)
|
|
37
|
-
this.metadata = data.metadata;
|
|
38
|
-
return this;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.Attachment = Attachment;
|
|
42
|
-
//# sourceMappingURL=attachment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.js","sourceRoot":"","sources":["../../src/struct/attachment.ts"],"names":[],"mappings":";;;AAAA,iCAA8B;AAI9B;;;;GAIG;AACH,MAAa,UAAW,SAAQ,WAAI;IAalC;;;;;OAKG;IACH,YAAY,MAAc,EAAE,IAAU;QACpC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAED;;;;;;OAMG;IACO,MAAM,CAAC,IAAU;QACzB,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,IAAI,IAAI,CAAC,QAAQ;YAAE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QACjD,IAAI,IAAI,CAAC,YAAY;YAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC;QACrD,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ;YAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACzD,IAAI,IAAI,CAAC,QAAQ;YAAE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QACjD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAvCD,gCAuCC"}
|
package/dist/struct/base.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Base = void 0;
|
|
4
|
-
const bitField_1 = require("../utils/bitField");
|
|
5
|
-
/**
|
|
6
|
-
* Represents the base structure for all objects in the client.
|
|
7
|
-
* Provides common functionality such as equality checks, cloning, and patching data.
|
|
8
|
-
*/
|
|
9
|
-
class Base {
|
|
10
|
-
/**
|
|
11
|
-
* Creates a new Base instance.
|
|
12
|
-
*
|
|
13
|
-
* @param {client} client - The client instance.
|
|
14
|
-
*/
|
|
15
|
-
constructor(client) {
|
|
16
|
-
this.client = client;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Compares this object with another to determine if they are equal.
|
|
20
|
-
*
|
|
21
|
-
* @param {this | null} [obj] - The object to compare with.
|
|
22
|
-
* @returns {boolean} `true` if the objects are equal, otherwise `false`.
|
|
23
|
-
*/
|
|
24
|
-
equals(obj) {
|
|
25
|
-
if (!obj)
|
|
26
|
-
return false;
|
|
27
|
-
for (const key in obj) {
|
|
28
|
-
const a = obj[key], b = this[key];
|
|
29
|
-
if (a instanceof Base && !a.equals(b))
|
|
30
|
-
return false;
|
|
31
|
-
if (a instanceof bitField_1.BitField &&
|
|
32
|
-
a.bitfield !== b.bitfield)
|
|
33
|
-
return false;
|
|
34
|
-
if (typeof a === "object" && a !== null)
|
|
35
|
-
continue;
|
|
36
|
-
if (a !== b)
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Updates the object with new data and returns a clone of the object.
|
|
43
|
-
*
|
|
44
|
-
* @param {PartialObject} data - The data to update the object with.
|
|
45
|
-
* @param {string[]} [clear] - Fields to clear in the object.
|
|
46
|
-
* @returns {this} A clone of the updated object.
|
|
47
|
-
*/
|
|
48
|
-
_update(data, clear) {
|
|
49
|
-
const clone = this._clone();
|
|
50
|
-
this._patch(data, clear);
|
|
51
|
-
return clone;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Patches the object with new data.
|
|
55
|
-
*
|
|
56
|
-
* @param {PartialObject} data - The data to patch the object with.
|
|
57
|
-
* @param {string[]} [_clear] - Fields to clear in the object.
|
|
58
|
-
* @returns {this} The updated object.
|
|
59
|
-
* @protected
|
|
60
|
-
*/
|
|
61
|
-
_patch(data, _clear) {
|
|
62
|
-
if ("id" in data)
|
|
63
|
-
this.id = data.id;
|
|
64
|
-
if ("_id" in data) {
|
|
65
|
-
if (typeof data._id === "string")
|
|
66
|
-
this.id = data._id;
|
|
67
|
-
if (typeof data._id === "object")
|
|
68
|
-
this.id = data._id.user;
|
|
69
|
-
}
|
|
70
|
-
return this;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Creates a deep clone of the object.
|
|
74
|
-
*
|
|
75
|
-
* @returns {this} A clone of the object.
|
|
76
|
-
*/
|
|
77
|
-
_clone() {
|
|
78
|
-
const clone = Object.assign(Object.create(this), this);
|
|
79
|
-
for (const key in clone) {
|
|
80
|
-
const prop = clone[key];
|
|
81
|
-
if (prop instanceof Base)
|
|
82
|
-
clone[key] = prop._clone();
|
|
83
|
-
}
|
|
84
|
-
return clone;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
exports.Base = Base;
|
|
88
|
-
//# sourceMappingURL=base.js.map
|
package/dist/struct/base.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/struct/base.ts"],"names":[],"mappings":";;;AACA,gDAA6C;AAM7C;;;GAGG;AACH,MAAsB,IAAI;IAIxB;;;;OAIG;IACH,YAA4B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE9C;;;;;OAKG;IACH,MAAM,CAAC,GAAiB;QACtB,IAAI,CAAC,GAAG;YAAE,OAAO,KAAK,CAAC;QAEvB,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;YACtB,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,EAChB,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;YAChB,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAa,CAAC;gBAAE,OAAO,KAAK,CAAC;YAChE,IACE,CAAC,YAAY,mBAAQ;gBACrB,CAAC,CAAC,QAAQ,KAAM,CAAyB,CAAC,QAAQ;gBAElD,OAAO,KAAK,CAAC;YAEf,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,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 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Category = void 0;
|
|
4
|
-
const index_1 = require("./index");
|
|
5
|
-
/**
|
|
6
|
-
* Represents a category in a server, which groups multiple channels together.
|
|
7
|
-
*
|
|
8
|
-
* @extends Base
|
|
9
|
-
*/
|
|
10
|
-
class Category extends index_1.Base {
|
|
11
|
-
/**
|
|
12
|
-
* Creates a new Category instance.
|
|
13
|
-
*
|
|
14
|
-
* @param {Server} server - The server this category belongs to.
|
|
15
|
-
* @param {APICategory} data - The raw data for the category from the API.
|
|
16
|
-
*/
|
|
17
|
-
constructor(server, data) {
|
|
18
|
-
super(server.client);
|
|
19
|
-
this.server = server;
|
|
20
|
-
/** An array of channel IDs that belong to this category. */
|
|
21
|
-
this._children = [];
|
|
22
|
-
this._patch(data);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Updates the category instance with new data from the API.
|
|
26
|
-
*
|
|
27
|
-
* @param {APICategory} data - The raw data for the category from the API.
|
|
28
|
-
* @returns {this} The updated category instance.
|
|
29
|
-
* @protected
|
|
30
|
-
*/
|
|
31
|
-
_patch(data) {
|
|
32
|
-
super._patch(data);
|
|
33
|
-
if (data.title) {
|
|
34
|
-
this.name = data.title;
|
|
35
|
-
}
|
|
36
|
-
if (Array.isArray(data.channels)) {
|
|
37
|
-
this._children = data.channels;
|
|
38
|
-
}
|
|
39
|
-
return this;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Retrieves the channels that belong to this category.
|
|
43
|
-
*
|
|
44
|
-
* @returns {Map<string, ServerChannel>} A map of channel IDs to their corresponding `ServerChannel` instances.
|
|
45
|
-
*/
|
|
46
|
-
get children() {
|
|
47
|
-
const coll = new Map();
|
|
48
|
-
for (const childId of this._children) {
|
|
49
|
-
const child = this.server.channels.cache.get(childId);
|
|
50
|
-
if (child)
|
|
51
|
-
coll.set(child.id, child);
|
|
52
|
-
}
|
|
53
|
-
return coll;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Converts the category to a string representation.
|
|
57
|
-
*
|
|
58
|
-
* @returns {string} The name of the category.
|
|
59
|
-
*/
|
|
60
|
-
toString() {
|
|
61
|
-
return this.name;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.Category = Category;
|
|
65
|
-
//# sourceMappingURL=category.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"category.js","sourceRoot":"","sources":["../../src/struct/category.ts"],"names":[],"mappings":";;;AACA,mCAAsD;AAEtD;;;;GAIG;AACH,MAAa,QAAS,SAAQ,YAAI;IAOhC;;;;;OAKG;IACH,YACkB,MAAc,EAC9B,IAAiB;QAEjB,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAHL,WAAM,GAAN,MAAM,CAAQ;QAVhC,4DAA4D;QAClD,cAAS,GAAa,EAAE,CAAC;QAajC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAED;;;;;;OAMG;IACO,MAAM,CAAC,IAAiB;QAChC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAEnB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,CAAC;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC;QACjC,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,IAAI,QAAQ;QACV,MAAM,IAAI,GAAG,IAAI,GAAG,EAAyB,CAAC;QAE9C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACrC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACtD,IAAI,KAAK;gBAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACvC,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF;AAlED,4BAkEC"}
|
package/dist/struct/channel.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Channel = void 0;
|
|
4
|
-
const base_1 = require("./base");
|
|
5
|
-
const index_1 = require("../utils/index");
|
|
6
|
-
/**
|
|
7
|
-
* Represents a generic communication channel in the client.
|
|
8
|
-
* This abstract class provides a base structure and common functionality
|
|
9
|
-
* for all types of channels, such as text, voice, group, and server channels.
|
|
10
|
-
*
|
|
11
|
-
* @abstract
|
|
12
|
-
* @extends Base
|
|
13
|
-
*
|
|
14
|
-
* @property {ChannelTypes | "UNKNOWN"} type - The type of the channel. Defaults to "UNKNOWN".
|
|
15
|
-
* @property {number} createdTimestamp - The timestamp (in milliseconds) when the channel was created.
|
|
16
|
-
* @property {Date} createdAt - The date and time when the channel was created.
|
|
17
|
-
*/
|
|
18
|
-
class Channel extends base_1.Base {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(...arguments);
|
|
21
|
-
this.type = "UNKNOWN";
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Gets the timestamp (in milliseconds) when the channel was created.
|
|
25
|
-
*
|
|
26
|
-
* @returns {number} The timestamp of the channel's creation.
|
|
27
|
-
*/
|
|
28
|
-
get createdTimestamp() {
|
|
29
|
-
return this.createdAt.getTime();
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Gets the date and time when the channel was created.
|
|
33
|
-
*
|
|
34
|
-
* @returns {Date} The creation date of the channel.
|
|
35
|
-
*/
|
|
36
|
-
get createdAt() {
|
|
37
|
-
return index_1.UUID.timestampOf(this.id);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Deletes the current channel instance from the client's channel collection.
|
|
41
|
-
*
|
|
42
|
-
* This method interacts with the client's channel management system to remove
|
|
43
|
-
* the channel. Once deleted, the channel will no longer be accessible through
|
|
44
|
-
* the client.
|
|
45
|
-
*
|
|
46
|
-
* @returns {Promise<void>} A promise that resolves when the channel has been successfully deleted.
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```typescript
|
|
50
|
-
* const channel = client.channels.get('1234567890');
|
|
51
|
-
* if (channel) {
|
|
52
|
-
* await channel.delete();
|
|
53
|
-
* console.log('Channel deleted successfully.');
|
|
54
|
-
* }
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
delete() {
|
|
58
|
-
return this.client.channels.delete(this);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Checks if the channel is a text-based channel.
|
|
62
|
-
*
|
|
63
|
-
* @returns {boolean} True if the channel is a text-based channel, otherwise false.
|
|
64
|
-
*/
|
|
65
|
-
isText() {
|
|
66
|
-
return "messages" in this;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Checks if the channel is a voice channel.
|
|
70
|
-
*
|
|
71
|
-
* @returns {boolean} True if the channel is a voice channel, otherwise false.
|
|
72
|
-
*/
|
|
73
|
-
isVoice() {
|
|
74
|
-
return this.type === index_1.ChannelTypes.VOICE;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Checks if the channel is a group channel.
|
|
78
|
-
*
|
|
79
|
-
* @returns {boolean} True if the channel is a group channel, otherwise false.
|
|
80
|
-
*/
|
|
81
|
-
isGroup() {
|
|
82
|
-
return this.type === index_1.ChannelTypes.GROUP;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Checks if the channel is part of a server.
|
|
86
|
-
*
|
|
87
|
-
* @returns {boolean} True if the channel is a server channel, otherwise false.
|
|
88
|
-
*/
|
|
89
|
-
inServer() {
|
|
90
|
-
return "serverId" in this;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Converts the channel to a string representation.
|
|
94
|
-
*
|
|
95
|
-
* @returns {string} A string representation of the channel in the format `<#channelId>`.
|
|
96
|
-
*/
|
|
97
|
-
toString() {
|
|
98
|
-
return `<#${this.id}>`;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Fetches the latest data for the channel from the client's channel collection.
|
|
102
|
-
*
|
|
103
|
-
* @param {boolean} [force=true] - Whether to force a fetch even if the channel is cached.
|
|
104
|
-
* @returns {Promise<Channel>} A promise that resolves with the updated channel instance.
|
|
105
|
-
*/
|
|
106
|
-
fetch(force = true) {
|
|
107
|
-
return this.client.channels.fetch(this, { force });
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
exports.Channel = Channel;
|
|
111
|
-
//# sourceMappingURL=channel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"channel.js","sourceRoot":"","sources":["../../src/struct/channel.ts"],"names":[],"mappings":";;;AAAA,iCAA8B;AAQ9B,0CAAoD;AAEpD;;;;;;;;;;;GAWG;AACH,MAAsB,OAAQ,SAAQ,WAAI;IAA1C;;QACE,SAAI,GAA6B,SAAS,CAAC;IAgG7C,CAAC;IA9FC;;;;OAIG;IACH,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACH,IAAI,SAAS;QACX,OAAO,YAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnC,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACH,MAAM;QACJ,OAAO,UAAU,IAAI,IAAI,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,KAAK,oBAAY,CAAC,KAAK,CAAC;IAC1C,CAAC;IAED;;;;OAIG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,KAAK,oBAAY,CAAC,KAAK,CAAC;IAC1C,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,OAAO,UAAU,IAAI,IAAI,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,OAAO,KAAK,IAAI,CAAC,EAAE,GAAG,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,KAAK,GAAG,IAAI;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACrD,CAAC;CACF;AAjGD,0BAiGC"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ClientUser = void 0;
|
|
13
|
-
const index_1 = require("./index");
|
|
14
|
-
/**
|
|
15
|
-
* Represents the client user, which is the authenticated user or bot.
|
|
16
|
-
*
|
|
17
|
-
* @extends User
|
|
18
|
-
*/
|
|
19
|
-
class ClientUser extends index_1.User {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
/** The notes channel associated with the client user, if any. */
|
|
23
|
-
this.notes = null;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Updates the username of the client user.
|
|
27
|
-
*
|
|
28
|
-
* @param {string} username - The new username to set.
|
|
29
|
-
* @param {string} [password] - The current password of the user (required for non-bot accounts).
|
|
30
|
-
* @returns {Promise<void>} A promise that resolves when the username has been successfully updated.
|
|
31
|
-
* @throws {Error} Throws an error if the client user is a bot and a password is provided.
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```typescript
|
|
35
|
-
* await clientUser.setUsername("NewUsername", "CurrentPassword");
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
setUsername(username, password) {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
if (this.bot && password) {
|
|
41
|
-
throw new Error("Bots do not have passwords");
|
|
42
|
-
}
|
|
43
|
-
yield this.client.api.patch("/users/@me/username", {
|
|
44
|
-
body: { username, password },
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Updates the status of the client user.
|
|
50
|
-
*
|
|
51
|
-
* @param {string | null} text - The status text to set, or `null` to clear the status.
|
|
52
|
-
* @param {Status} [presence] - The presence status (e.g., online, idle, etc.).
|
|
53
|
-
* @returns {Promise<void>} A promise that resolves when the status has been successfully updated.
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```typescript
|
|
57
|
-
* await clientUser.setStatus("Available", "online");
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
setStatus(text, presence) {
|
|
61
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
yield this.client.api.patch("/users/@me", {
|
|
63
|
-
body: { status: { text, presence } },
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.ClientUser = ClientUser;
|
|
69
|
-
//# sourceMappingURL=clientUser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clientUser.js","sourceRoot":"","sources":["../../src/struct/clientUser.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAqD;AAErD;;;;GAIG;AACH,MAAa,UAAW,SAAQ,YAAI;IAApC;;QACE,iEAAiE;QACjE,UAAK,GAAwB,IAAI,CAAC;IA0CpC,CAAC;IAxCC;;;;;;;;;;;;OAYG;IACG,WAAW,CAAC,QAAgB,EAAE,QAAiB;;YACnD,IAAI,IAAI,CAAC,GAAG,IAAI,QAAQ,EAAE,CAAC;gBACzB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;YAChD,CAAC;YAED,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,qBAAqB,EAAE;gBACjD,IAAI,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE;aAC7B,CAAC,CAAC;QACL,CAAC;KAAA;IAED;;;;;;;;;;;OAWG;IACG,SAAS,CAAC,IAAmB,EAAE,QAAiB;;YACpD,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,EAAE;gBACxC,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;aACrC,CAAC,CAAC;QACL,CAAC;KAAA;CACF;AA5CD,gCA4CC"}
|
package/dist/struct/dmChannel.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DMChannel = void 0;
|
|
4
|
-
const index_1 = require("./index");
|
|
5
|
-
const index_2 = require("../index");
|
|
6
|
-
const index_3 = require("../utils/index");
|
|
7
|
-
/**
|
|
8
|
-
* Represents a direct message (DM) channel between users.
|
|
9
|
-
*
|
|
10
|
-
* @extends Channel
|
|
11
|
-
*/
|
|
12
|
-
class DMChannel extends index_1.Channel {
|
|
13
|
-
/**
|
|
14
|
-
* Creates a new DMChannel instance.
|
|
15
|
-
*
|
|
16
|
-
* @param {client} client - The client instance.
|
|
17
|
-
* @param {APIDirectChannel} data - The raw data for the DM channel from the API.
|
|
18
|
-
*/
|
|
19
|
-
constructor(client, data) {
|
|
20
|
-
super(client);
|
|
21
|
-
/** The type of the channel, which is always `DM` for direct message channels. */
|
|
22
|
-
this.type = index_3.ChannelTypes.DM;
|
|
23
|
-
/** The default permissions for the DM channel. */
|
|
24
|
-
this.permissions = index_3.DEFAULT_PERMISSION_DM;
|
|
25
|
-
/** Manages the messages in this DM channel. */
|
|
26
|
-
this.messages = new index_2.MessageManager(this);
|
|
27
|
-
/** The ID of the last message sent in this DM channel, if any. */
|
|
28
|
-
this.lastMessageId = null;
|
|
29
|
-
this._patch(data);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Updates the DM channel instance with new data from the API.
|
|
33
|
-
*
|
|
34
|
-
* @param {APIDirectChannel} data - The raw data for the DM channel from the API.
|
|
35
|
-
* @returns {this} The updated DM channel instance.
|
|
36
|
-
* @protected
|
|
37
|
-
*/
|
|
38
|
-
_patch(data) {
|
|
39
|
-
super._patch(data);
|
|
40
|
-
if (typeof data.active === "boolean")
|
|
41
|
-
this.active = data.active;
|
|
42
|
-
if (data.last_message_id)
|
|
43
|
-
this.lastMessageId = data.last_message_id;
|
|
44
|
-
return this;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Retrieves the last message sent in this DM channel.
|
|
48
|
-
*
|
|
49
|
-
* @returns {Message | null} The last message, or `null` if no message exists.
|
|
50
|
-
*/
|
|
51
|
-
get lastMessage() {
|
|
52
|
-
var _a;
|
|
53
|
-
if (!this.lastMessageId)
|
|
54
|
-
return null;
|
|
55
|
-
return (_a = this.messages.cache.get(this.lastMessageId)) !== null && _a !== void 0 ? _a : null;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Deletes multiple messages from this DM channel.
|
|
59
|
-
*
|
|
60
|
-
* @param {MessageResolvable[] | Map<string, Message> | number} messages - The messages to delete. This can be an array of message resolvables, a map of messages, or a number indicating how many recent messages to delete.
|
|
61
|
-
* @returns {Promise<void>} A promise that resolves when the messages have been successfully deleted.
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```typescript
|
|
65
|
-
* await dmChannel.bulkDelete(10); // Deletes the last 10 messages.
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
bulkDelete(messages) {
|
|
69
|
-
return this.messages.bulkDelete(messages);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Sends a message to this DM channel.
|
|
73
|
-
*
|
|
74
|
-
* @param {MessageOptions | string} options - The message content or options for the message.
|
|
75
|
-
* @returns {Promise<Message>} A promise that resolves with the sent message.
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* ```typescript
|
|
79
|
-
* await dmChannel.send("Hello, world!");
|
|
80
|
-
* ```
|
|
81
|
-
*/
|
|
82
|
-
send(options) {
|
|
83
|
-
return this.messages.send(options);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
exports.DMChannel = DMChannel;
|
|
87
|
-
//# sourceMappingURL=dmChannel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dmChannel.js","sourceRoot":"","sources":["../../src/struct/dmChannel.ts"],"names":[],"mappings":";;;AACA,mCAA2C;AAE3C,oCAKkB;AAClB,0CAAqE;AAIrE;;;;GAIG;AACH,MAAa,SAAU,SAAQ,eAAO;IAgBpC;;;;;OAKG;IACH,YAAY,MAAc,EAAE,IAAsB;QAChD,KAAK,CAAC,MAAM,CAAC,CAAC;QAtBhB,iFAAiF;QACxE,SAAI,GAAG,oBAAY,CAAC,EAAE,CAAC;QAKhC,kDAAkD;QAClD,gBAAW,GAAG,6BAAqB,CAAC;QAE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