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/struct/server.js
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Server = void 0;
|
|
4
|
-
const index_1 = require("./index");
|
|
5
|
-
const index_2 = require("../managers/index");
|
|
6
|
-
const index_3 = require("../utils/index");
|
|
7
|
-
/**
|
|
8
|
-
* Represents a server (guild) in the client.
|
|
9
|
-
*
|
|
10
|
-
* @extends Base
|
|
11
|
-
*/
|
|
12
|
-
class Server extends index_1.Base {
|
|
13
|
-
/**
|
|
14
|
-
* Creates a new Server instance.
|
|
15
|
-
*
|
|
16
|
-
* @param {client} client - The client instance.
|
|
17
|
-
* @param {APIServer} data - The raw data for the server from the API.
|
|
18
|
-
*/
|
|
19
|
-
constructor(client, data) {
|
|
20
|
-
super(client);
|
|
21
|
-
/** The description of the server, or `null` if none is set. */
|
|
22
|
-
this.description = null;
|
|
23
|
-
/** Manages the members of the server. */
|
|
24
|
-
this.members = new index_2.ServerMemberManager(this);
|
|
25
|
-
/** Manages the channels of the server. */
|
|
26
|
-
this.channels = new index_2.ServerChannelManager(this);
|
|
27
|
-
/** Manages the roles of the server. */
|
|
28
|
-
this.roles = new index_2.RoleManager(this);
|
|
29
|
-
/** The icon of the server, or `null` if none is set. */
|
|
30
|
-
this.icon = null;
|
|
31
|
-
/** The banner of the server, or `null` if none is set. */
|
|
32
|
-
this.banner = null;
|
|
33
|
-
/** Whether analytics are enabled for the server. */
|
|
34
|
-
this.analytics = false;
|
|
35
|
-
/** Whether the server is discoverable. */
|
|
36
|
-
this.discoverable = false;
|
|
37
|
-
/** Whether the server is marked as NSFW (Not Safe For Work). */
|
|
38
|
-
this.nsfw = false;
|
|
39
|
-
/** The categories in the server. */
|
|
40
|
-
this.categories = new Map();
|
|
41
|
-
/** the emojies associated with the server */
|
|
42
|
-
this.emojis = new Map();
|
|
43
|
-
this._patch(data);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Updates the server instance with new data from the API.
|
|
47
|
-
*
|
|
48
|
-
* @param {APIServer} data - The raw data for the server from the API.
|
|
49
|
-
* @param {FieldsServer[]} [clear=[]] - Fields to clear in the server.
|
|
50
|
-
* @returns {this} The updated server instance.
|
|
51
|
-
* @protected
|
|
52
|
-
*/
|
|
53
|
-
_patch(data, clear = []) {
|
|
54
|
-
var _a;
|
|
55
|
-
super._patch(data);
|
|
56
|
-
if (Array.isArray(data.categories)) {
|
|
57
|
-
this.categories.clear();
|
|
58
|
-
for (const cat of data.categories) {
|
|
59
|
-
const category = new index_1.Category(this, cat);
|
|
60
|
-
this.categories.set(category.id, category);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (data.icon) {
|
|
64
|
-
this.icon = new index_1.Attachment(this.client, data.icon);
|
|
65
|
-
}
|
|
66
|
-
if (data.banner) {
|
|
67
|
-
this.banner = new index_1.Attachment(this.client, data.banner);
|
|
68
|
-
}
|
|
69
|
-
if (data.owner) {
|
|
70
|
-
this.ownerId = data.owner;
|
|
71
|
-
}
|
|
72
|
-
if (data.name) {
|
|
73
|
-
this.name = data.name;
|
|
74
|
-
}
|
|
75
|
-
if ("description" in data) {
|
|
76
|
-
this.description = (_a = data.description) !== null && _a !== void 0 ? _a : null;
|
|
77
|
-
}
|
|
78
|
-
if (Array.isArray(data.channels)) {
|
|
79
|
-
for (const id of data.channels) {
|
|
80
|
-
const channel = this.client.channels.cache.get(id);
|
|
81
|
-
if (channel === null || channel === void 0 ? void 0 : channel.inServer())
|
|
82
|
-
this.channels.cache.set(channel.id, channel);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (typeof data.roles === "object") {
|
|
86
|
-
for (const [id, raw] of Object.entries(data.roles)) {
|
|
87
|
-
this.roles._add(Object.assign(raw, { id }));
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (typeof data.default_permissions === "number") {
|
|
91
|
-
this.permissions = new index_3.ServerPermissions(data.default_permissions).freeze();
|
|
92
|
-
}
|
|
93
|
-
if (typeof data.analytics === "boolean")
|
|
94
|
-
this.analytics = data.analytics;
|
|
95
|
-
if (typeof data.discoverable === "boolean") {
|
|
96
|
-
this.discoverable = data.discoverable;
|
|
97
|
-
}
|
|
98
|
-
if (typeof data.nsfw === "boolean")
|
|
99
|
-
this.nsfw = data.nsfw;
|
|
100
|
-
for (const field of clear) {
|
|
101
|
-
if (field === "Icon")
|
|
102
|
-
this.icon = null;
|
|
103
|
-
if (field === "Description")
|
|
104
|
-
this.description = null;
|
|
105
|
-
if (field === "Banner")
|
|
106
|
-
this.banner = null;
|
|
107
|
-
}
|
|
108
|
-
return this;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Retrieves the current user's member instance in the server.
|
|
112
|
-
*
|
|
113
|
-
* @returns {ServerMember | null} The current user's member instance, or `null` if not found.
|
|
114
|
-
*/
|
|
115
|
-
get me() {
|
|
116
|
-
var _a, _b;
|
|
117
|
-
return (_b = this.members.cache.get((_a = this.client.user) === null || _a === void 0 ? void 0 : _a.id)) !== null && _b !== void 0 ? _b : null;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Gets the creation date of the server.
|
|
121
|
-
*
|
|
122
|
-
* @returns {Date} The date when the server was created.
|
|
123
|
-
*/
|
|
124
|
-
get createdAt() {
|
|
125
|
-
return index_3.UUID.timestampOf(this.id);
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Gets the creation timestamp of the server in milliseconds.
|
|
129
|
-
*
|
|
130
|
-
* @returns {number} The timestamp of when the server was created.
|
|
131
|
-
*/
|
|
132
|
-
get createdTimestamp() {
|
|
133
|
-
return this.createdAt.getTime();
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Retrieves the owner of the server.
|
|
137
|
-
*
|
|
138
|
-
* @returns {User | null} The owner of the server, or `null` if not found.
|
|
139
|
-
*/
|
|
140
|
-
get owner() {
|
|
141
|
-
var _a;
|
|
142
|
-
return (_a = this.client.users.cache.get(this.ownerId)) !== null && _a !== void 0 ? _a : null;
|
|
143
|
-
}
|
|
144
|
-
// iconURL(options?: { size: number }): string | null {
|
|
145
|
-
// return this.icon
|
|
146
|
-
// ? this.client.api.cdn.icon(this.icon.id, options?.size)
|
|
147
|
-
// : null;
|
|
148
|
-
// }
|
|
149
|
-
// bannerURL(options?: { size: number }): string | null {
|
|
150
|
-
// return this.banner
|
|
151
|
-
// ? this.client.api.cdn.banner(this.banner.id, options?.size)
|
|
152
|
-
// : null;
|
|
153
|
-
// }
|
|
154
|
-
/**
|
|
155
|
-
* Converts the server to a string representation.
|
|
156
|
-
*
|
|
157
|
-
* @returns {string} The name of the server.
|
|
158
|
-
*/
|
|
159
|
-
toString() {
|
|
160
|
-
return this.name;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
exports.Server = Server;
|
|
164
|
-
//# sourceMappingURL=server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/struct/server.ts"],"names":[],"mappings":";;;AACA,mCAAgF;AAEhF,6CAI2B;AAC3B,0CAAyD;AAEzD;;;;GAIG;AACH,MAAa,MAAO,SAAQ,YAAI;IA2C9B;;;;;OAKG;IACH,YAAY,MAAc,EAAE,IAAe;QACzC,KAAK,CAAC,MAAM,CAAC,CAAC;QA9ChB,+DAA+D;QAC/D,gBAAW,GAAkB,IAAI,CAAC;QAKlC,yCAAyC;QACzC,YAAO,GAAG,IAAI,2BAAmB,CAAC,IAAI,CAAC,CAAC;Q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AI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,mCAAI,IAAI,CAAC;IAC3D,CAAC;IAED,yDAAyD;IACzD,uBAAuB;IACvB,gEAAgE;IAChE,gBAAgB;IAChB,MAAM;IAEN,2DAA2D;IAC3D,yBAAyB;IACzB,oEAAoE;IACpE,gBAAgB;IAChB,MAAM;IAEN;;;;OAIG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF;AAvLD,wBAuLC"}
|
|
@@ -1,118 +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.ServerChannel = void 0;
|
|
13
|
-
const index_1 = require("./index");
|
|
14
|
-
const index_2 = require("../utils/index");
|
|
15
|
-
/**
|
|
16
|
-
* Represents a server channel, which can be a text or voice channel.
|
|
17
|
-
*
|
|
18
|
-
* @extends Channel
|
|
19
|
-
*/
|
|
20
|
-
class ServerChannel extends index_1.Channel {
|
|
21
|
-
/**
|
|
22
|
-
* Creates a new ServerChannel instance.
|
|
23
|
-
*
|
|
24
|
-
* @param {client} client - The client instance.
|
|
25
|
-
* @param {APIServerChannel} data - The raw data for the server channel from the API.
|
|
26
|
-
*/
|
|
27
|
-
constructor(client, data) {
|
|
28
|
-
super(client);
|
|
29
|
-
/** The description of the channel, or `null` if none is set. */
|
|
30
|
-
this.description = null;
|
|
31
|
-
/** The icon of the channel, or `null` if none is set. */
|
|
32
|
-
this.icon = null;
|
|
33
|
-
/** The permission overwrites for the channel. */
|
|
34
|
-
this.overwrites = new Map();
|
|
35
|
-
/** Whether the channel is marked as NSFW (Not Safe For Work). */
|
|
36
|
-
this.nsfw = false;
|
|
37
|
-
this._patch(data);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Updates the server channel instance with new data from the API.
|
|
41
|
-
*
|
|
42
|
-
* @param {APIServerChannel} data - The raw data for the server channel from the API.
|
|
43
|
-
* @param {FieldsChannel[]} [clear=[]] - Fields to clear in the channel.
|
|
44
|
-
* @returns {this} The updated server channel instance.
|
|
45
|
-
* @protected
|
|
46
|
-
*/
|
|
47
|
-
_patch(data, clear = []) {
|
|
48
|
-
var _a;
|
|
49
|
-
super._patch(data);
|
|
50
|
-
if (data.name)
|
|
51
|
-
this.name = data.name;
|
|
52
|
-
if (data.server)
|
|
53
|
-
this.serverId = data.server;
|
|
54
|
-
if ("description" in data)
|
|
55
|
-
this.description = (_a = data.description) !== null && _a !== void 0 ? _a : null;
|
|
56
|
-
if (data.icon)
|
|
57
|
-
this.icon = new index_1.Attachment(this.client, data.icon);
|
|
58
|
-
if (typeof data.nsfw === "boolean")
|
|
59
|
-
this.nsfw = data.nsfw;
|
|
60
|
-
if (data.role_permissions) {
|
|
61
|
-
this.overwrites.clear();
|
|
62
|
-
for (const [id, { a, d }] of Object.entries(data.role_permissions)) {
|
|
63
|
-
this.overwrites.set(id, {
|
|
64
|
-
allow: new index_2.ChannelPermissions(a),
|
|
65
|
-
deny: new index_2.ChannelPermissions(d),
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
for (const field of clear) {
|
|
70
|
-
if (field === "Icon")
|
|
71
|
-
this.icon = null;
|
|
72
|
-
if (field === "Description")
|
|
73
|
-
this.description = null;
|
|
74
|
-
}
|
|
75
|
-
return this;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Creates an invite for the server channel.
|
|
79
|
-
*
|
|
80
|
-
* @returns {Promise<Invite>} A promise that resolves with the created invite.
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* ```typescript
|
|
84
|
-
* const invite = await serverChannel.createInvite();
|
|
85
|
-
* console.log(`Invite created: ${invite}`);
|
|
86
|
-
* ```
|
|
87
|
-
*/
|
|
88
|
-
createInvite() {
|
|
89
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
const data = yield this.client.api.post(`/channels/${this.id}/invites`, {});
|
|
91
|
-
return new index_1.Invite(this.client, data);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
// iconURL(options?: { size: number }): string | null {
|
|
95
|
-
// return this.icon
|
|
96
|
-
// ? this.client.api.cdn.icon(this.icon.id, options?.size)
|
|
97
|
-
// : null;
|
|
98
|
-
// }
|
|
99
|
-
/**
|
|
100
|
-
* Retrieves the server this channel belongs to.
|
|
101
|
-
*
|
|
102
|
-
* @returns {Server} The server instance.
|
|
103
|
-
*/
|
|
104
|
-
get server() {
|
|
105
|
-
return this.client.servers.cache.get(this.serverId);
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Retrieves the category this channel belongs to, if any.
|
|
109
|
-
*
|
|
110
|
-
* @returns {Category | null} The category instance, or `null` if the channel is not in a category.
|
|
111
|
-
*/
|
|
112
|
-
get category() {
|
|
113
|
-
var _a;
|
|
114
|
-
return ((_a = Array.from(this.server.categories.values()).find((cat) => cat.children.has(this.id))) !== null && _a !== void 0 ? _a : null);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
exports.ServerChannel = ServerChannel;
|
|
118
|
-
//# sourceMappingURL=serverChannel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serverChannel.js","sourceRoot":"","sources":["../../src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,EAAE,CAAC,CAC1B,mCAAI,IAAI,CACV,CAAC;IACJ,CAAC;CACF;AA3HD,sCA2HC"}
|
|
@@ -1,205 +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.ServerMember = void 0;
|
|
13
|
-
const base_1 = require("./base");
|
|
14
|
-
const index_1 = require("./index");
|
|
15
|
-
/**
|
|
16
|
-
* Represents a member of a server.
|
|
17
|
-
*
|
|
18
|
-
* @extends Base
|
|
19
|
-
*/
|
|
20
|
-
class ServerMember extends base_1.Base {
|
|
21
|
-
/**
|
|
22
|
-
* Creates a new ServerMember instance.
|
|
23
|
-
*
|
|
24
|
-
* @param {client} client - The client instance.
|
|
25
|
-
* @param {APIMember} data - The raw data for the server member from the API.
|
|
26
|
-
*/
|
|
27
|
-
constructor(client, data) {
|
|
28
|
-
super(client);
|
|
29
|
-
/** The nickname of the member, or `null` if none is set. */
|
|
30
|
-
this.nickname = null;
|
|
31
|
-
/** The avatar of the member, or `null` if none is set. */
|
|
32
|
-
this.avatar = null;
|
|
33
|
-
/** roles assigned to the member */
|
|
34
|
-
this.roles = [];
|
|
35
|
-
this._patch(data);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Updates the server member instance with new data from the API.
|
|
39
|
-
*
|
|
40
|
-
* @param {APIMember} data - The raw data for the server member from the API.
|
|
41
|
-
* @param {FieldsMember[]} [clear=[]] - Fields to clear in the server member.
|
|
42
|
-
* @returns {this} The updated server member instance.
|
|
43
|
-
* @protected
|
|
44
|
-
*/
|
|
45
|
-
_patch(data, clear = []) {
|
|
46
|
-
var _a;
|
|
47
|
-
super._patch(data);
|
|
48
|
-
if ("nickname" in data) {
|
|
49
|
-
this.nickname = (_a = data.nickname) !== null && _a !== void 0 ? _a : null;
|
|
50
|
-
}
|
|
51
|
-
if (data.avatar) {
|
|
52
|
-
this.avatar = new index_1.Attachment(this.client, data.avatar);
|
|
53
|
-
}
|
|
54
|
-
if (data._id) {
|
|
55
|
-
this.serverId = data._id.server;
|
|
56
|
-
this.id = data._id.user;
|
|
57
|
-
}
|
|
58
|
-
if (Array.isArray(data.roles)) {
|
|
59
|
-
if (!data.roles.length)
|
|
60
|
-
this.roles = [];
|
|
61
|
-
else {
|
|
62
|
-
this.roles = data.roles.map((roleId) => {
|
|
63
|
-
const role = this.server.roles.cache.get(roleId);
|
|
64
|
-
if (!role) {
|
|
65
|
-
throw new Error(`Role with ID ${roleId} not found in server ${this.serverId}`);
|
|
66
|
-
}
|
|
67
|
-
return role;
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
for (const field of clear) {
|
|
72
|
-
if (field === "Avatar")
|
|
73
|
-
this.avatar = null;
|
|
74
|
-
if (field === "Nickname")
|
|
75
|
-
this.nickname = null;
|
|
76
|
-
}
|
|
77
|
-
return this;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Sets the nickname of the server member.
|
|
81
|
-
*
|
|
82
|
-
* @param {string} [nickname] - The new nickname to set, or `undefined` to clear the nickname.
|
|
83
|
-
* @returns {Promise<this>} A promise that resolves with the updated server member instance.
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* ```typescript
|
|
87
|
-
* await member.setNickname("NewNickname");
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
setNickname(nickname) {
|
|
91
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
-
yield this.server.members.edit(this, { nickname });
|
|
93
|
-
return this;
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* adds a role to the server member.
|
|
98
|
-
* @param roleId - The ID of the role to add to the member.
|
|
99
|
-
* @returns
|
|
100
|
-
*/
|
|
101
|
-
addRole(roleId) {
|
|
102
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
const currentRoles = this.roles.map((role) => role.id);
|
|
104
|
-
if (currentRoles.includes(roleId)) {
|
|
105
|
-
return this; // Role already exists, no need to add it again
|
|
106
|
-
}
|
|
107
|
-
yield this.server.members.edit(this, {
|
|
108
|
-
roles: [...currentRoles, roleId],
|
|
109
|
-
});
|
|
110
|
-
return this;
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Removes a role from the server member.
|
|
115
|
-
*
|
|
116
|
-
* @param {string} roleId - The ID of the role to remove from the member.
|
|
117
|
-
* @returns {Promise<this>} A promise that resolves with the updated server member instance.
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* ```typescript
|
|
121
|
-
* await member.removeRole("roleId");
|
|
122
|
-
* ```
|
|
123
|
-
*/
|
|
124
|
-
removeRole(roleId) {
|
|
125
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
-
const currentRoles = this.roles.map((role) => role.id);
|
|
127
|
-
if (!currentRoles.includes(roleId)) {
|
|
128
|
-
return this; // Role does not exist, no need to remove it
|
|
129
|
-
}
|
|
130
|
-
yield this.server.members.edit(this, {
|
|
131
|
-
roles: currentRoles.filter((id) => id !== roleId),
|
|
132
|
-
});
|
|
133
|
-
return this;
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Bans the server member.
|
|
138
|
-
*
|
|
139
|
-
* @param {string} [reason] - The reason for the ban.
|
|
140
|
-
* @returns {Promise<void>} A promise that resolves when the member is banned.
|
|
141
|
-
*
|
|
142
|
-
* @example
|
|
143
|
-
* ```typescript
|
|
144
|
-
* await member.ban("Violation of rules");
|
|
145
|
-
* ```
|
|
146
|
-
*/
|
|
147
|
-
ban(reason) {
|
|
148
|
-
return this.server.members.ban(this, reason);
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Kicks the server member.
|
|
152
|
-
*
|
|
153
|
-
* @returns {Promise<void>} A promise that resolves when the member is kicked.
|
|
154
|
-
*
|
|
155
|
-
* @example
|
|
156
|
-
* ```typescript
|
|
157
|
-
* await member.kick();
|
|
158
|
-
* ```
|
|
159
|
-
*/
|
|
160
|
-
kick() {
|
|
161
|
-
return this.server.members.kick(this);
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Leaves the server.
|
|
165
|
-
*
|
|
166
|
-
* @returns {Promise<void>} A promise that resolves when the member leaves the server.
|
|
167
|
-
*
|
|
168
|
-
* @example
|
|
169
|
-
* ```typescript
|
|
170
|
-
* await member.leave();
|
|
171
|
-
* ```
|
|
172
|
-
*/
|
|
173
|
-
leave() {
|
|
174
|
-
return this.client.servers.delete(this.serverId);
|
|
175
|
-
}
|
|
176
|
-
// async displayAvatarURL(options?: { size: number }): Promise<string> {
|
|
177
|
-
// return await this.user.displayAvatarURL(options);
|
|
178
|
-
// }
|
|
179
|
-
/**
|
|
180
|
-
* Retrieves the user associated with this server member.
|
|
181
|
-
*
|
|
182
|
-
* @returns {User} The user instance.
|
|
183
|
-
*/
|
|
184
|
-
get user() {
|
|
185
|
-
return this.client.users.cache.get(this.id);
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Retrieves the server this member belongs to.
|
|
189
|
-
*
|
|
190
|
-
* @returns {Server} The server instance.
|
|
191
|
-
*/
|
|
192
|
-
get server() {
|
|
193
|
-
return this.client.servers.cache.get(this.serverId);
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Converts the server member to a string representation.
|
|
197
|
-
*
|
|
198
|
-
* @returns {string} A string representation of the server member in the format `<@userId>`.
|
|
199
|
-
*/
|
|
200
|
-
toString() {
|
|
201
|
-
return `<@${this.id}>`;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
exports.ServerMember = ServerMember;
|
|
205
|
-
//# sourceMappingURL=serverMember.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serverMember.js","sourceRoot":"","sources":["../../src/struct/serverMember.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,iCAA8B;AAC9B,mCAAyD;AAGzD;;;;GAIG;AACH,MAAa,YAAa,SAAQ,WAAI;IAapC;;;;;OAKG;IACH,YAAY,MAAc,EAAE,IAAe;QACzC,KAAK,CAAC,MAAM,CAAC,CAAC;QAhBhB,4DAA4D;QAC5D,aAAQ,GAAkB,IAAI,CAAC;QAE/B,0DAA0D;QAC1D,WAAM,GAAsB,IAAI,CAAC;QAEjC,mCAAmC;QACnC,UAAK,GAAW,EAAE,CAAC;QAUjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAED;;;;;;;OAOG;IACO,MAAM,CAAC,IAAe,EAAE,QAAwB,EAAE;;QAC1D,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAEnB,IAAI,UAAU,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,QAAQ,GAAG,MAAA,IAAI,CAAC,QAAQ,mCAAI,IAAI,CAAC;QACxC,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,GAAG,IAAI,kBAAU,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACzD,CAAC;QAED,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;YAChC,IA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,0EAA0E;IAC1E,wDAAwD;IACxD,MAAM;IAEN;;;;OAIG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAE,CAAC;IAC/C,CAAC;IAED;;;;OAIG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAE,CAAC;IACvD,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,OAAO,KAAK,IAAI,CAAC,EAAE,GAAG,CAAC;IACzB,CAAC;CACF;AAtMD,oCAsMC"}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TextChannel = void 0;
|
|
4
|
-
const index_1 = require("./index");
|
|
5
|
-
const index_2 = require("../managers/index");
|
|
6
|
-
const index_3 = require("../utils/index");
|
|
7
|
-
/**
|
|
8
|
-
* Represents a text channel in a server.
|
|
9
|
-
*
|
|
10
|
-
* @extends ServerChannel
|
|
11
|
-
*/
|
|
12
|
-
class TextChannel extends index_1.ServerChannel {
|
|
13
|
-
/**
|
|
14
|
-
* Creates a new TextChannel instance.
|
|
15
|
-
*
|
|
16
|
-
* @param {client} client - The client instance.
|
|
17
|
-
* @param {APITextChannel} data - The raw data for the text channel from the API.
|
|
18
|
-
*/
|
|
19
|
-
constructor(client, data) {
|
|
20
|
-
super(client, data);
|
|
21
|
-
/** The ID of the last message sent in this text channel, if any. */
|
|
22
|
-
this.lastMessageId = null;
|
|
23
|
-
/** Manages the messages in this text channel. */
|
|
24
|
-
this.messages = new index_2.MessageManager(this);
|
|
25
|
-
/** The type of the channel, which is always `TEXT` for text channels. */
|
|
26
|
-
this.type = index_3.ChannelTypes.TEXT;
|
|
27
|
-
this._patch(data);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Updates the text channel instance with new data from the API.
|
|
31
|
-
*
|
|
32
|
-
* @param {APITextChannel} data - The raw data for the text channel from the API.
|
|
33
|
-
* @returns {this} The updated text channel instance.
|
|
34
|
-
* @protected
|
|
35
|
-
*/
|
|
36
|
-
_patch(data) {
|
|
37
|
-
super._patch(data);
|
|
38
|
-
if (data.last_message_id)
|
|
39
|
-
this.lastMessageId = data.last_message_id;
|
|
40
|
-
return this;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Retrieves the last message sent in this text channel.
|
|
44
|
-
*
|
|
45
|
-
* @returns {Message | null} The last message, or `null` if no message exists.
|
|
46
|
-
*/
|
|
47
|
-
get lastMessage() {
|
|
48
|
-
var _a;
|
|
49
|
-
if (!this.lastMessageId)
|
|
50
|
-
return null;
|
|
51
|
-
return (_a = this.messages.cache.get(this.lastMessageId)) !== null && _a !== void 0 ? _a : null;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Sends a message to this text channel.
|
|
55
|
-
*
|
|
56
|
-
* @param {MessageOptions | string} options - The message content or options for the message.
|
|
57
|
-
* @returns {Promise<Message>} A promise that resolves with the sent message.
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```typescript
|
|
61
|
-
* await textChannel.send("Hello, world!");
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
send(options) {
|
|
65
|
-
return this.messages.send(options);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Deletes multiple messages from this text channel.
|
|
69
|
-
*
|
|
70
|
-
* @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.
|
|
71
|
-
* @returns {Promise<void>} A promise that resolves when the messages have been successfully deleted.
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```typescript
|
|
75
|
-
* await textChannel.bulkDelete(10); // Deletes the last 10 messages.
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
bulkDelete(messages) {
|
|
79
|
-
return this.messages.bulkDelete(messages);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
exports.TextChannel = TextChannel;
|
|
83
|
-
//# sourceMappingURL=textChannel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"textChannel.js","sourceRoot":"","sources":["../../src/struct/textChannel.ts"],"names":[],"mappings":";;;AACA,mCAAiD;AAGjD,6CAI2B;AAC3B,0CAA8C;AAI9C;;;;GAIG;AACH,MAAa,WAAY,SAAQ,qBAAa;IAU5C;;;;;OAKG;IACH,YAAY,MAAc,EAAE,IAAoB;QAC9C,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAhBtB,oEAAoE;QACpE,kBAAa,GAAkB,IAAI,CAAC;QAEpC,iDAAiD;QACjD,aAAQ,GAAG,IAAI,sBAAc,CAAC,IAAI,CAAC,CAAC;QAEpC,yEAAyE;QAChE,SAAI,GAAG,oBAAY,CAAC,IAAI,CAAC;QAUhC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAED;;;;;;OAMG;IACO,MAAM,CAAC,IAAoB;QACnC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAEnB,IAAI,IAAI,CAAC,eAAe;YAAE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,eAAe,CAAC;QAEpE,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,IAAI,WAAW;;QACb,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,OAAO,IAAI,CAAC;QACrC,OAAO,MAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,mCAAI,IAAI,CAAC;IAC7D,CAAC;IAED;;;;;;;;;;OAUG;IACH,IAAI,CAAC,OAAgC;QACnC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,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