@duque.edits/sdk 1.1.0 → 1.1.3
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-C87LbIta.d.ts → index-BPxglVSk.d.ts} +83 -31
- package/dist/{index-BHHXH2xN.d.mts → index-DjHimKUy.d.mts} +83 -31
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +481 -292
- package/dist/index.mjs +481 -292
- package/dist/managers/automaticmessage/AutomaticMessageManager.d.mts +2 -1
- package/dist/managers/automaticmessage/AutomaticMessageManager.d.ts +2 -1
- package/dist/managers/automaticmessage/AutomaticMessageManager.js +41 -35
- package/dist/managers/automaticmessage/AutomaticMessageManager.mjs +41 -35
- package/dist/managers/base.d.mts +2 -1
- package/dist/managers/base.d.ts +2 -1
- package/dist/managers/base.js +3 -0
- package/dist/managers/base.mjs +3 -0
- package/dist/managers/bet/GuildBetManager.d.mts +2 -1
- package/dist/managers/bet/GuildBetManager.d.ts +2 -1
- package/dist/managers/bet/GuildBetManager.js +42 -30
- package/dist/managers/bet/GuildBetManager.mjs +42 -30
- package/dist/managers/betuser/GuildBetUserManager.d.mts +2 -1
- package/dist/managers/betuser/GuildBetUserManager.d.ts +2 -1
- package/dist/managers/betuser/GuildBetUserManager.js +32 -19
- package/dist/managers/betuser/GuildBetUserManager.mjs +32 -19
- package/dist/managers/buffer/BufferManager.d.mts +2 -1
- package/dist/managers/buffer/BufferManager.d.ts +2 -1
- package/dist/managers/buffer/BufferManager.js +1 -1
- package/dist/managers/buffer/BufferManager.mjs +1 -1
- package/dist/managers/guild/GuildManager.d.mts +2 -1
- package/dist/managers/guild/GuildManager.d.ts +2 -1
- package/dist/managers/guild/GuildManager.js +465 -279
- package/dist/managers/guild/GuildManager.mjs +465 -279
- package/dist/managers/index.d.mts +2 -1
- package/dist/managers/index.d.ts +2 -1
- package/dist/managers/index.js +480 -291
- package/dist/managers/index.mjs +480 -291
- package/dist/managers/logs/LogManager.d.mts +2 -1
- package/dist/managers/logs/LogManager.d.ts +2 -1
- package/dist/managers/logs/LogManager.js +24 -12
- package/dist/managers/logs/LogManager.mjs +24 -12
- package/dist/managers/match/GuildMatchManager.d.mts +2 -1
- package/dist/managers/match/GuildMatchManager.d.ts +2 -1
- package/dist/managers/match/GuildMatchManager.js +77 -61
- package/dist/managers/match/GuildMatchManager.mjs +77 -61
- package/dist/managers/mediator/GuildMediatorManager.d.mts +2 -1
- package/dist/managers/mediator/GuildMediatorManager.d.ts +2 -1
- package/dist/managers/mediator/GuildMediatorManager.js +30 -17
- package/dist/managers/mediator/GuildMediatorManager.mjs +30 -17
- package/dist/managers/message/MessagesManager.d.mts +2 -1
- package/dist/managers/message/MessagesManager.d.ts +2 -1
- package/dist/managers/minesgame/MinesGameManager.d.mts +2 -1
- package/dist/managers/minesgame/MinesGameManager.d.ts +2 -1
- package/dist/managers/minesgame/MinesGameManager.js +22 -13
- package/dist/managers/minesgame/MinesGameManager.mjs +22 -13
- package/dist/managers/permission/GuildPermissionManager.d.mts +2 -1
- package/dist/managers/permission/GuildPermissionManager.d.ts +2 -1
- package/dist/managers/permission/GuildPermissionManager.js +4 -1
- package/dist/managers/permission/GuildPermissionManager.mjs +4 -1
- package/dist/managers/player/PlayerManager.d.mts +2 -1
- package/dist/managers/player/PlayerManager.d.ts +2 -1
- package/dist/managers/ticket/TicketManager.d.mts +2 -1
- package/dist/managers/ticket/TicketManager.d.ts +2 -1
- package/dist/managers/ticket/TicketManager.js +42 -28
- package/dist/managers/ticket/TicketManager.mjs +42 -28
- package/dist/managers/tournament/TournamentManager.d.mts +21 -0
- package/dist/managers/tournament/TournamentManager.d.ts +21 -0
- package/dist/managers/tournament/TournamentManager.js +753 -0
- package/dist/managers/tournament/TournamentManager.mjs +745 -0
- package/dist/managers/user/GuildUserManager.d.mts +2 -1
- package/dist/managers/user/GuildUserManager.d.ts +2 -1
- package/dist/managers/user/GuildUserManager.js +49 -36
- package/dist/managers/user/GuildUserManager.mjs +49 -36
- package/dist/managers/vipmember/VipMemberManager.d.mts +2 -1
- package/dist/managers/vipmember/VipMemberManager.d.ts +2 -1
- package/dist/managers/vipmember/VipMemberManager.js +4 -1
- package/dist/managers/vipmember/VipMemberManager.mjs +4 -1
- package/dist/rest/REST.d.mts +2 -1
- package/dist/rest/REST.d.ts +2 -1
- package/dist/rest/REST.js +482 -293
- package/dist/rest/REST.mjs +482 -293
- package/dist/rest/Routes.js +1 -1
- package/dist/rest/Routes.mjs +1 -1
- package/dist/rest/index.d.mts +2 -1
- package/dist/rest/index.d.ts +2 -1
- package/dist/rest/index.js +482 -293
- package/dist/rest/index.mjs +482 -293
- package/dist/structures/automaticmessage/AutomaticMessage.d.mts +2 -1
- package/dist/structures/automaticmessage/AutomaticMessage.d.ts +2 -1
- package/dist/structures/automaticmessage/AutomaticMessage.js +30 -26
- package/dist/structures/automaticmessage/AutomaticMessage.mjs +30 -26
- package/dist/structures/bet/GuildBet.d.mts +2 -1
- package/dist/structures/bet/GuildBet.d.ts +2 -1
- package/dist/structures/bet/GuildBet.js +39 -30
- package/dist/structures/bet/GuildBet.mjs +39 -30
- package/dist/structures/betuser/GuildBetUser.d.mts +2 -1
- package/dist/structures/betuser/GuildBetUser.d.ts +2 -1
- package/dist/structures/betuser/GuildBetUser.js +29 -19
- package/dist/structures/betuser/GuildBetUser.mjs +29 -19
- package/dist/structures/guild/Guild.d.mts +2 -1
- package/dist/structures/guild/Guild.d.ts +2 -1
- package/dist/structures/guild/Guild.js +451 -274
- package/dist/structures/guild/Guild.mjs +451 -274
- package/dist/structures/index.d.mts +2 -1
- package/dist/structures/index.d.ts +2 -1
- package/dist/structures/index.js +468 -288
- package/dist/structures/index.mjs +468 -288
- package/dist/structures/logentry/LogEntry.d.mts +2 -1
- package/dist/structures/logentry/LogEntry.d.ts +2 -1
- package/dist/structures/logentry/LogEntry.js +21 -12
- package/dist/structures/logentry/LogEntry.mjs +21 -12
- package/dist/structures/match/GuildMatch.d.mts +2 -1
- package/dist/structures/match/GuildMatch.d.ts +2 -1
- package/dist/structures/match/GuildMatch.js +74 -61
- package/dist/structures/match/GuildMatch.mjs +74 -61
- package/dist/structures/mediator/GuildMediator.d.mts +2 -1
- package/dist/structures/mediator/GuildMediator.d.ts +2 -1
- package/dist/structures/mediator/GuildMediator.js +27 -17
- package/dist/structures/mediator/GuildMediator.mjs +27 -17
- package/dist/structures/minesgame/MinesGame.d.mts +2 -1
- package/dist/structures/minesgame/MinesGame.d.ts +2 -1
- package/dist/structures/minesgame/MinesGame.js +22 -13
- package/dist/structures/minesgame/MinesGame.mjs +22 -13
- package/dist/structures/ticket/Ticket.d.mts +2 -1
- package/dist/structures/ticket/Ticket.d.ts +2 -1
- package/dist/structures/ticket/Ticket.js +27 -18
- package/dist/structures/ticket/Ticket.mjs +27 -18
- package/dist/structures/tournament/Tournament.d.mts +21 -0
- package/dist/structures/tournament/Tournament.d.ts +21 -0
- package/dist/structures/tournament/Tournament.js +593 -0
- package/dist/structures/tournament/Tournament.mjs +585 -0
- package/dist/structures/user/GuildUser.d.mts +2 -1
- package/dist/structures/user/GuildUser.d.ts +2 -1
- package/dist/structures/user/GuildUser.js +46 -36
- package/dist/structures/user/GuildUser.mjs +46 -36
- package/dist/structures/vipmember/VipMember.d.mts +2 -1
- package/dist/structures/vipmember/VipMember.d.ts +2 -1
- package/dist/structures/vipmember/VipMember.js +1 -1
- package/dist/structures/vipmember/VipMember.mjs +1 -1
- package/dist/types/RestTypes.d.mts +2 -1
- package/dist/types/RestTypes.d.ts +2 -1
- package/dist/types/api/APIAutomaticMessage.d.mts +2 -1
- package/dist/types/api/APIAutomaticMessage.d.ts +2 -1
- package/dist/types/api/APIGuild.d.mts +2 -1
- package/dist/types/api/APIGuild.d.ts +2 -1
- package/dist/types/api/APIGuildBet.d.mts +2 -1
- package/dist/types/api/APIGuildBet.d.ts +2 -1
- package/dist/types/api/APIGuildBetUser.d.mts +2 -1
- package/dist/types/api/APIGuildBetUser.d.ts +2 -1
- package/dist/types/api/APIGuildGroupedChannel.d.mts +2 -1
- package/dist/types/api/APIGuildGroupedChannel.d.ts +2 -1
- package/dist/types/api/APIGuildMatch.d.mts +2 -1
- package/dist/types/api/APIGuildMatch.d.ts +2 -1
- package/dist/types/api/APIGuildUser.d.mts +2 -1
- package/dist/types/api/APIGuildUser.d.ts +2 -1
- package/dist/types/api/APITournament.d.mts +16 -0
- package/dist/types/api/APITournament.d.ts +16 -0
- package/dist/types/api/APITournament.js +18 -0
- package/dist/types/api/APITournament.mjs +0 -0
- package/dist/types/api/index.d.mts +2 -1
- package/dist/types/api/index.d.ts +2 -1
- package/dist/types/index.d.mts +2 -1
- package/dist/types/index.d.ts +2 -1
- package/package.json +1 -1
package/dist/rest/REST.mjs
CHANGED
|
@@ -457,7 +457,7 @@ import { request, Headers } from "undici";
|
|
|
457
457
|
// src/rest/Routes.ts
|
|
458
458
|
var Routes = {
|
|
459
459
|
//base: "http://localhost:80/api/v1",
|
|
460
|
-
base: "https://
|
|
460
|
+
base: "https://duqueapi.shardweb.app/api/v1",
|
|
461
461
|
field: (field) => `/${field}`,
|
|
462
462
|
fields: (...fields) => `${fields.join("/")}`,
|
|
463
463
|
guilds: {
|
|
@@ -652,6 +652,9 @@ var BaseManager = class {
|
|
|
652
652
|
this.rest = guild.rest;
|
|
653
653
|
this.cache = new Collection();
|
|
654
654
|
}
|
|
655
|
+
toJSON() {
|
|
656
|
+
return [...this.cache.values()].map((m) => m && "toJSON" in m && typeof m.toJSON === "function" ? m.toJSON() : m);
|
|
657
|
+
}
|
|
655
658
|
};
|
|
656
659
|
|
|
657
660
|
// src/managers/player/PlayerManager.ts
|
|
@@ -723,8 +726,10 @@ var PlayerManager = class extends Collection {
|
|
|
723
726
|
};
|
|
724
727
|
|
|
725
728
|
// src/structures/bet/GuildBet.ts
|
|
729
|
+
var _GuildBet_instances, updateInternals_fn;
|
|
726
730
|
var GuildBet = class {
|
|
727
731
|
constructor(data, manager) {
|
|
732
|
+
__privateAdd(this, _GuildBet_instances);
|
|
728
733
|
/** The bet's type */
|
|
729
734
|
__publicField(this, "type");
|
|
730
735
|
/** The bet's mode */
|
|
@@ -803,7 +808,7 @@ var GuildBet = class {
|
|
|
803
808
|
async fetch() {
|
|
804
809
|
const route = Routes.guilds.bets.get(this.guild.id, this._id);
|
|
805
810
|
const response = await this.rest.request({ url: route, method: "GET" });
|
|
806
|
-
return this.
|
|
811
|
+
return __privateMethod(this, _GuildBet_instances, updateInternals_fn).call(this, response);
|
|
807
812
|
}
|
|
808
813
|
async addPlayer(player, queue_type) {
|
|
809
814
|
if (this.players.length === 2) return this;
|
|
@@ -840,7 +845,7 @@ var GuildBet = class {
|
|
|
840
845
|
const payload = data;
|
|
841
846
|
const route = Routes.guilds.bets.update(this.guild.id, this._id);
|
|
842
847
|
const response = await this.rest.request({ method: "patch", url: route, payload });
|
|
843
|
-
return this.
|
|
848
|
+
return __privateMethod(this, _GuildBet_instances, updateInternals_fn).call(this, response);
|
|
844
849
|
}
|
|
845
850
|
async delete() {
|
|
846
851
|
const route = Routes.guilds.bets.delete(this.manager.guild.id, this._id);
|
|
@@ -852,33 +857,6 @@ var GuildBet = class {
|
|
|
852
857
|
this.manager.cache.delete(this._id);
|
|
853
858
|
return response;
|
|
854
859
|
}
|
|
855
|
-
_updateInternals(data) {
|
|
856
|
-
for (let key in data) {
|
|
857
|
-
if (key === "_id" || key === "createdAt") continue;
|
|
858
|
-
if (key === "messages") {
|
|
859
|
-
this.messages.set(data[key]);
|
|
860
|
-
continue;
|
|
861
|
-
}
|
|
862
|
-
if (key === "players") {
|
|
863
|
-
this.players._set(data[key]);
|
|
864
|
-
continue;
|
|
865
|
-
}
|
|
866
|
-
if (key in this) {
|
|
867
|
-
this[key] = data[key];
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
if (data?.messages?.length !== 0) {
|
|
871
|
-
if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
|
|
872
|
-
else {
|
|
873
|
-
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
874
|
-
this.messages.set(data.messages);
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
878
|
-
this.createdAt = new Date(data.createdAt);
|
|
879
|
-
this.manager.set(this);
|
|
880
|
-
return this;
|
|
881
|
-
}
|
|
882
860
|
toJSON() {
|
|
883
861
|
let json = {};
|
|
884
862
|
for (const [key, value] of Object.entries(this)) {
|
|
@@ -895,9 +873,38 @@ var GuildBet = class {
|
|
|
895
873
|
};
|
|
896
874
|
}
|
|
897
875
|
};
|
|
876
|
+
_GuildBet_instances = new WeakSet();
|
|
877
|
+
updateInternals_fn = function(data) {
|
|
878
|
+
for (let key in data) {
|
|
879
|
+
if (key === "_id" || key === "createdAt") continue;
|
|
880
|
+
if (key === "messages") {
|
|
881
|
+
this.messages.set(data[key]);
|
|
882
|
+
continue;
|
|
883
|
+
}
|
|
884
|
+
if (key === "players") {
|
|
885
|
+
this.players._set(data[key]);
|
|
886
|
+
continue;
|
|
887
|
+
}
|
|
888
|
+
if (key in this) {
|
|
889
|
+
this[key] = data[key];
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
if (data?.messages?.length !== 0) {
|
|
893
|
+
if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
|
|
894
|
+
else {
|
|
895
|
+
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
896
|
+
this.messages.set(data.messages);
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
900
|
+
this.createdAt = new Date(data.createdAt);
|
|
901
|
+
this.manager.set(this);
|
|
902
|
+
return this;
|
|
903
|
+
};
|
|
898
904
|
|
|
899
905
|
// src/structures/betuser/GuildBetUser.ts
|
|
900
|
-
var
|
|
906
|
+
var _GuildBetUser_instances, updateInternals_fn2;
|
|
907
|
+
var _GuildBetUser = class _GuildBetUser {
|
|
901
908
|
/**
|
|
902
909
|
* Bet user
|
|
903
910
|
* @param data The user's data
|
|
@@ -905,6 +912,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
905
912
|
* @param rest The rest client
|
|
906
913
|
*/
|
|
907
914
|
constructor(data, manager) {
|
|
915
|
+
__privateAdd(this, _GuildBetUser_instances);
|
|
908
916
|
/** User daily */
|
|
909
917
|
__publicField(this, "daily");
|
|
910
918
|
__publicField(this, "profile");
|
|
@@ -999,7 +1007,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
999
1007
|
url: route,
|
|
1000
1008
|
payload
|
|
1001
1009
|
});
|
|
1002
|
-
return this.
|
|
1010
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn2).call(this, response);
|
|
1003
1011
|
}
|
|
1004
1012
|
async updateProfile(data) {
|
|
1005
1013
|
const _data = {
|
|
@@ -1019,20 +1027,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
1019
1027
|
url: route,
|
|
1020
1028
|
payload: _data
|
|
1021
1029
|
});
|
|
1022
|
-
return this.
|
|
1023
|
-
}
|
|
1024
|
-
_updateInternals(data) {
|
|
1025
|
-
for (let key in data) {
|
|
1026
|
-
if (key === "id" || key === "createdAt") continue;
|
|
1027
|
-
if (key in this) {
|
|
1028
|
-
this[key] = data[key];
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1032
|
-
this.createdAt = new Date(data.createdAt);
|
|
1033
|
-
this.manager.set(this);
|
|
1034
|
-
this.rest.emit("betuserUpdate", this);
|
|
1035
|
-
return this;
|
|
1030
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn2).call(this, response);
|
|
1036
1031
|
}
|
|
1037
1032
|
/**
|
|
1038
1033
|
* Update certain property
|
|
@@ -1069,7 +1064,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
1069
1064
|
url: route,
|
|
1070
1065
|
payload
|
|
1071
1066
|
});
|
|
1072
|
-
return this.
|
|
1067
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn2).call(this, response);
|
|
1073
1068
|
}
|
|
1074
1069
|
async _update(data) {
|
|
1075
1070
|
const route = Routes.guilds.betusers.get(this.manager.guild.id, this.id);
|
|
@@ -1079,7 +1074,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
1079
1074
|
url: route,
|
|
1080
1075
|
payload
|
|
1081
1076
|
});
|
|
1082
|
-
return this.
|
|
1077
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn2).call(this, response);
|
|
1083
1078
|
}
|
|
1084
1079
|
async delete() {
|
|
1085
1080
|
const route = Routes.guilds.betusers.delete(this.manager.guild.id, this.id);
|
|
@@ -1103,10 +1098,27 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
1103
1098
|
return json;
|
|
1104
1099
|
}
|
|
1105
1100
|
};
|
|
1101
|
+
_GuildBetUser_instances = new WeakSet();
|
|
1102
|
+
updateInternals_fn2 = function(data) {
|
|
1103
|
+
for (let key in data) {
|
|
1104
|
+
if (key === "id" || key === "createdAt") continue;
|
|
1105
|
+
if (key in this) {
|
|
1106
|
+
this[key] = data[key];
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1110
|
+
this.createdAt = new Date(data.createdAt);
|
|
1111
|
+
this.manager.set(this);
|
|
1112
|
+
this.rest.emit("betuserUpdate", this);
|
|
1113
|
+
return this;
|
|
1114
|
+
};
|
|
1115
|
+
var GuildBetUser = _GuildBetUser;
|
|
1106
1116
|
|
|
1107
1117
|
// src/structures/logentry/LogEntry.ts
|
|
1118
|
+
var _LogEntry_instances, updateInternals_fn3;
|
|
1108
1119
|
var LogEntry = class {
|
|
1109
1120
|
constructor(data, manager) {
|
|
1121
|
+
__privateAdd(this, _LogEntry_instances);
|
|
1110
1122
|
__publicField(this, "_id");
|
|
1111
1123
|
__publicField(this, "guild_id");
|
|
1112
1124
|
__publicField(this, "user_id");
|
|
@@ -1142,9 +1154,9 @@ var LogEntry = class {
|
|
|
1142
1154
|
this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
|
|
1143
1155
|
}
|
|
1144
1156
|
async fetch() {
|
|
1145
|
-
const route = Routes.guilds
|
|
1157
|
+
const route = Routes.fields("guilds", this.guild.id, "logentries", this._id);
|
|
1146
1158
|
const response = await this.rest.request({ url: route, method: "GET" });
|
|
1147
|
-
return this.
|
|
1159
|
+
return __privateMethod(this, _LogEntry_instances, updateInternals_fn3).call(this, response);
|
|
1148
1160
|
}
|
|
1149
1161
|
toJSON() {
|
|
1150
1162
|
const json = {};
|
|
@@ -1155,21 +1167,23 @@ var LogEntry = class {
|
|
|
1155
1167
|
}
|
|
1156
1168
|
return json;
|
|
1157
1169
|
}
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1170
|
+
};
|
|
1171
|
+
_LogEntry_instances = new WeakSet();
|
|
1172
|
+
updateInternals_fn3 = function(data) {
|
|
1173
|
+
for (let key in data) {
|
|
1174
|
+
if (key === "id" || key === "createdAt") continue;
|
|
1175
|
+
if (key in this) {
|
|
1176
|
+
this[key] = data[key];
|
|
1164
1177
|
}
|
|
1165
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1166
|
-
this.manager.set(this);
|
|
1167
|
-
return this;
|
|
1168
1178
|
}
|
|
1179
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1180
|
+
this.manager.set(this);
|
|
1181
|
+
return this;
|
|
1169
1182
|
};
|
|
1170
1183
|
|
|
1171
1184
|
// src/structures/match/GuildMatch.ts
|
|
1172
|
-
var
|
|
1185
|
+
var _GuildMatch_instances, updateInternals_fn4;
|
|
1186
|
+
var _GuildMatch = class _GuildMatch {
|
|
1173
1187
|
/**
|
|
1174
1188
|
* GuildMatch match
|
|
1175
1189
|
* @param data The match's data
|
|
@@ -1177,6 +1191,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1177
1191
|
* @param rest The rest client
|
|
1178
1192
|
*/
|
|
1179
1193
|
constructor(data, manager) {
|
|
1194
|
+
__privateAdd(this, _GuildMatch_instances);
|
|
1180
1195
|
__publicField(this, "_id");
|
|
1181
1196
|
__publicField(this, "selections");
|
|
1182
1197
|
/** Match's type */
|
|
@@ -1260,7 +1275,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1260
1275
|
method: "get",
|
|
1261
1276
|
url: route
|
|
1262
1277
|
});
|
|
1263
|
-
return await this.
|
|
1278
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1264
1279
|
}
|
|
1265
1280
|
async addConfirmed(type, id) {
|
|
1266
1281
|
const confirmed = this.confirmed.find((c) => c.type === type);
|
|
@@ -1282,7 +1297,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1282
1297
|
url: route,
|
|
1283
1298
|
payload: set
|
|
1284
1299
|
});
|
|
1285
|
-
return await this.
|
|
1300
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1286
1301
|
}
|
|
1287
1302
|
async setStatus(status) {
|
|
1288
1303
|
Assertion.assertString(status);
|
|
@@ -1293,7 +1308,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1293
1308
|
url: route,
|
|
1294
1309
|
payload
|
|
1295
1310
|
});
|
|
1296
|
-
return await this.
|
|
1311
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1297
1312
|
}
|
|
1298
1313
|
async setWinners(players) {
|
|
1299
1314
|
if (!Array.isArray(players)) players = [players];
|
|
@@ -1304,7 +1319,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1304
1319
|
url: route,
|
|
1305
1320
|
payload
|
|
1306
1321
|
});
|
|
1307
|
-
return await this.
|
|
1322
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1308
1323
|
}
|
|
1309
1324
|
async setLoser(players) {
|
|
1310
1325
|
if (!Array.isArray(players)) players = [players];
|
|
@@ -1315,7 +1330,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1315
1330
|
url: route,
|
|
1316
1331
|
payload
|
|
1317
1332
|
});
|
|
1318
|
-
return await this.
|
|
1333
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1319
1334
|
}
|
|
1320
1335
|
async setMvps(...usersId) {
|
|
1321
1336
|
const payload = { set: usersId };
|
|
@@ -1325,7 +1340,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1325
1340
|
url: route,
|
|
1326
1341
|
payload
|
|
1327
1342
|
});
|
|
1328
|
-
return await this.
|
|
1343
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1329
1344
|
}
|
|
1330
1345
|
async setRoomCreatorId(userId) {
|
|
1331
1346
|
Assertion.assertString(userId);
|
|
@@ -1336,7 +1351,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1336
1351
|
url: route,
|
|
1337
1352
|
payload
|
|
1338
1353
|
});
|
|
1339
|
-
return await this.
|
|
1354
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1340
1355
|
}
|
|
1341
1356
|
async setRoomAdminId(userId) {
|
|
1342
1357
|
Assertion.assertString(userId);
|
|
@@ -1347,7 +1362,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1347
1362
|
url: route,
|
|
1348
1363
|
payload
|
|
1349
1364
|
});
|
|
1350
|
-
return await this.
|
|
1365
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1351
1366
|
}
|
|
1352
1367
|
async kick(player) {
|
|
1353
1368
|
this.players = this.players.filter((p) => p.id !== player.id);
|
|
@@ -1371,7 +1386,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1371
1386
|
payload: data
|
|
1372
1387
|
});
|
|
1373
1388
|
this.rest.emit("matchUpdate", this, new _GuildMatch(response, this.manager));
|
|
1374
|
-
return await this.
|
|
1389
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1375
1390
|
}
|
|
1376
1391
|
async delete() {
|
|
1377
1392
|
const route = Routes.guilds.matches.resource(this.guild.id, this._id);
|
|
@@ -1397,35 +1412,38 @@ var GuildMatch = class _GuildMatch {
|
|
|
1397
1412
|
messages: this?.messages instanceof MessagesManager ? this.messages?.cache?.toArray() : []
|
|
1398
1413
|
};
|
|
1399
1414
|
}
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
this.bet = this.guild.bets.set(data.bet);
|
|
1409
|
-
}
|
|
1415
|
+
};
|
|
1416
|
+
_GuildMatch_instances = new WeakSet();
|
|
1417
|
+
updateInternals_fn4 = async function(data) {
|
|
1418
|
+
if (!data) return;
|
|
1419
|
+
for (let key in data) {
|
|
1420
|
+
if (key === "id" || key === "createdAt" || key === "messages") continue;
|
|
1421
|
+
if (key in this) {
|
|
1422
|
+
this[key] = data[key];
|
|
1410
1423
|
}
|
|
1411
|
-
if (
|
|
1412
|
-
|
|
1413
|
-
else {
|
|
1414
|
-
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
1415
|
-
this.messages.set(data.messages);
|
|
1416
|
-
}
|
|
1424
|
+
if (key === "bet") {
|
|
1425
|
+
this.bet = this.guild.bets.set(data.bet);
|
|
1417
1426
|
}
|
|
1418
|
-
|
|
1419
|
-
|
|
1427
|
+
}
|
|
1428
|
+
if (data?.messages?.length !== 0) {
|
|
1429
|
+
if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
|
|
1430
|
+
else {
|
|
1431
|
+
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
1432
|
+
this.messages.set(data.messages);
|
|
1420
1433
|
}
|
|
1421
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1422
|
-
this.manager.set(this);
|
|
1423
|
-
return this;
|
|
1424
1434
|
}
|
|
1435
|
+
if (!(this.bet instanceof GuildBet) && data?.bet) {
|
|
1436
|
+
this.bet = this.guild.bets.cache.get(data._id) ?? await this.guild.bets.fetch({ betId: data?.bet?._id });
|
|
1437
|
+
}
|
|
1438
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1439
|
+
this.manager.set(this);
|
|
1440
|
+
return this;
|
|
1425
1441
|
};
|
|
1442
|
+
var GuildMatch = _GuildMatch;
|
|
1426
1443
|
|
|
1427
1444
|
// src/structures/mediator/GuildMediator.ts
|
|
1428
|
-
var
|
|
1445
|
+
var _GuildMediator_instances, updateInternals_fn5;
|
|
1446
|
+
var _GuildMediator = class _GuildMediator {
|
|
1429
1447
|
/**
|
|
1430
1448
|
* Bet user
|
|
1431
1449
|
* @param data The user's data
|
|
@@ -1433,6 +1451,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1433
1451
|
* @param rest The rest client
|
|
1434
1452
|
*/
|
|
1435
1453
|
constructor(data, manager) {
|
|
1454
|
+
__privateAdd(this, _GuildMediator_instances);
|
|
1436
1455
|
/** User's name */
|
|
1437
1456
|
__publicField(this, "id");
|
|
1438
1457
|
__publicField(this, "guild_id");
|
|
@@ -1491,19 +1510,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1491
1510
|
url: route,
|
|
1492
1511
|
payload
|
|
1493
1512
|
});
|
|
1494
|
-
return this.
|
|
1495
|
-
}
|
|
1496
|
-
_updateInternals(data) {
|
|
1497
|
-
for (let key in data) {
|
|
1498
|
-
if (key === "id" || key === "createdAt") continue;
|
|
1499
|
-
if (key in this) {
|
|
1500
|
-
this[key] = data[key];
|
|
1501
|
-
}
|
|
1502
|
-
}
|
|
1503
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1504
|
-
this.createdAt = new Date(data.createdAt);
|
|
1505
|
-
this.manager.set(this);
|
|
1506
|
-
return this;
|
|
1513
|
+
return __privateMethod(this, _GuildMediator_instances, updateInternals_fn5).call(this, response);
|
|
1507
1514
|
}
|
|
1508
1515
|
/**
|
|
1509
1516
|
* Update certain property
|
|
@@ -1518,7 +1525,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1518
1525
|
url: route,
|
|
1519
1526
|
payload
|
|
1520
1527
|
});
|
|
1521
|
-
return this.
|
|
1528
|
+
return __privateMethod(this, _GuildMediator_instances, updateInternals_fn5).call(this, response);
|
|
1522
1529
|
}
|
|
1523
1530
|
async setPaymentlink(type, link) {
|
|
1524
1531
|
const route = Routes.guilds.mediators.get(this.manager.guild.id, this.id);
|
|
@@ -1528,7 +1535,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1528
1535
|
url: route,
|
|
1529
1536
|
payload
|
|
1530
1537
|
});
|
|
1531
|
-
return this.
|
|
1538
|
+
return __privateMethod(this, _GuildMediator_instances, updateInternals_fn5).call(this, response);
|
|
1532
1539
|
}
|
|
1533
1540
|
async delete() {
|
|
1534
1541
|
const route = Routes.guilds.mediators.delete(this.manager.guild.id, this.id);
|
|
@@ -1551,9 +1558,24 @@ var GuildMediator = class _GuildMediator {
|
|
|
1551
1558
|
return json;
|
|
1552
1559
|
}
|
|
1553
1560
|
};
|
|
1561
|
+
_GuildMediator_instances = new WeakSet();
|
|
1562
|
+
updateInternals_fn5 = function(data) {
|
|
1563
|
+
for (let key in data) {
|
|
1564
|
+
if (key === "id" || key === "createdAt") continue;
|
|
1565
|
+
if (key in this) {
|
|
1566
|
+
this[key] = data[key];
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1570
|
+
this.createdAt = new Date(data.createdAt);
|
|
1571
|
+
this.manager.set(this);
|
|
1572
|
+
return this;
|
|
1573
|
+
};
|
|
1574
|
+
var GuildMediator = _GuildMediator;
|
|
1554
1575
|
|
|
1555
1576
|
// src/structures/user/GuildUser.ts
|
|
1556
|
-
var
|
|
1577
|
+
var _GuildUser_instances, updateInternals_fn6;
|
|
1578
|
+
var _GuildUser = class _GuildUser {
|
|
1557
1579
|
/**
|
|
1558
1580
|
* Bet user
|
|
1559
1581
|
* @param data The user's data
|
|
@@ -1561,6 +1583,7 @@ var GuildUser = class _GuildUser {
|
|
|
1561
1583
|
* @param rest The rest client
|
|
1562
1584
|
*/
|
|
1563
1585
|
constructor(data, manager) {
|
|
1586
|
+
__privateAdd(this, _GuildUser_instances);
|
|
1564
1587
|
/** User's id */
|
|
1565
1588
|
__publicField(this, "id");
|
|
1566
1589
|
__publicField(this, "guild_id");
|
|
@@ -1673,7 +1696,7 @@ var GuildUser = class _GuildUser {
|
|
|
1673
1696
|
url: route,
|
|
1674
1697
|
payload
|
|
1675
1698
|
});
|
|
1676
|
-
this.
|
|
1699
|
+
__privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1677
1700
|
return this;
|
|
1678
1701
|
}
|
|
1679
1702
|
async updateProfile(data) {
|
|
@@ -1694,43 +1717,14 @@ var GuildUser = class _GuildUser {
|
|
|
1694
1717
|
url: route,
|
|
1695
1718
|
payload: _data
|
|
1696
1719
|
});
|
|
1697
|
-
this.
|
|
1698
|
-
return this;
|
|
1699
|
-
}
|
|
1700
|
-
_updateInternals(data) {
|
|
1701
|
-
for (let key in data) {
|
|
1702
|
-
if (key === "id" || key === "createdAt") continue;
|
|
1703
|
-
if (key in this) {
|
|
1704
|
-
this[key] = data[key];
|
|
1705
|
-
}
|
|
1706
|
-
if (key === "adverts") {
|
|
1707
|
-
this.adverts = [];
|
|
1708
|
-
for (let _adv of data.adverts) {
|
|
1709
|
-
this.adverts.push({
|
|
1710
|
-
_id: _adv._id,
|
|
1711
|
-
admin_id: _adv.admin_id,
|
|
1712
|
-
role_id: _adv.role_id,
|
|
1713
|
-
reason: _adv.reason,
|
|
1714
|
-
points_removed: _adv.points_removed,
|
|
1715
|
-
proof: _adv.proof,
|
|
1716
|
-
proof_ext: _adv.proof_ext,
|
|
1717
|
-
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
1718
|
-
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
1719
|
-
});
|
|
1720
|
-
}
|
|
1721
|
-
}
|
|
1722
|
-
}
|
|
1723
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1724
|
-
this.createdAt = new Date(data.createdAt);
|
|
1725
|
-
this.manager.set(this);
|
|
1726
|
-
this.rest.emit("userUpdate", this);
|
|
1720
|
+
__privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1727
1721
|
return this;
|
|
1728
1722
|
}
|
|
1729
1723
|
async addAdvert(data) {
|
|
1730
1724
|
const route = Routes.guilds.users.resource(this.manager.guild.id, this.id, "adverts");
|
|
1731
1725
|
const payload = data;
|
|
1732
1726
|
const response = await this.rest.request({ method: "POST", url: route, payload });
|
|
1733
|
-
return this.
|
|
1727
|
+
return __privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1734
1728
|
}
|
|
1735
1729
|
async removeAdvert(advertId) {
|
|
1736
1730
|
let advs = this.adverts;
|
|
@@ -1739,7 +1733,7 @@ var GuildUser = class _GuildUser {
|
|
|
1739
1733
|
const payload = { adverts: advs };
|
|
1740
1734
|
const route = Routes.guilds.users.update(this.manager.guild.id, this.id);
|
|
1741
1735
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
1742
|
-
return this.
|
|
1736
|
+
return __privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1743
1737
|
}
|
|
1744
1738
|
/**
|
|
1745
1739
|
* Update certain property
|
|
@@ -1790,7 +1784,7 @@ var GuildUser = class _GuildUser {
|
|
|
1790
1784
|
url: route,
|
|
1791
1785
|
payload
|
|
1792
1786
|
});
|
|
1793
|
-
this.
|
|
1787
|
+
__privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1794
1788
|
return this;
|
|
1795
1789
|
}
|
|
1796
1790
|
async delete() {
|
|
@@ -1815,6 +1809,37 @@ var GuildUser = class _GuildUser {
|
|
|
1815
1809
|
return json;
|
|
1816
1810
|
}
|
|
1817
1811
|
};
|
|
1812
|
+
_GuildUser_instances = new WeakSet();
|
|
1813
|
+
updateInternals_fn6 = function(data) {
|
|
1814
|
+
for (let key in data) {
|
|
1815
|
+
if (key === "id" || key === "createdAt") continue;
|
|
1816
|
+
if (key in this) {
|
|
1817
|
+
this[key] = data[key];
|
|
1818
|
+
}
|
|
1819
|
+
if (key === "adverts") {
|
|
1820
|
+
this.adverts = [];
|
|
1821
|
+
for (let _adv of data.adverts) {
|
|
1822
|
+
this.adverts.push({
|
|
1823
|
+
_id: _adv._id,
|
|
1824
|
+
admin_id: _adv.admin_id,
|
|
1825
|
+
role_id: _adv.role_id,
|
|
1826
|
+
reason: _adv.reason,
|
|
1827
|
+
points_removed: _adv.points_removed,
|
|
1828
|
+
proof: _adv.proof,
|
|
1829
|
+
proof_ext: _adv.proof_ext,
|
|
1830
|
+
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
1831
|
+
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
1832
|
+
});
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1837
|
+
this.createdAt = new Date(data.createdAt);
|
|
1838
|
+
this.manager.set(this);
|
|
1839
|
+
this.rest.emit("userUpdate", this);
|
|
1840
|
+
return this;
|
|
1841
|
+
};
|
|
1842
|
+
var GuildUser = _GuildUser;
|
|
1818
1843
|
|
|
1819
1844
|
// src/structures/vipmember/VipMember.ts
|
|
1820
1845
|
var _VipMember_instances, updateData_fn;
|
|
@@ -1953,8 +1978,10 @@ updateData_fn = function(data) {
|
|
|
1953
1978
|
var VipMember = _VipMember;
|
|
1954
1979
|
|
|
1955
1980
|
// src/structures/ticket/Ticket.ts
|
|
1981
|
+
var _GuildTicket_instances, updateInternals_fn7;
|
|
1956
1982
|
var GuildTicket = class {
|
|
1957
1983
|
constructor(data, manager) {
|
|
1984
|
+
__privateAdd(this, _GuildTicket_instances);
|
|
1958
1985
|
__publicField(this, "_id");
|
|
1959
1986
|
__publicField(this, "guild_id");
|
|
1960
1987
|
__publicField(this, "type");
|
|
@@ -1991,7 +2018,7 @@ var GuildTicket = class {
|
|
|
1991
2018
|
method: "GET",
|
|
1992
2019
|
url: route
|
|
1993
2020
|
});
|
|
1994
|
-
return this.
|
|
2021
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
1995
2022
|
}
|
|
1996
2023
|
async setCustomerRating(rating) {
|
|
1997
2024
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "customer_rating");
|
|
@@ -2001,7 +2028,7 @@ var GuildTicket = class {
|
|
|
2001
2028
|
url: route,
|
|
2002
2029
|
payload
|
|
2003
2030
|
});
|
|
2004
|
-
return this.
|
|
2031
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2005
2032
|
}
|
|
2006
2033
|
async setAdminId(id) {
|
|
2007
2034
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "admin_id");
|
|
@@ -2011,7 +2038,7 @@ var GuildTicket = class {
|
|
|
2011
2038
|
url: route,
|
|
2012
2039
|
payload
|
|
2013
2040
|
});
|
|
2014
|
-
return this.
|
|
2041
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2015
2042
|
}
|
|
2016
2043
|
async setChannelId(id) {
|
|
2017
2044
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "channel_id");
|
|
@@ -2021,7 +2048,7 @@ var GuildTicket = class {
|
|
|
2021
2048
|
url: route,
|
|
2022
2049
|
payload
|
|
2023
2050
|
});
|
|
2024
|
-
return this.
|
|
2051
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2025
2052
|
}
|
|
2026
2053
|
async setClosedById(id) {
|
|
2027
2054
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "closed_by_id");
|
|
@@ -2031,7 +2058,7 @@ var GuildTicket = class {
|
|
|
2031
2058
|
url: route,
|
|
2032
2059
|
payload
|
|
2033
2060
|
});
|
|
2034
|
-
return this.
|
|
2061
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2035
2062
|
}
|
|
2036
2063
|
async setStatus(status) {
|
|
2037
2064
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "status");
|
|
@@ -2041,7 +2068,7 @@ var GuildTicket = class {
|
|
|
2041
2068
|
url: route,
|
|
2042
2069
|
payload
|
|
2043
2070
|
});
|
|
2044
|
-
return this.
|
|
2071
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2045
2072
|
}
|
|
2046
2073
|
async addMessage(message) {
|
|
2047
2074
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "messages");
|
|
@@ -2051,25 +2078,28 @@ var GuildTicket = class {
|
|
|
2051
2078
|
url: route,
|
|
2052
2079
|
payload
|
|
2053
2080
|
});
|
|
2054
|
-
return this.
|
|
2055
|
-
}
|
|
2056
|
-
_updateInternals(data) {
|
|
2057
|
-
for (let key in data) {
|
|
2058
|
-
if (key === "id" || key === "createdAt") continue;
|
|
2059
|
-
if (key in this) {
|
|
2060
|
-
this[key] = data[key];
|
|
2061
|
-
}
|
|
2062
|
-
}
|
|
2063
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2064
|
-
this.createdAt = new Date(data.createdAt);
|
|
2065
|
-
this.manager.set(this);
|
|
2066
|
-
return this;
|
|
2081
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2067
2082
|
}
|
|
2068
2083
|
};
|
|
2084
|
+
_GuildTicket_instances = new WeakSet();
|
|
2085
|
+
updateInternals_fn7 = function(data) {
|
|
2086
|
+
for (let key in data) {
|
|
2087
|
+
if (key === "id" || key === "createdAt") continue;
|
|
2088
|
+
if (key in this) {
|
|
2089
|
+
this[key] = data[key];
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2093
|
+
this.createdAt = new Date(data.createdAt);
|
|
2094
|
+
this.manager.set(this);
|
|
2095
|
+
return this;
|
|
2096
|
+
};
|
|
2069
2097
|
|
|
2070
2098
|
// src/structures/minesgame/MinesGame.ts
|
|
2099
|
+
var _MinesGame_instances, updateInternals_fn8;
|
|
2071
2100
|
var MinesGame = class {
|
|
2072
2101
|
constructor(data, manager) {
|
|
2102
|
+
__privateAdd(this, _MinesGame_instances);
|
|
2073
2103
|
__publicField(this, "guild_id");
|
|
2074
2104
|
__publicField(this, "_id");
|
|
2075
2105
|
__publicField(this, "creatorId");
|
|
@@ -2103,7 +2133,7 @@ var MinesGame = class {
|
|
|
2103
2133
|
method: "GET",
|
|
2104
2134
|
url: route
|
|
2105
2135
|
});
|
|
2106
|
-
return this.
|
|
2136
|
+
return __privateMethod(this, _MinesGame_instances, updateInternals_fn8).call(this, response);
|
|
2107
2137
|
}
|
|
2108
2138
|
async delete() {
|
|
2109
2139
|
const route = `/${Routes.fields("minesgames", this._id)}`;
|
|
@@ -2111,7 +2141,7 @@ var MinesGame = class {
|
|
|
2111
2141
|
method: "delete",
|
|
2112
2142
|
url: route
|
|
2113
2143
|
});
|
|
2114
|
-
return this.
|
|
2144
|
+
return __privateMethod(this, _MinesGame_instances, updateInternals_fn8).call(this, response);
|
|
2115
2145
|
}
|
|
2116
2146
|
async update(data) {
|
|
2117
2147
|
const route = `/${Routes.fields("minesgames", this._id)}`;
|
|
@@ -2120,25 +2150,27 @@ var MinesGame = class {
|
|
|
2120
2150
|
url: route,
|
|
2121
2151
|
payload: data
|
|
2122
2152
|
});
|
|
2123
|
-
return this.
|
|
2153
|
+
return __privateMethod(this, _MinesGame_instances, updateInternals_fn8).call(this, response);
|
|
2124
2154
|
}
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2155
|
+
};
|
|
2156
|
+
_MinesGame_instances = new WeakSet();
|
|
2157
|
+
updateInternals_fn8 = function(data) {
|
|
2158
|
+
for (let key in data) {
|
|
2159
|
+
if (key === "id" || key === "createdAt") continue;
|
|
2160
|
+
if (key in this) {
|
|
2161
|
+
this[key] = data[key];
|
|
2131
2162
|
}
|
|
2132
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2133
|
-
this.manager.set(this);
|
|
2134
|
-
return this;
|
|
2135
2163
|
}
|
|
2164
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2165
|
+
this.manager.set(this);
|
|
2166
|
+
return this;
|
|
2136
2167
|
};
|
|
2137
2168
|
|
|
2138
2169
|
// src/structures/automaticmessage/AutomaticMessage.ts
|
|
2170
|
+
var _AutomaticMessage_instances, updateInternals_fn9;
|
|
2139
2171
|
var AutomaticMessage = class {
|
|
2140
2172
|
constructor(data, manager) {
|
|
2141
|
-
|
|
2173
|
+
__privateAdd(this, _AutomaticMessage_instances);
|
|
2142
2174
|
__publicField(this, "id");
|
|
2143
2175
|
__publicField(this, "type");
|
|
2144
2176
|
__publicField(this, "admin_id");
|
|
@@ -2157,7 +2189,6 @@ var AutomaticMessage = class {
|
|
|
2157
2189
|
this.manager = manager;
|
|
2158
2190
|
this.guild = manager.guild;
|
|
2159
2191
|
this.rest = manager.rest;
|
|
2160
|
-
this._id = data?._id;
|
|
2161
2192
|
this.id = data?.id;
|
|
2162
2193
|
this.type = data?.type;
|
|
2163
2194
|
this.admin_id = data?.admin_id;
|
|
@@ -2172,12 +2203,7 @@ var AutomaticMessage = class {
|
|
|
2172
2203
|
this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
|
|
2173
2204
|
}
|
|
2174
2205
|
async fetch() {
|
|
2175
|
-
|
|
2176
|
-
const response = await this.rest.request({
|
|
2177
|
-
method: "get",
|
|
2178
|
-
url: route
|
|
2179
|
-
});
|
|
2180
|
-
return this._updateInternals(response);
|
|
2206
|
+
return this.manager.fetch(this.id);
|
|
2181
2207
|
}
|
|
2182
2208
|
async addChannelId(...id) {
|
|
2183
2209
|
const ids = [.../* @__PURE__ */ new Set([...this.channel_ids, ...id])];
|
|
@@ -2189,39 +2215,28 @@ var AutomaticMessage = class {
|
|
|
2189
2215
|
return this.update({ channel_ids: ids });
|
|
2190
2216
|
}
|
|
2191
2217
|
async update(data) {
|
|
2218
|
+
this.manager.cache.set(this.id, { ...this, ...data, id: this.id });
|
|
2192
2219
|
const route = Routes.guilds.get(this.guild.id);
|
|
2193
2220
|
const response = await this.rest.request({
|
|
2194
2221
|
method: "patch",
|
|
2195
2222
|
url: route,
|
|
2196
|
-
payload: { automatic_messages: this.manager.
|
|
2223
|
+
payload: { automatic_messages: this.manager.toJSON() }
|
|
2197
2224
|
});
|
|
2198
|
-
return this.
|
|
2225
|
+
return __privateMethod(this, _AutomaticMessage_instances, updateInternals_fn9).call(this, response);
|
|
2199
2226
|
}
|
|
2200
2227
|
async delete() {
|
|
2201
|
-
this.manager.cache.delete(this.
|
|
2228
|
+
this.manager.cache.delete(this.id);
|
|
2229
|
+
this.guild.automatic_messages = this.manager.cache.toArray();
|
|
2202
2230
|
const route = Routes.guilds.get(this.guild.id);
|
|
2203
2231
|
const response = await this.rest.request({
|
|
2204
2232
|
method: "patch",
|
|
2205
2233
|
url: route,
|
|
2206
|
-
payload: { automatic_messages: this.manager.
|
|
2234
|
+
payload: { automatic_messages: this.manager.toJSON() }
|
|
2207
2235
|
});
|
|
2208
2236
|
return this.manager.set(response.automatic_messages);
|
|
2209
2237
|
}
|
|
2210
|
-
_updateInternals(data) {
|
|
2211
|
-
for (let key in data) {
|
|
2212
|
-
if (key === "_id" || key === "createdAt") continue;
|
|
2213
|
-
if (key in this) {
|
|
2214
|
-
this[key] = data[key];
|
|
2215
|
-
}
|
|
2216
|
-
}
|
|
2217
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2218
|
-
this.createdAt = new Date(data.createdAt);
|
|
2219
|
-
this.manager._add(this);
|
|
2220
|
-
return this;
|
|
2221
|
-
}
|
|
2222
2238
|
toJSON() {
|
|
2223
2239
|
return {
|
|
2224
|
-
_id: this._id,
|
|
2225
2240
|
id: this.id,
|
|
2226
2241
|
type: this.type,
|
|
2227
2242
|
admin_id: this.admin_id,
|
|
@@ -2237,6 +2252,20 @@ var AutomaticMessage = class {
|
|
|
2237
2252
|
};
|
|
2238
2253
|
}
|
|
2239
2254
|
};
|
|
2255
|
+
_AutomaticMessage_instances = new WeakSet();
|
|
2256
|
+
updateInternals_fn9 = function(data) {
|
|
2257
|
+
const _this = data?.automatic_messages?.find((m) => m.id === this.id);
|
|
2258
|
+
for (let key in _this) {
|
|
2259
|
+
if (key === "id" || key === "createdAt") continue;
|
|
2260
|
+
if (key in this) {
|
|
2261
|
+
this[key] = _this[key];
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2265
|
+
this.createdAt = new Date(data.createdAt);
|
|
2266
|
+
this.manager._add(data.automatic_messages);
|
|
2267
|
+
return this;
|
|
2268
|
+
};
|
|
2240
2269
|
|
|
2241
2270
|
// src/utils/randomKeyGenerator.ts
|
|
2242
2271
|
import { randomBytes } from "crypto";
|
|
@@ -2250,25 +2279,19 @@ var AutomaticMessageManager = class extends BaseManager {
|
|
|
2250
2279
|
super(guild);
|
|
2251
2280
|
this.guild = guild;
|
|
2252
2281
|
this.rest = guild.rest;
|
|
2253
|
-
this.base_url = Routes.guilds.resource(guild.id
|
|
2282
|
+
this.base_url = Routes.guilds.resource(guild.id);
|
|
2254
2283
|
this.cache = new Collection();
|
|
2255
2284
|
if (guild.automatic_messages && guild.automatic_messages.length !== 0) this.set(guild.automatic_messages);
|
|
2256
2285
|
else this.guild.automatic_messages = [];
|
|
2257
2286
|
}
|
|
2258
2287
|
async fetch(messageId) {
|
|
2259
2288
|
const route = this.base_url;
|
|
2260
|
-
if (messageId) {
|
|
2261
|
-
const response2 = await this.rest.request({
|
|
2262
|
-
method: "get",
|
|
2263
|
-
url: `${route}`
|
|
2264
|
-
});
|
|
2265
|
-
return this._add(response2).find((m) => m.id === messageId);
|
|
2266
|
-
}
|
|
2267
2289
|
const response = await this.rest.request({
|
|
2268
2290
|
method: "get",
|
|
2269
2291
|
url: route
|
|
2270
2292
|
});
|
|
2271
|
-
|
|
2293
|
+
this._add(response.automatic_messages);
|
|
2294
|
+
return this.cache;
|
|
2272
2295
|
}
|
|
2273
2296
|
async create(data) {
|
|
2274
2297
|
if (!data.type) throw new Error(`Missing message's type.`);
|
|
@@ -2295,6 +2318,7 @@ var AutomaticMessageManager = class extends BaseManager {
|
|
|
2295
2318
|
if (data instanceof AutomaticMessage) this.cache.set(data.id, data);
|
|
2296
2319
|
else this.cache.set(data.id, new AutomaticMessage(data, this));
|
|
2297
2320
|
}
|
|
2321
|
+
this.guild.automatic_messages = this.cache.toArray();
|
|
2298
2322
|
return this.cache;
|
|
2299
2323
|
}
|
|
2300
2324
|
set(data) {
|
|
@@ -2323,6 +2347,10 @@ var AutomaticMessageManager = class extends BaseManager {
|
|
|
2323
2347
|
});
|
|
2324
2348
|
return response;
|
|
2325
2349
|
}
|
|
2350
|
+
toJSON() {
|
|
2351
|
+
[...this.cache.values()].map((m) => console.log(m instanceof AutomaticMessage));
|
|
2352
|
+
return this.cache.toArray();
|
|
2353
|
+
}
|
|
2326
2354
|
};
|
|
2327
2355
|
|
|
2328
2356
|
// src/managers/bet/GuildBetManager.ts
|
|
@@ -2901,15 +2929,14 @@ var GuildTicketManager = class {
|
|
|
2901
2929
|
} else {
|
|
2902
2930
|
categories.push(data);
|
|
2903
2931
|
}
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2932
|
+
return this.guild.update({
|
|
2933
|
+
tickets_configuration: {
|
|
2934
|
+
categories,
|
|
2935
|
+
creationCategory: this.guild.tickets_configuration.creationCategory,
|
|
2936
|
+
deletionCategory: this.guild.tickets_configuration.deletionCategory,
|
|
2937
|
+
rating_channel_id: this.guild.tickets_configuration.rating_channel_id
|
|
2938
|
+
}
|
|
2910
2939
|
});
|
|
2911
|
-
this.guild._updateInternals(response);
|
|
2912
|
-
return response;
|
|
2913
2940
|
}
|
|
2914
2941
|
async deleteTicketCategory(data) {
|
|
2915
2942
|
let categories = this.guild.tickets_configuration.categories;
|
|
@@ -2923,8 +2950,14 @@ var GuildTicketManager = class {
|
|
|
2923
2950
|
url: route,
|
|
2924
2951
|
payload
|
|
2925
2952
|
});
|
|
2926
|
-
this.guild.
|
|
2927
|
-
|
|
2953
|
+
return this.guild.update({
|
|
2954
|
+
tickets_configuration: {
|
|
2955
|
+
categories,
|
|
2956
|
+
creationCategory: this.guild.tickets_configuration.creationCategory,
|
|
2957
|
+
deletionCategory: this.guild.tickets_configuration.deletionCategory,
|
|
2958
|
+
rating_channel_id: this.guild.tickets_configuration.rating_channel_id
|
|
2959
|
+
}
|
|
2960
|
+
});
|
|
2928
2961
|
}
|
|
2929
2962
|
async fetch(options) {
|
|
2930
2963
|
if (options && options.cache) return this.cache;
|
|
@@ -3190,14 +3223,150 @@ var VipMemberManager = class extends BaseManager {
|
|
|
3190
3223
|
}
|
|
3191
3224
|
};
|
|
3192
3225
|
|
|
3226
|
+
// src/structures/tournament/Tournament.ts
|
|
3227
|
+
var _Tournament_instances, updateInternals_fn10;
|
|
3228
|
+
var Tournament = class {
|
|
3229
|
+
constructor(data, manager) {
|
|
3230
|
+
__privateAdd(this, _Tournament_instances);
|
|
3231
|
+
__publicField(this, "_id");
|
|
3232
|
+
__publicField(this, "guild_id");
|
|
3233
|
+
__publicField(this, "type");
|
|
3234
|
+
__publicField(this, "max_teams");
|
|
3235
|
+
__publicField(this, "teams");
|
|
3236
|
+
__publicField(this, "message");
|
|
3237
|
+
__publicField(this, "message_id");
|
|
3238
|
+
__publicField(this, "status");
|
|
3239
|
+
__publicField(this, "createdAt");
|
|
3240
|
+
__publicField(this, "updatedAt");
|
|
3241
|
+
__publicField(this, "guild");
|
|
3242
|
+
__publicField(this, "rest");
|
|
3243
|
+
__publicField(this, "manager");
|
|
3244
|
+
__publicField(this, "data");
|
|
3245
|
+
this.manager = manager;
|
|
3246
|
+
this.guild = manager.guild;
|
|
3247
|
+
this.rest = manager.rest;
|
|
3248
|
+
this.guild_id = data?.guild_id;
|
|
3249
|
+
this.type = data?.type;
|
|
3250
|
+
this.teams = data?.teams;
|
|
3251
|
+
this.message = data?.message;
|
|
3252
|
+
this.message_id = data?.message_id;
|
|
3253
|
+
this.status = data?.status;
|
|
3254
|
+
this.createdAt = data?.createdAt ? new Date(data?.createdAt) : /* @__PURE__ */ new Date();
|
|
3255
|
+
this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
|
|
3256
|
+
this.data = data;
|
|
3257
|
+
}
|
|
3258
|
+
async fetch() {
|
|
3259
|
+
const route = Routes.fields("guilds", this.guild.id, "tournaments", this._id);
|
|
3260
|
+
const response = await this.rest.request({
|
|
3261
|
+
method: "get",
|
|
3262
|
+
url: route
|
|
3263
|
+
});
|
|
3264
|
+
return __privateMethod(this, _Tournament_instances, updateInternals_fn10).call(this, response);
|
|
3265
|
+
}
|
|
3266
|
+
async update(data) {
|
|
3267
|
+
const route = Routes.fields("guilds", this.guild.id, "tournaments", this._id);
|
|
3268
|
+
const response = await this.rest.request({
|
|
3269
|
+
method: "patch",
|
|
3270
|
+
url: route,
|
|
3271
|
+
payload: data
|
|
3272
|
+
});
|
|
3273
|
+
return __privateMethod(this, _Tournament_instances, updateInternals_fn10).call(this, response);
|
|
3274
|
+
}
|
|
3275
|
+
toJSON() {
|
|
3276
|
+
return {
|
|
3277
|
+
guild_id: this.guild_id,
|
|
3278
|
+
type: this.type,
|
|
3279
|
+
max_teams: this.max_teams,
|
|
3280
|
+
teams: this.teams,
|
|
3281
|
+
message: this.message,
|
|
3282
|
+
message_id: this.message_id,
|
|
3283
|
+
status: this.status,
|
|
3284
|
+
createdAt: this.createdAt ? new Date(this?.createdAt) : /* @__PURE__ */ new Date(),
|
|
3285
|
+
updatedAt: this.updatedAt ? new Date(this?.updatedAt) : /* @__PURE__ */ new Date()
|
|
3286
|
+
};
|
|
3287
|
+
}
|
|
3288
|
+
};
|
|
3289
|
+
_Tournament_instances = new WeakSet();
|
|
3290
|
+
updateInternals_fn10 = function(data) {
|
|
3291
|
+
for (let key in data) {
|
|
3292
|
+
if (key === "id" || key === "createdAt") continue;
|
|
3293
|
+
if (key in this) {
|
|
3294
|
+
this[key] = data[key];
|
|
3295
|
+
}
|
|
3296
|
+
}
|
|
3297
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
3298
|
+
this.createdAt = new Date(data.createdAt);
|
|
3299
|
+
this.manager._add(this);
|
|
3300
|
+
return this;
|
|
3301
|
+
};
|
|
3302
|
+
|
|
3303
|
+
// src/managers/tournament/TournamentManager.ts
|
|
3304
|
+
var TournamentManager = class extends BaseManager {
|
|
3305
|
+
constructor(guild) {
|
|
3306
|
+
super(guild);
|
|
3307
|
+
this.guild = guild;
|
|
3308
|
+
this.rest = guild.rest;
|
|
3309
|
+
this.base_url = Routes.guilds.resource(guild.id, "tournaments");
|
|
3310
|
+
this.cache = new Collection();
|
|
3311
|
+
}
|
|
3312
|
+
async fetch(options) {
|
|
3313
|
+
if (options && options.cache) return this.cache;
|
|
3314
|
+
if (options && options.tournamentId) {
|
|
3315
|
+
const response2 = await this.rest.request({
|
|
3316
|
+
method: "GET",
|
|
3317
|
+
url: Routes.fields(this.base_url, options.tournamentId)
|
|
3318
|
+
});
|
|
3319
|
+
const tournament = new Tournament(response2, this);
|
|
3320
|
+
this._add(tournament);
|
|
3321
|
+
return tournament;
|
|
3322
|
+
}
|
|
3323
|
+
const response = await this.rest.request({
|
|
3324
|
+
method: "GET",
|
|
3325
|
+
url: this.base_url
|
|
3326
|
+
});
|
|
3327
|
+
return this.set(response);
|
|
3328
|
+
}
|
|
3329
|
+
set(data) {
|
|
3330
|
+
this.cache.clear();
|
|
3331
|
+
if (Array.isArray(data)) {
|
|
3332
|
+
for (let _m of data) {
|
|
3333
|
+
if (!_m._id) continue;
|
|
3334
|
+
if (_m instanceof Tournament) this.cache.set(_m._id, _m);
|
|
3335
|
+
else this.cache.set(_m._id, new Tournament(_m, this));
|
|
3336
|
+
}
|
|
3337
|
+
} else {
|
|
3338
|
+
if (!data._id) return this.cache;
|
|
3339
|
+
if (data instanceof Tournament) this.cache.set(data._id, data);
|
|
3340
|
+
else this.cache.set(data._id, new Tournament(data, this));
|
|
3341
|
+
}
|
|
3342
|
+
return this.cache;
|
|
3343
|
+
}
|
|
3344
|
+
_add(data) {
|
|
3345
|
+
if (Array.isArray(data)) {
|
|
3346
|
+
for (let _m of data) {
|
|
3347
|
+
if (!_m._id) continue;
|
|
3348
|
+
if (_m instanceof Tournament) this.cache.set(_m._id, _m);
|
|
3349
|
+
else this.cache.set(_m._id, new Tournament(_m, this));
|
|
3350
|
+
}
|
|
3351
|
+
} else {
|
|
3352
|
+
if (!data._id) return this.cache;
|
|
3353
|
+
if (data instanceof Tournament) this.cache.set(data._id, data);
|
|
3354
|
+
else this.cache.set(data._id, new Tournament(data, this));
|
|
3355
|
+
}
|
|
3356
|
+
return this.cache;
|
|
3357
|
+
}
|
|
3358
|
+
};
|
|
3359
|
+
|
|
3193
3360
|
// src/structures/guild/Guild.ts
|
|
3194
|
-
var
|
|
3361
|
+
var _Guild_instances, updateInternals_fn11;
|
|
3362
|
+
var Guild6 = class {
|
|
3195
3363
|
/**
|
|
3196
3364
|
* The guild structure
|
|
3197
3365
|
* @param data The guild's data
|
|
3198
3366
|
* @param rest The rest client
|
|
3199
3367
|
*/
|
|
3200
3368
|
constructor(data, rest) {
|
|
3369
|
+
__privateAdd(this, _Guild_instances);
|
|
3201
3370
|
/** The data of this guild */
|
|
3202
3371
|
__publicField(this, "data");
|
|
3203
3372
|
/** The rest client */
|
|
@@ -3223,6 +3392,7 @@ var Guild5 = class {
|
|
|
3223
3392
|
__publicField(this, "roulette_settings");
|
|
3224
3393
|
/** Guild Prefix */
|
|
3225
3394
|
__publicField(this, "prefix");
|
|
3395
|
+
__publicField(this, "prefixes");
|
|
3226
3396
|
/** Guild Creation Date */
|
|
3227
3397
|
__publicField(this, "createdAt");
|
|
3228
3398
|
/** Guild Updated Date */
|
|
@@ -3242,6 +3412,7 @@ var Guild5 = class {
|
|
|
3242
3412
|
__publicField(this, "mediators");
|
|
3243
3413
|
__publicField(this, "automatic_messages");
|
|
3244
3414
|
__publicField(this, "automaticMessagesManager");
|
|
3415
|
+
__publicField(this, "tournaments");
|
|
3245
3416
|
__publicField(this, "adverts");
|
|
3246
3417
|
__publicField(this, "codes");
|
|
3247
3418
|
__publicField(this, "coin_symbol");
|
|
@@ -3256,6 +3427,7 @@ var Guild5 = class {
|
|
|
3256
3427
|
this.scores = data?.scores;
|
|
3257
3428
|
this.codes = data?.codes;
|
|
3258
3429
|
this.prefix = data?.prefix;
|
|
3430
|
+
this.prefixes = data?.prefixes;
|
|
3259
3431
|
this.status = data?.status;
|
|
3260
3432
|
this.tickets_configuration = data?.tickets_configuration;
|
|
3261
3433
|
this.automatic_messages = data?.automatic_messages;
|
|
@@ -3276,6 +3448,7 @@ var Guild5 = class {
|
|
|
3276
3448
|
this.bets = new GuildBetManager2(this);
|
|
3277
3449
|
this.mediators = new GuildMediatorManager(this);
|
|
3278
3450
|
this.automaticMessagesManager = new AutomaticMessageManager(this);
|
|
3451
|
+
this.tournaments = new TournamentManager(this);
|
|
3279
3452
|
this.adverts = [];
|
|
3280
3453
|
for (let _adv of data?.adverts || []) {
|
|
3281
3454
|
this.adverts.push({
|
|
@@ -3312,7 +3485,7 @@ var Guild5 = class {
|
|
|
3312
3485
|
url: route,
|
|
3313
3486
|
payload: { channels }
|
|
3314
3487
|
});
|
|
3315
|
-
this.
|
|
3488
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3316
3489
|
return response.channels.find((t) => t.type === type);
|
|
3317
3490
|
}
|
|
3318
3491
|
}
|
|
@@ -3327,7 +3500,7 @@ var Guild5 = class {
|
|
|
3327
3500
|
url: route,
|
|
3328
3501
|
payload: { permissions }
|
|
3329
3502
|
});
|
|
3330
|
-
this.
|
|
3503
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3331
3504
|
return response.permissions.find((t) => t.type === type);
|
|
3332
3505
|
}
|
|
3333
3506
|
}
|
|
@@ -3336,26 +3509,26 @@ var Guild5 = class {
|
|
|
3336
3509
|
const route = Routes.guilds.get(this.id);
|
|
3337
3510
|
const payload = { adverts: this.adverts };
|
|
3338
3511
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
3339
|
-
return this.
|
|
3512
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3340
3513
|
}
|
|
3341
3514
|
async removeAdvert(advertId) {
|
|
3342
3515
|
const route = Routes.guilds.get(this.id);
|
|
3343
3516
|
const payload = { adverts: this.adverts.filter((a) => a._id !== advertId) };
|
|
3344
3517
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
3345
|
-
return this.
|
|
3518
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3346
3519
|
}
|
|
3347
3520
|
async createCode(data) {
|
|
3348
3521
|
this.codes.push(data);
|
|
3349
3522
|
const route = Routes.guilds.get(this.id);
|
|
3350
3523
|
const payload = { codes: this.codes };
|
|
3351
3524
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
3352
|
-
return this.
|
|
3525
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3353
3526
|
}
|
|
3354
3527
|
async removeCode(codeId) {
|
|
3355
3528
|
const route = Routes.guilds.get(this.id);
|
|
3356
3529
|
const payload = { codes: this.codes.filter((a) => a._id !== codeId) };
|
|
3357
3530
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
3358
|
-
return this.
|
|
3531
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3359
3532
|
}
|
|
3360
3533
|
async addIdToChannel(type, id) {
|
|
3361
3534
|
const channel = this.channels.find((c) => c.type === type);
|
|
@@ -3374,7 +3547,7 @@ var Guild5 = class {
|
|
|
3374
3547
|
url: route,
|
|
3375
3548
|
payload
|
|
3376
3549
|
});
|
|
3377
|
-
return this.
|
|
3550
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3378
3551
|
}
|
|
3379
3552
|
async setChannelIds(type, ...ids) {
|
|
3380
3553
|
const channel = this.channels.find((c) => c.type === type);
|
|
@@ -3393,7 +3566,7 @@ var Guild5 = class {
|
|
|
3393
3566
|
url: route,
|
|
3394
3567
|
payload
|
|
3395
3568
|
});
|
|
3396
|
-
return this.
|
|
3569
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3397
3570
|
}
|
|
3398
3571
|
async removeIdInChannel(type, id) {
|
|
3399
3572
|
const chIndex = this.channels.findIndex((c) => c.type === type);
|
|
@@ -3415,7 +3588,7 @@ var Guild5 = class {
|
|
|
3415
3588
|
url: route,
|
|
3416
3589
|
payload
|
|
3417
3590
|
});
|
|
3418
|
-
return this.
|
|
3591
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3419
3592
|
}
|
|
3420
3593
|
async updateRouletteSettings(data) {
|
|
3421
3594
|
const _data = {
|
|
@@ -3472,58 +3645,21 @@ var Guild5 = class {
|
|
|
3472
3645
|
this.logEntries.fetch(),
|
|
3473
3646
|
this.betusers.fetch(),
|
|
3474
3647
|
this.bets.fetch(),
|
|
3475
|
-
this.mediators.fetch()
|
|
3648
|
+
this.mediators.fetch(),
|
|
3649
|
+
this.tournaments.fetch()
|
|
3476
3650
|
]);
|
|
3477
3651
|
return this;
|
|
3478
3652
|
}
|
|
3479
|
-
_updateInternals(data) {
|
|
3480
|
-
for (let key in data) {
|
|
3481
|
-
if (key === "id" || key === "createdAt") continue;
|
|
3482
|
-
if (key in this) {
|
|
3483
|
-
this[key] = data[key];
|
|
3484
|
-
}
|
|
3485
|
-
if (key === "adverts") {
|
|
3486
|
-
this.adverts = [];
|
|
3487
|
-
for (let _adv of data.adverts) {
|
|
3488
|
-
this.adverts.push({
|
|
3489
|
-
_id: _adv._id,
|
|
3490
|
-
admin_id: _adv.admin_id,
|
|
3491
|
-
points_to_remove: _adv.points_to_remove,
|
|
3492
|
-
role_id: _adv.role_id,
|
|
3493
|
-
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
3494
|
-
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
3495
|
-
});
|
|
3496
|
-
}
|
|
3497
|
-
}
|
|
3498
|
-
if (key === "code") {
|
|
3499
|
-
this.codes = [];
|
|
3500
|
-
for (let _adv of data.codes) {
|
|
3501
|
-
this.codes.push({
|
|
3502
|
-
_id: _adv._id,
|
|
3503
|
-
admin_id: _adv.admin_id,
|
|
3504
|
-
type: _adv.type,
|
|
3505
|
-
add: _adv.add,
|
|
3506
|
-
code: _adv.code,
|
|
3507
|
-
expire: _adv.expire ? new Date(_adv.expire) : /* @__PURE__ */ new Date(),
|
|
3508
|
-
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
3509
|
-
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
3510
|
-
});
|
|
3511
|
-
}
|
|
3512
|
-
}
|
|
3513
|
-
}
|
|
3514
|
-
this.automaticMessagesManager.set(this.automatic_messages);
|
|
3515
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
3516
|
-
this.rest.guilds.cache.set(this.id, this);
|
|
3517
|
-
this.rest.emit("guildUpdate", this);
|
|
3518
|
-
return this;
|
|
3519
|
-
}
|
|
3520
3653
|
async fetch() {
|
|
3521
3654
|
const route = Routes.guilds.get(this.id);
|
|
3522
3655
|
const response = await this.rest.request({
|
|
3523
3656
|
method: "get",
|
|
3524
3657
|
url: route
|
|
3525
3658
|
});
|
|
3526
|
-
return this.
|
|
3659
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3660
|
+
}
|
|
3661
|
+
async reset() {
|
|
3662
|
+
return this.update({ reset: true });
|
|
3527
3663
|
}
|
|
3528
3664
|
async update(data) {
|
|
3529
3665
|
const route = Routes.guilds.get(this.id);
|
|
@@ -3532,16 +3668,7 @@ var Guild5 = class {
|
|
|
3532
3668
|
url: route,
|
|
3533
3669
|
payload: data
|
|
3534
3670
|
});
|
|
3535
|
-
|
|
3536
|
-
if (k === "id" || k == "createdAt") continue;
|
|
3537
|
-
if (k in this) {
|
|
3538
|
-
this[k] = response[k];
|
|
3539
|
-
}
|
|
3540
|
-
}
|
|
3541
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
3542
|
-
this.rest.guilds.cache.set(this.id, this);
|
|
3543
|
-
this.rest.emit("guildUpdate", this);
|
|
3544
|
-
return this;
|
|
3671
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3545
3672
|
}
|
|
3546
3673
|
async setStatus(key, status) {
|
|
3547
3674
|
Assertion.assertString(key);
|
|
@@ -3566,16 +3693,27 @@ var Guild5 = class {
|
|
|
3566
3693
|
await this.update({ prices: this.prices });
|
|
3567
3694
|
return this;
|
|
3568
3695
|
}
|
|
3569
|
-
async
|
|
3570
|
-
|
|
3571
|
-
const
|
|
3572
|
-
const payload = { set:
|
|
3696
|
+
async addPrefix(prefixes) {
|
|
3697
|
+
const route = Routes.fields(Routes.guilds.resource(this.id, "prefixes"));
|
|
3698
|
+
const _p = Array.isArray(prefixes) ? prefixes : [prefixes];
|
|
3699
|
+
const payload = { set: [.../* @__PURE__ */ new Set([...this.prefixes, ..._p])] };
|
|
3700
|
+
const response = await this.rest.request({
|
|
3701
|
+
method: "PATCH",
|
|
3702
|
+
url: route,
|
|
3703
|
+
payload
|
|
3704
|
+
});
|
|
3705
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3706
|
+
return this;
|
|
3707
|
+
}
|
|
3708
|
+
async setPrefix(prefixes) {
|
|
3709
|
+
const route = Routes.fields(Routes.guilds.resource(this.id, "prefixes"));
|
|
3710
|
+
const payload = { set: Array.isArray(prefixes) ? prefixes : [prefixes] };
|
|
3573
3711
|
const response = await this.rest.request({
|
|
3574
3712
|
method: "PATCH",
|
|
3575
3713
|
url: route,
|
|
3576
3714
|
payload
|
|
3577
3715
|
});
|
|
3578
|
-
this.
|
|
3716
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3579
3717
|
return this;
|
|
3580
3718
|
}
|
|
3581
3719
|
async toggleDailyCategory(category) {
|
|
@@ -3595,7 +3733,7 @@ var Guild5 = class {
|
|
|
3595
3733
|
url: route,
|
|
3596
3734
|
payload
|
|
3597
3735
|
});
|
|
3598
|
-
this.
|
|
3736
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3599
3737
|
return this;
|
|
3600
3738
|
}
|
|
3601
3739
|
async setScores(name, amount) {
|
|
@@ -3608,7 +3746,7 @@ var Guild5 = class {
|
|
|
3608
3746
|
url: route,
|
|
3609
3747
|
payload
|
|
3610
3748
|
});
|
|
3611
|
-
this.
|
|
3749
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3612
3750
|
return this;
|
|
3613
3751
|
}
|
|
3614
3752
|
async toggleMode(mode) {
|
|
@@ -3633,10 +3771,52 @@ var Guild5 = class {
|
|
|
3633
3771
|
url: route,
|
|
3634
3772
|
payload
|
|
3635
3773
|
});
|
|
3636
|
-
this.
|
|
3774
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3637
3775
|
return this;
|
|
3638
3776
|
}
|
|
3639
3777
|
};
|
|
3778
|
+
_Guild_instances = new WeakSet();
|
|
3779
|
+
updateInternals_fn11 = function(data) {
|
|
3780
|
+
for (let key in data) {
|
|
3781
|
+
if (key === "id" || key === "createdAt") continue;
|
|
3782
|
+
if (key in this) {
|
|
3783
|
+
this[key] = data[key];
|
|
3784
|
+
}
|
|
3785
|
+
if (key === "adverts") {
|
|
3786
|
+
this.adverts = [];
|
|
3787
|
+
for (let _adv of data.adverts) {
|
|
3788
|
+
this.adverts.push({
|
|
3789
|
+
_id: _adv._id,
|
|
3790
|
+
admin_id: _adv.admin_id,
|
|
3791
|
+
points_to_remove: _adv.points_to_remove,
|
|
3792
|
+
role_id: _adv.role_id,
|
|
3793
|
+
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
3794
|
+
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
3795
|
+
});
|
|
3796
|
+
}
|
|
3797
|
+
}
|
|
3798
|
+
if (key === "code") {
|
|
3799
|
+
this.codes = [];
|
|
3800
|
+
for (let _adv of data.codes) {
|
|
3801
|
+
this.codes.push({
|
|
3802
|
+
_id: _adv._id,
|
|
3803
|
+
admin_id: _adv.admin_id,
|
|
3804
|
+
type: _adv.type,
|
|
3805
|
+
add: _adv.add,
|
|
3806
|
+
code: _adv.code,
|
|
3807
|
+
expire: _adv.expire ? new Date(_adv.expire) : /* @__PURE__ */ new Date(),
|
|
3808
|
+
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
3809
|
+
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
3810
|
+
});
|
|
3811
|
+
}
|
|
3812
|
+
}
|
|
3813
|
+
}
|
|
3814
|
+
this.automaticMessagesManager.set(this.automatic_messages);
|
|
3815
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
3816
|
+
this.rest.guilds.cache.set(this.id, this);
|
|
3817
|
+
this.rest.emit("guildUpdate", this);
|
|
3818
|
+
return this;
|
|
3819
|
+
};
|
|
3640
3820
|
|
|
3641
3821
|
// src/managers/guild/GuildManager.ts
|
|
3642
3822
|
var GuildManager = class {
|
|
@@ -3666,7 +3846,7 @@ var GuildManager = class {
|
|
|
3666
3846
|
method: "get",
|
|
3667
3847
|
url: route2
|
|
3668
3848
|
});
|
|
3669
|
-
const guild = new
|
|
3849
|
+
const guild = new Guild6(response2, this.rest);
|
|
3670
3850
|
await guild._start().then((g) => {
|
|
3671
3851
|
this.cache.set(g.id, g);
|
|
3672
3852
|
});
|
|
@@ -3680,13 +3860,22 @@ var GuildManager = class {
|
|
|
3680
3860
|
});
|
|
3681
3861
|
for (let _guild of response) {
|
|
3682
3862
|
if (!_guild.id) continue;
|
|
3683
|
-
const guild = new
|
|
3863
|
+
const guild = new Guild6(_guild, this.rest);
|
|
3684
3864
|
await guild._start().then((g) => {
|
|
3685
3865
|
this.cache.set(g.id, g);
|
|
3686
3866
|
});
|
|
3687
3867
|
}
|
|
3688
3868
|
return this.cache;
|
|
3689
3869
|
}
|
|
3870
|
+
async reset(guildId) {
|
|
3871
|
+
if (guildId) {
|
|
3872
|
+
return await this.cache.get(guildId).reset();
|
|
3873
|
+
}
|
|
3874
|
+
for (let [_, g] of this.cache) {
|
|
3875
|
+
await g.reset();
|
|
3876
|
+
}
|
|
3877
|
+
return this.cache;
|
|
3878
|
+
}
|
|
3690
3879
|
async delete(options) {
|
|
3691
3880
|
if (options && options.guildId) {
|
|
3692
3881
|
Assertion.assertString(options.guildId);
|
|
@@ -3713,12 +3902,12 @@ var GuildManager = class {
|
|
|
3713
3902
|
if (!data) return this.cache;
|
|
3714
3903
|
if (Array.isArray(data)) {
|
|
3715
3904
|
for (let _guild of data) {
|
|
3716
|
-
const guild = new
|
|
3905
|
+
const guild = new Guild6(_guild, this.rest);
|
|
3717
3906
|
this.cache.set(guild.id, guild);
|
|
3718
3907
|
}
|
|
3719
3908
|
return this.cache;
|
|
3720
3909
|
} else {
|
|
3721
|
-
const guild = new
|
|
3910
|
+
const guild = new Guild6(data, this.rest);
|
|
3722
3911
|
this.cache.set(guild.id, guild);
|
|
3723
3912
|
return guild;
|
|
3724
3913
|
}
|
|
@@ -3732,7 +3921,7 @@ var FgGreen = "\x1B[32m";
|
|
|
3732
3921
|
var FgRed = "\x1B[31m";
|
|
3733
3922
|
var FgBlue = "\x1B[34m";
|
|
3734
3923
|
var FgCyan = "\x1B[36m";
|
|
3735
|
-
var
|
|
3924
|
+
var REST9 = class extends EventEmitter {
|
|
3736
3925
|
/**
|
|
3737
3926
|
*
|
|
3738
3927
|
* @param key The unique key for he client
|
|
@@ -3828,5 +4017,5 @@ var REST8 = class extends EventEmitter {
|
|
|
3828
4017
|
}
|
|
3829
4018
|
};
|
|
3830
4019
|
export {
|
|
3831
|
-
|
|
4020
|
+
REST9 as REST
|
|
3832
4021
|
};
|