@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
|
@@ -407,7 +407,7 @@ module.exports = __toCommonJS(GuildManager_exports);
|
|
|
407
407
|
// src/rest/Routes.ts
|
|
408
408
|
var Routes = {
|
|
409
409
|
//base: "http://localhost:80/api/v1",
|
|
410
|
-
base: "https://
|
|
410
|
+
base: "https://duqueapi.shardweb.app/api/v1",
|
|
411
411
|
field: (field) => `/${field}`,
|
|
412
412
|
fields: (...fields) => `${fields.join("/")}`,
|
|
413
413
|
guilds: {
|
|
@@ -602,6 +602,9 @@ var BaseManager = class {
|
|
|
602
602
|
this.rest = guild.rest;
|
|
603
603
|
this.cache = new Collection();
|
|
604
604
|
}
|
|
605
|
+
toJSON() {
|
|
606
|
+
return [...this.cache.values()].map((m) => m && "toJSON" in m && typeof m.toJSON === "function" ? m.toJSON() : m);
|
|
607
|
+
}
|
|
605
608
|
};
|
|
606
609
|
|
|
607
610
|
// src/managers/player/PlayerManager.ts
|
|
@@ -730,8 +733,10 @@ var import_undici = require("undici");
|
|
|
730
733
|
import_dotenv.default.config();
|
|
731
734
|
|
|
732
735
|
// src/structures/bet/GuildBet.ts
|
|
736
|
+
var _GuildBet_instances, updateInternals_fn;
|
|
733
737
|
var GuildBet = class {
|
|
734
738
|
constructor(data, manager) {
|
|
739
|
+
__privateAdd(this, _GuildBet_instances);
|
|
735
740
|
/** The bet's type */
|
|
736
741
|
__publicField(this, "type");
|
|
737
742
|
/** The bet's mode */
|
|
@@ -810,7 +815,7 @@ var GuildBet = class {
|
|
|
810
815
|
async fetch() {
|
|
811
816
|
const route = Routes.guilds.bets.get(this.guild.id, this._id);
|
|
812
817
|
const response = await this.rest.request({ url: route, method: "GET" });
|
|
813
|
-
return this.
|
|
818
|
+
return __privateMethod(this, _GuildBet_instances, updateInternals_fn).call(this, response);
|
|
814
819
|
}
|
|
815
820
|
async addPlayer(player, queue_type) {
|
|
816
821
|
if (this.players.length === 2) return this;
|
|
@@ -847,7 +852,7 @@ var GuildBet = class {
|
|
|
847
852
|
const payload = data;
|
|
848
853
|
const route = Routes.guilds.bets.update(this.guild.id, this._id);
|
|
849
854
|
const response = await this.rest.request({ method: "patch", url: route, payload });
|
|
850
|
-
return this.
|
|
855
|
+
return __privateMethod(this, _GuildBet_instances, updateInternals_fn).call(this, response);
|
|
851
856
|
}
|
|
852
857
|
async delete() {
|
|
853
858
|
const route = Routes.guilds.bets.delete(this.manager.guild.id, this._id);
|
|
@@ -859,33 +864,6 @@ var GuildBet = class {
|
|
|
859
864
|
this.manager.cache.delete(this._id);
|
|
860
865
|
return response;
|
|
861
866
|
}
|
|
862
|
-
_updateInternals(data) {
|
|
863
|
-
for (let key in data) {
|
|
864
|
-
if (key === "_id" || key === "createdAt") continue;
|
|
865
|
-
if (key === "messages") {
|
|
866
|
-
this.messages.set(data[key]);
|
|
867
|
-
continue;
|
|
868
|
-
}
|
|
869
|
-
if (key === "players") {
|
|
870
|
-
this.players._set(data[key]);
|
|
871
|
-
continue;
|
|
872
|
-
}
|
|
873
|
-
if (key in this) {
|
|
874
|
-
this[key] = data[key];
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
if (data?.messages?.length !== 0) {
|
|
878
|
-
if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
|
|
879
|
-
else {
|
|
880
|
-
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
881
|
-
this.messages.set(data.messages);
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
885
|
-
this.createdAt = new Date(data.createdAt);
|
|
886
|
-
this.manager.set(this);
|
|
887
|
-
return this;
|
|
888
|
-
}
|
|
889
867
|
toJSON() {
|
|
890
868
|
let json = {};
|
|
891
869
|
for (const [key, value] of Object.entries(this)) {
|
|
@@ -902,9 +880,38 @@ var GuildBet = class {
|
|
|
902
880
|
};
|
|
903
881
|
}
|
|
904
882
|
};
|
|
883
|
+
_GuildBet_instances = new WeakSet();
|
|
884
|
+
updateInternals_fn = function(data) {
|
|
885
|
+
for (let key in data) {
|
|
886
|
+
if (key === "_id" || key === "createdAt") continue;
|
|
887
|
+
if (key === "messages") {
|
|
888
|
+
this.messages.set(data[key]);
|
|
889
|
+
continue;
|
|
890
|
+
}
|
|
891
|
+
if (key === "players") {
|
|
892
|
+
this.players._set(data[key]);
|
|
893
|
+
continue;
|
|
894
|
+
}
|
|
895
|
+
if (key in this) {
|
|
896
|
+
this[key] = data[key];
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
if (data?.messages?.length !== 0) {
|
|
900
|
+
if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
|
|
901
|
+
else {
|
|
902
|
+
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
903
|
+
this.messages.set(data.messages);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
907
|
+
this.createdAt = new Date(data.createdAt);
|
|
908
|
+
this.manager.set(this);
|
|
909
|
+
return this;
|
|
910
|
+
};
|
|
905
911
|
|
|
906
912
|
// src/structures/betuser/GuildBetUser.ts
|
|
907
|
-
var
|
|
913
|
+
var _GuildBetUser_instances, updateInternals_fn2;
|
|
914
|
+
var _GuildBetUser = class _GuildBetUser {
|
|
908
915
|
/**
|
|
909
916
|
* Bet user
|
|
910
917
|
* @param data The user's data
|
|
@@ -912,6 +919,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
912
919
|
* @param rest The rest client
|
|
913
920
|
*/
|
|
914
921
|
constructor(data, manager) {
|
|
922
|
+
__privateAdd(this, _GuildBetUser_instances);
|
|
915
923
|
/** User daily */
|
|
916
924
|
__publicField(this, "daily");
|
|
917
925
|
__publicField(this, "profile");
|
|
@@ -1006,7 +1014,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
1006
1014
|
url: route,
|
|
1007
1015
|
payload
|
|
1008
1016
|
});
|
|
1009
|
-
return this.
|
|
1017
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn2).call(this, response);
|
|
1010
1018
|
}
|
|
1011
1019
|
async updateProfile(data) {
|
|
1012
1020
|
const _data = {
|
|
@@ -1026,20 +1034,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
1026
1034
|
url: route,
|
|
1027
1035
|
payload: _data
|
|
1028
1036
|
});
|
|
1029
|
-
return this.
|
|
1030
|
-
}
|
|
1031
|
-
_updateInternals(data) {
|
|
1032
|
-
for (let key in data) {
|
|
1033
|
-
if (key === "id" || key === "createdAt") continue;
|
|
1034
|
-
if (key in this) {
|
|
1035
|
-
this[key] = data[key];
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1039
|
-
this.createdAt = new Date(data.createdAt);
|
|
1040
|
-
this.manager.set(this);
|
|
1041
|
-
this.rest.emit("betuserUpdate", this);
|
|
1042
|
-
return this;
|
|
1037
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn2).call(this, response);
|
|
1043
1038
|
}
|
|
1044
1039
|
/**
|
|
1045
1040
|
* Update certain property
|
|
@@ -1076,7 +1071,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
1076
1071
|
url: route,
|
|
1077
1072
|
payload
|
|
1078
1073
|
});
|
|
1079
|
-
return this.
|
|
1074
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn2).call(this, response);
|
|
1080
1075
|
}
|
|
1081
1076
|
async _update(data) {
|
|
1082
1077
|
const route = Routes.guilds.betusers.get(this.manager.guild.id, this.id);
|
|
@@ -1086,7 +1081,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
1086
1081
|
url: route,
|
|
1087
1082
|
payload
|
|
1088
1083
|
});
|
|
1089
|
-
return this.
|
|
1084
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn2).call(this, response);
|
|
1090
1085
|
}
|
|
1091
1086
|
async delete() {
|
|
1092
1087
|
const route = Routes.guilds.betusers.delete(this.manager.guild.id, this.id);
|
|
@@ -1110,10 +1105,27 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
1110
1105
|
return json;
|
|
1111
1106
|
}
|
|
1112
1107
|
};
|
|
1108
|
+
_GuildBetUser_instances = new WeakSet();
|
|
1109
|
+
updateInternals_fn2 = function(data) {
|
|
1110
|
+
for (let key in data) {
|
|
1111
|
+
if (key === "id" || key === "createdAt") continue;
|
|
1112
|
+
if (key in this) {
|
|
1113
|
+
this[key] = data[key];
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1117
|
+
this.createdAt = new Date(data.createdAt);
|
|
1118
|
+
this.manager.set(this);
|
|
1119
|
+
this.rest.emit("betuserUpdate", this);
|
|
1120
|
+
return this;
|
|
1121
|
+
};
|
|
1122
|
+
var GuildBetUser = _GuildBetUser;
|
|
1113
1123
|
|
|
1114
1124
|
// src/structures/logentry/LogEntry.ts
|
|
1125
|
+
var _LogEntry_instances, updateInternals_fn3;
|
|
1115
1126
|
var LogEntry = class {
|
|
1116
1127
|
constructor(data, manager) {
|
|
1128
|
+
__privateAdd(this, _LogEntry_instances);
|
|
1117
1129
|
__publicField(this, "_id");
|
|
1118
1130
|
__publicField(this, "guild_id");
|
|
1119
1131
|
__publicField(this, "user_id");
|
|
@@ -1149,9 +1161,9 @@ var LogEntry = class {
|
|
|
1149
1161
|
this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
|
|
1150
1162
|
}
|
|
1151
1163
|
async fetch() {
|
|
1152
|
-
const route = Routes.guilds
|
|
1164
|
+
const route = Routes.fields("guilds", this.guild.id, "logentries", this._id);
|
|
1153
1165
|
const response = await this.rest.request({ url: route, method: "GET" });
|
|
1154
|
-
return this.
|
|
1166
|
+
return __privateMethod(this, _LogEntry_instances, updateInternals_fn3).call(this, response);
|
|
1155
1167
|
}
|
|
1156
1168
|
toJSON() {
|
|
1157
1169
|
const json = {};
|
|
@@ -1162,21 +1174,23 @@ var LogEntry = class {
|
|
|
1162
1174
|
}
|
|
1163
1175
|
return json;
|
|
1164
1176
|
}
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1177
|
+
};
|
|
1178
|
+
_LogEntry_instances = new WeakSet();
|
|
1179
|
+
updateInternals_fn3 = function(data) {
|
|
1180
|
+
for (let key in data) {
|
|
1181
|
+
if (key === "id" || key === "createdAt") continue;
|
|
1182
|
+
if (key in this) {
|
|
1183
|
+
this[key] = data[key];
|
|
1171
1184
|
}
|
|
1172
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1173
|
-
this.manager.set(this);
|
|
1174
|
-
return this;
|
|
1175
1185
|
}
|
|
1186
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1187
|
+
this.manager.set(this);
|
|
1188
|
+
return this;
|
|
1176
1189
|
};
|
|
1177
1190
|
|
|
1178
1191
|
// src/structures/match/GuildMatch.ts
|
|
1179
|
-
var
|
|
1192
|
+
var _GuildMatch_instances, updateInternals_fn4;
|
|
1193
|
+
var _GuildMatch = class _GuildMatch {
|
|
1180
1194
|
/**
|
|
1181
1195
|
* GuildMatch match
|
|
1182
1196
|
* @param data The match's data
|
|
@@ -1184,6 +1198,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1184
1198
|
* @param rest The rest client
|
|
1185
1199
|
*/
|
|
1186
1200
|
constructor(data, manager) {
|
|
1201
|
+
__privateAdd(this, _GuildMatch_instances);
|
|
1187
1202
|
__publicField(this, "_id");
|
|
1188
1203
|
__publicField(this, "selections");
|
|
1189
1204
|
/** Match's type */
|
|
@@ -1267,7 +1282,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1267
1282
|
method: "get",
|
|
1268
1283
|
url: route
|
|
1269
1284
|
});
|
|
1270
|
-
return await this.
|
|
1285
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1271
1286
|
}
|
|
1272
1287
|
async addConfirmed(type, id) {
|
|
1273
1288
|
const confirmed = this.confirmed.find((c) => c.type === type);
|
|
@@ -1289,7 +1304,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1289
1304
|
url: route,
|
|
1290
1305
|
payload: set
|
|
1291
1306
|
});
|
|
1292
|
-
return await this.
|
|
1307
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1293
1308
|
}
|
|
1294
1309
|
async setStatus(status) {
|
|
1295
1310
|
Assertion.assertString(status);
|
|
@@ -1300,7 +1315,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1300
1315
|
url: route,
|
|
1301
1316
|
payload
|
|
1302
1317
|
});
|
|
1303
|
-
return await this.
|
|
1318
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1304
1319
|
}
|
|
1305
1320
|
async setWinners(players) {
|
|
1306
1321
|
if (!Array.isArray(players)) players = [players];
|
|
@@ -1311,7 +1326,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1311
1326
|
url: route,
|
|
1312
1327
|
payload
|
|
1313
1328
|
});
|
|
1314
|
-
return await this.
|
|
1329
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1315
1330
|
}
|
|
1316
1331
|
async setLoser(players) {
|
|
1317
1332
|
if (!Array.isArray(players)) players = [players];
|
|
@@ -1322,7 +1337,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1322
1337
|
url: route,
|
|
1323
1338
|
payload
|
|
1324
1339
|
});
|
|
1325
|
-
return await this.
|
|
1340
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1326
1341
|
}
|
|
1327
1342
|
async setMvps(...usersId) {
|
|
1328
1343
|
const payload = { set: usersId };
|
|
@@ -1332,7 +1347,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1332
1347
|
url: route,
|
|
1333
1348
|
payload
|
|
1334
1349
|
});
|
|
1335
|
-
return await this.
|
|
1350
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1336
1351
|
}
|
|
1337
1352
|
async setRoomCreatorId(userId) {
|
|
1338
1353
|
Assertion.assertString(userId);
|
|
@@ -1343,7 +1358,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1343
1358
|
url: route,
|
|
1344
1359
|
payload
|
|
1345
1360
|
});
|
|
1346
|
-
return await this.
|
|
1361
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1347
1362
|
}
|
|
1348
1363
|
async setRoomAdminId(userId) {
|
|
1349
1364
|
Assertion.assertString(userId);
|
|
@@ -1354,7 +1369,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1354
1369
|
url: route,
|
|
1355
1370
|
payload
|
|
1356
1371
|
});
|
|
1357
|
-
return await this.
|
|
1372
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1358
1373
|
}
|
|
1359
1374
|
async kick(player) {
|
|
1360
1375
|
this.players = this.players.filter((p) => p.id !== player.id);
|
|
@@ -1378,7 +1393,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1378
1393
|
payload: data
|
|
1379
1394
|
});
|
|
1380
1395
|
this.rest.emit("matchUpdate", this, new _GuildMatch(response, this.manager));
|
|
1381
|
-
return await this.
|
|
1396
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1382
1397
|
}
|
|
1383
1398
|
async delete() {
|
|
1384
1399
|
const route = Routes.guilds.matches.resource(this.guild.id, this._id);
|
|
@@ -1404,35 +1419,38 @@ var GuildMatch = class _GuildMatch {
|
|
|
1404
1419
|
messages: this?.messages instanceof MessagesManager ? this.messages?.cache?.toArray() : []
|
|
1405
1420
|
};
|
|
1406
1421
|
}
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
this.bet = this.guild.bets.set(data.bet);
|
|
1416
|
-
}
|
|
1422
|
+
};
|
|
1423
|
+
_GuildMatch_instances = new WeakSet();
|
|
1424
|
+
updateInternals_fn4 = async function(data) {
|
|
1425
|
+
if (!data) return;
|
|
1426
|
+
for (let key in data) {
|
|
1427
|
+
if (key === "id" || key === "createdAt" || key === "messages") continue;
|
|
1428
|
+
if (key in this) {
|
|
1429
|
+
this[key] = data[key];
|
|
1417
1430
|
}
|
|
1418
|
-
if (
|
|
1419
|
-
|
|
1420
|
-
else {
|
|
1421
|
-
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
1422
|
-
this.messages.set(data.messages);
|
|
1423
|
-
}
|
|
1431
|
+
if (key === "bet") {
|
|
1432
|
+
this.bet = this.guild.bets.set(data.bet);
|
|
1424
1433
|
}
|
|
1425
|
-
|
|
1426
|
-
|
|
1434
|
+
}
|
|
1435
|
+
if (data?.messages?.length !== 0) {
|
|
1436
|
+
if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
|
|
1437
|
+
else {
|
|
1438
|
+
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
1439
|
+
this.messages.set(data.messages);
|
|
1427
1440
|
}
|
|
1428
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1429
|
-
this.manager.set(this);
|
|
1430
|
-
return this;
|
|
1431
1441
|
}
|
|
1442
|
+
if (!(this.bet instanceof GuildBet) && data?.bet) {
|
|
1443
|
+
this.bet = this.guild.bets.cache.get(data._id) ?? await this.guild.bets.fetch({ betId: data?.bet?._id });
|
|
1444
|
+
}
|
|
1445
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1446
|
+
this.manager.set(this);
|
|
1447
|
+
return this;
|
|
1432
1448
|
};
|
|
1449
|
+
var GuildMatch = _GuildMatch;
|
|
1433
1450
|
|
|
1434
1451
|
// src/structures/mediator/GuildMediator.ts
|
|
1435
|
-
var
|
|
1452
|
+
var _GuildMediator_instances, updateInternals_fn5;
|
|
1453
|
+
var _GuildMediator = class _GuildMediator {
|
|
1436
1454
|
/**
|
|
1437
1455
|
* Bet user
|
|
1438
1456
|
* @param data The user's data
|
|
@@ -1440,6 +1458,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1440
1458
|
* @param rest The rest client
|
|
1441
1459
|
*/
|
|
1442
1460
|
constructor(data, manager) {
|
|
1461
|
+
__privateAdd(this, _GuildMediator_instances);
|
|
1443
1462
|
/** User's name */
|
|
1444
1463
|
__publicField(this, "id");
|
|
1445
1464
|
__publicField(this, "guild_id");
|
|
@@ -1498,19 +1517,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1498
1517
|
url: route,
|
|
1499
1518
|
payload
|
|
1500
1519
|
});
|
|
1501
|
-
return this.
|
|
1502
|
-
}
|
|
1503
|
-
_updateInternals(data) {
|
|
1504
|
-
for (let key in data) {
|
|
1505
|
-
if (key === "id" || key === "createdAt") continue;
|
|
1506
|
-
if (key in this) {
|
|
1507
|
-
this[key] = data[key];
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1511
|
-
this.createdAt = new Date(data.createdAt);
|
|
1512
|
-
this.manager.set(this);
|
|
1513
|
-
return this;
|
|
1520
|
+
return __privateMethod(this, _GuildMediator_instances, updateInternals_fn5).call(this, response);
|
|
1514
1521
|
}
|
|
1515
1522
|
/**
|
|
1516
1523
|
* Update certain property
|
|
@@ -1525,7 +1532,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1525
1532
|
url: route,
|
|
1526
1533
|
payload
|
|
1527
1534
|
});
|
|
1528
|
-
return this.
|
|
1535
|
+
return __privateMethod(this, _GuildMediator_instances, updateInternals_fn5).call(this, response);
|
|
1529
1536
|
}
|
|
1530
1537
|
async setPaymentlink(type, link) {
|
|
1531
1538
|
const route = Routes.guilds.mediators.get(this.manager.guild.id, this.id);
|
|
@@ -1535,7 +1542,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1535
1542
|
url: route,
|
|
1536
1543
|
payload
|
|
1537
1544
|
});
|
|
1538
|
-
return this.
|
|
1545
|
+
return __privateMethod(this, _GuildMediator_instances, updateInternals_fn5).call(this, response);
|
|
1539
1546
|
}
|
|
1540
1547
|
async delete() {
|
|
1541
1548
|
const route = Routes.guilds.mediators.delete(this.manager.guild.id, this.id);
|
|
@@ -1558,9 +1565,24 @@ var GuildMediator = class _GuildMediator {
|
|
|
1558
1565
|
return json;
|
|
1559
1566
|
}
|
|
1560
1567
|
};
|
|
1568
|
+
_GuildMediator_instances = new WeakSet();
|
|
1569
|
+
updateInternals_fn5 = function(data) {
|
|
1570
|
+
for (let key in data) {
|
|
1571
|
+
if (key === "id" || key === "createdAt") continue;
|
|
1572
|
+
if (key in this) {
|
|
1573
|
+
this[key] = data[key];
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1577
|
+
this.createdAt = new Date(data.createdAt);
|
|
1578
|
+
this.manager.set(this);
|
|
1579
|
+
return this;
|
|
1580
|
+
};
|
|
1581
|
+
var GuildMediator = _GuildMediator;
|
|
1561
1582
|
|
|
1562
1583
|
// src/structures/user/GuildUser.ts
|
|
1563
|
-
var
|
|
1584
|
+
var _GuildUser_instances, updateInternals_fn6;
|
|
1585
|
+
var _GuildUser = class _GuildUser {
|
|
1564
1586
|
/**
|
|
1565
1587
|
* Bet user
|
|
1566
1588
|
* @param data The user's data
|
|
@@ -1568,6 +1590,7 @@ var GuildUser = class _GuildUser {
|
|
|
1568
1590
|
* @param rest The rest client
|
|
1569
1591
|
*/
|
|
1570
1592
|
constructor(data, manager) {
|
|
1593
|
+
__privateAdd(this, _GuildUser_instances);
|
|
1571
1594
|
/** User's id */
|
|
1572
1595
|
__publicField(this, "id");
|
|
1573
1596
|
__publicField(this, "guild_id");
|
|
@@ -1680,7 +1703,7 @@ var GuildUser = class _GuildUser {
|
|
|
1680
1703
|
url: route,
|
|
1681
1704
|
payload
|
|
1682
1705
|
});
|
|
1683
|
-
this.
|
|
1706
|
+
__privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1684
1707
|
return this;
|
|
1685
1708
|
}
|
|
1686
1709
|
async updateProfile(data) {
|
|
@@ -1701,43 +1724,14 @@ var GuildUser = class _GuildUser {
|
|
|
1701
1724
|
url: route,
|
|
1702
1725
|
payload: _data
|
|
1703
1726
|
});
|
|
1704
|
-
this.
|
|
1705
|
-
return this;
|
|
1706
|
-
}
|
|
1707
|
-
_updateInternals(data) {
|
|
1708
|
-
for (let key in data) {
|
|
1709
|
-
if (key === "id" || key === "createdAt") continue;
|
|
1710
|
-
if (key in this) {
|
|
1711
|
-
this[key] = data[key];
|
|
1712
|
-
}
|
|
1713
|
-
if (key === "adverts") {
|
|
1714
|
-
this.adverts = [];
|
|
1715
|
-
for (let _adv of data.adverts) {
|
|
1716
|
-
this.adverts.push({
|
|
1717
|
-
_id: _adv._id,
|
|
1718
|
-
admin_id: _adv.admin_id,
|
|
1719
|
-
role_id: _adv.role_id,
|
|
1720
|
-
reason: _adv.reason,
|
|
1721
|
-
points_removed: _adv.points_removed,
|
|
1722
|
-
proof: _adv.proof,
|
|
1723
|
-
proof_ext: _adv.proof_ext,
|
|
1724
|
-
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
1725
|
-
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
1726
|
-
});
|
|
1727
|
-
}
|
|
1728
|
-
}
|
|
1729
|
-
}
|
|
1730
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1731
|
-
this.createdAt = new Date(data.createdAt);
|
|
1732
|
-
this.manager.set(this);
|
|
1733
|
-
this.rest.emit("userUpdate", this);
|
|
1727
|
+
__privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1734
1728
|
return this;
|
|
1735
1729
|
}
|
|
1736
1730
|
async addAdvert(data) {
|
|
1737
1731
|
const route = Routes.guilds.users.resource(this.manager.guild.id, this.id, "adverts");
|
|
1738
1732
|
const payload = data;
|
|
1739
1733
|
const response = await this.rest.request({ method: "POST", url: route, payload });
|
|
1740
|
-
return this.
|
|
1734
|
+
return __privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1741
1735
|
}
|
|
1742
1736
|
async removeAdvert(advertId) {
|
|
1743
1737
|
let advs = this.adverts;
|
|
@@ -1746,7 +1740,7 @@ var GuildUser = class _GuildUser {
|
|
|
1746
1740
|
const payload = { adverts: advs };
|
|
1747
1741
|
const route = Routes.guilds.users.update(this.manager.guild.id, this.id);
|
|
1748
1742
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
1749
|
-
return this.
|
|
1743
|
+
return __privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1750
1744
|
}
|
|
1751
1745
|
/**
|
|
1752
1746
|
* Update certain property
|
|
@@ -1797,7 +1791,7 @@ var GuildUser = class _GuildUser {
|
|
|
1797
1791
|
url: route,
|
|
1798
1792
|
payload
|
|
1799
1793
|
});
|
|
1800
|
-
this.
|
|
1794
|
+
__privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1801
1795
|
return this;
|
|
1802
1796
|
}
|
|
1803
1797
|
async delete() {
|
|
@@ -1822,6 +1816,37 @@ var GuildUser = class _GuildUser {
|
|
|
1822
1816
|
return json;
|
|
1823
1817
|
}
|
|
1824
1818
|
};
|
|
1819
|
+
_GuildUser_instances = new WeakSet();
|
|
1820
|
+
updateInternals_fn6 = function(data) {
|
|
1821
|
+
for (let key in data) {
|
|
1822
|
+
if (key === "id" || key === "createdAt") continue;
|
|
1823
|
+
if (key in this) {
|
|
1824
|
+
this[key] = data[key];
|
|
1825
|
+
}
|
|
1826
|
+
if (key === "adverts") {
|
|
1827
|
+
this.adverts = [];
|
|
1828
|
+
for (let _adv of data.adverts) {
|
|
1829
|
+
this.adverts.push({
|
|
1830
|
+
_id: _adv._id,
|
|
1831
|
+
admin_id: _adv.admin_id,
|
|
1832
|
+
role_id: _adv.role_id,
|
|
1833
|
+
reason: _adv.reason,
|
|
1834
|
+
points_removed: _adv.points_removed,
|
|
1835
|
+
proof: _adv.proof,
|
|
1836
|
+
proof_ext: _adv.proof_ext,
|
|
1837
|
+
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
1838
|
+
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
1839
|
+
});
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1844
|
+
this.createdAt = new Date(data.createdAt);
|
|
1845
|
+
this.manager.set(this);
|
|
1846
|
+
this.rest.emit("userUpdate", this);
|
|
1847
|
+
return this;
|
|
1848
|
+
};
|
|
1849
|
+
var GuildUser = _GuildUser;
|
|
1825
1850
|
|
|
1826
1851
|
// src/structures/vipmember/VipMember.ts
|
|
1827
1852
|
var _VipMember_instances, updateData_fn;
|
|
@@ -1960,8 +1985,10 @@ updateData_fn = function(data) {
|
|
|
1960
1985
|
var VipMember = _VipMember;
|
|
1961
1986
|
|
|
1962
1987
|
// src/structures/ticket/Ticket.ts
|
|
1988
|
+
var _GuildTicket_instances, updateInternals_fn7;
|
|
1963
1989
|
var GuildTicket = class {
|
|
1964
1990
|
constructor(data, manager) {
|
|
1991
|
+
__privateAdd(this, _GuildTicket_instances);
|
|
1965
1992
|
__publicField(this, "_id");
|
|
1966
1993
|
__publicField(this, "guild_id");
|
|
1967
1994
|
__publicField(this, "type");
|
|
@@ -1998,7 +2025,7 @@ var GuildTicket = class {
|
|
|
1998
2025
|
method: "GET",
|
|
1999
2026
|
url: route
|
|
2000
2027
|
});
|
|
2001
|
-
return this.
|
|
2028
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2002
2029
|
}
|
|
2003
2030
|
async setCustomerRating(rating) {
|
|
2004
2031
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "customer_rating");
|
|
@@ -2008,7 +2035,7 @@ var GuildTicket = class {
|
|
|
2008
2035
|
url: route,
|
|
2009
2036
|
payload
|
|
2010
2037
|
});
|
|
2011
|
-
return this.
|
|
2038
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2012
2039
|
}
|
|
2013
2040
|
async setAdminId(id) {
|
|
2014
2041
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "admin_id");
|
|
@@ -2018,7 +2045,7 @@ var GuildTicket = class {
|
|
|
2018
2045
|
url: route,
|
|
2019
2046
|
payload
|
|
2020
2047
|
});
|
|
2021
|
-
return this.
|
|
2048
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2022
2049
|
}
|
|
2023
2050
|
async setChannelId(id) {
|
|
2024
2051
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "channel_id");
|
|
@@ -2028,7 +2055,7 @@ var GuildTicket = class {
|
|
|
2028
2055
|
url: route,
|
|
2029
2056
|
payload
|
|
2030
2057
|
});
|
|
2031
|
-
return this.
|
|
2058
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2032
2059
|
}
|
|
2033
2060
|
async setClosedById(id) {
|
|
2034
2061
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "closed_by_id");
|
|
@@ -2038,7 +2065,7 @@ var GuildTicket = class {
|
|
|
2038
2065
|
url: route,
|
|
2039
2066
|
payload
|
|
2040
2067
|
});
|
|
2041
|
-
return this.
|
|
2068
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2042
2069
|
}
|
|
2043
2070
|
async setStatus(status) {
|
|
2044
2071
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "status");
|
|
@@ -2048,7 +2075,7 @@ var GuildTicket = class {
|
|
|
2048
2075
|
url: route,
|
|
2049
2076
|
payload
|
|
2050
2077
|
});
|
|
2051
|
-
return this.
|
|
2078
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2052
2079
|
}
|
|
2053
2080
|
async addMessage(message) {
|
|
2054
2081
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "messages");
|
|
@@ -2058,26 +2085,28 @@ var GuildTicket = class {
|
|
|
2058
2085
|
url: route,
|
|
2059
2086
|
payload
|
|
2060
2087
|
});
|
|
2061
|
-
return this.
|
|
2062
|
-
}
|
|
2063
|
-
_updateInternals(data) {
|
|
2064
|
-
for (let key in data) {
|
|
2065
|
-
if (key === "id" || key === "createdAt") continue;
|
|
2066
|
-
if (key in this) {
|
|
2067
|
-
this[key] = data[key];
|
|
2068
|
-
}
|
|
2069
|
-
}
|
|
2070
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2071
|
-
this.createdAt = new Date(data.createdAt);
|
|
2072
|
-
this.manager.set(this);
|
|
2073
|
-
return this;
|
|
2088
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2074
2089
|
}
|
|
2075
2090
|
};
|
|
2091
|
+
_GuildTicket_instances = new WeakSet();
|
|
2092
|
+
updateInternals_fn7 = function(data) {
|
|
2093
|
+
for (let key in data) {
|
|
2094
|
+
if (key === "id" || key === "createdAt") continue;
|
|
2095
|
+
if (key in this) {
|
|
2096
|
+
this[key] = data[key];
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2100
|
+
this.createdAt = new Date(data.createdAt);
|
|
2101
|
+
this.manager.set(this);
|
|
2102
|
+
return this;
|
|
2103
|
+
};
|
|
2076
2104
|
|
|
2077
2105
|
// src/structures/automaticmessage/AutomaticMessage.ts
|
|
2106
|
+
var _AutomaticMessage_instances, updateInternals_fn8;
|
|
2078
2107
|
var AutomaticMessage = class {
|
|
2079
2108
|
constructor(data, manager) {
|
|
2080
|
-
|
|
2109
|
+
__privateAdd(this, _AutomaticMessage_instances);
|
|
2081
2110
|
__publicField(this, "id");
|
|
2082
2111
|
__publicField(this, "type");
|
|
2083
2112
|
__publicField(this, "admin_id");
|
|
@@ -2096,7 +2125,6 @@ var AutomaticMessage = class {
|
|
|
2096
2125
|
this.manager = manager;
|
|
2097
2126
|
this.guild = manager.guild;
|
|
2098
2127
|
this.rest = manager.rest;
|
|
2099
|
-
this._id = data?._id;
|
|
2100
2128
|
this.id = data?.id;
|
|
2101
2129
|
this.type = data?.type;
|
|
2102
2130
|
this.admin_id = data?.admin_id;
|
|
@@ -2111,12 +2139,7 @@ var AutomaticMessage = class {
|
|
|
2111
2139
|
this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
|
|
2112
2140
|
}
|
|
2113
2141
|
async fetch() {
|
|
2114
|
-
|
|
2115
|
-
const response = await this.rest.request({
|
|
2116
|
-
method: "get",
|
|
2117
|
-
url: route
|
|
2118
|
-
});
|
|
2119
|
-
return this._updateInternals(response);
|
|
2142
|
+
return this.manager.fetch(this.id);
|
|
2120
2143
|
}
|
|
2121
2144
|
async addChannelId(...id) {
|
|
2122
2145
|
const ids = [.../* @__PURE__ */ new Set([...this.channel_ids, ...id])];
|
|
@@ -2128,39 +2151,28 @@ var AutomaticMessage = class {
|
|
|
2128
2151
|
return this.update({ channel_ids: ids });
|
|
2129
2152
|
}
|
|
2130
2153
|
async update(data) {
|
|
2154
|
+
this.manager.cache.set(this.id, { ...this, ...data, id: this.id });
|
|
2131
2155
|
const route = Routes.guilds.get(this.guild.id);
|
|
2132
2156
|
const response = await this.rest.request({
|
|
2133
2157
|
method: "patch",
|
|
2134
2158
|
url: route,
|
|
2135
|
-
payload: { automatic_messages: this.manager.
|
|
2159
|
+
payload: { automatic_messages: this.manager.toJSON() }
|
|
2136
2160
|
});
|
|
2137
|
-
return this.
|
|
2161
|
+
return __privateMethod(this, _AutomaticMessage_instances, updateInternals_fn8).call(this, response);
|
|
2138
2162
|
}
|
|
2139
2163
|
async delete() {
|
|
2140
|
-
this.manager.cache.delete(this.
|
|
2164
|
+
this.manager.cache.delete(this.id);
|
|
2165
|
+
this.guild.automatic_messages = this.manager.cache.toArray();
|
|
2141
2166
|
const route = Routes.guilds.get(this.guild.id);
|
|
2142
2167
|
const response = await this.rest.request({
|
|
2143
2168
|
method: "patch",
|
|
2144
2169
|
url: route,
|
|
2145
|
-
payload: { automatic_messages: this.manager.
|
|
2170
|
+
payload: { automatic_messages: this.manager.toJSON() }
|
|
2146
2171
|
});
|
|
2147
2172
|
return this.manager.set(response.automatic_messages);
|
|
2148
2173
|
}
|
|
2149
|
-
_updateInternals(data) {
|
|
2150
|
-
for (let key in data) {
|
|
2151
|
-
if (key === "_id" || key === "createdAt") continue;
|
|
2152
|
-
if (key in this) {
|
|
2153
|
-
this[key] = data[key];
|
|
2154
|
-
}
|
|
2155
|
-
}
|
|
2156
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2157
|
-
this.createdAt = new Date(data.createdAt);
|
|
2158
|
-
this.manager._add(this);
|
|
2159
|
-
return this;
|
|
2160
|
-
}
|
|
2161
2174
|
toJSON() {
|
|
2162
2175
|
return {
|
|
2163
|
-
_id: this._id,
|
|
2164
2176
|
id: this.id,
|
|
2165
2177
|
type: this.type,
|
|
2166
2178
|
admin_id: this.admin_id,
|
|
@@ -2176,6 +2188,20 @@ var AutomaticMessage = class {
|
|
|
2176
2188
|
};
|
|
2177
2189
|
}
|
|
2178
2190
|
};
|
|
2191
|
+
_AutomaticMessage_instances = new WeakSet();
|
|
2192
|
+
updateInternals_fn8 = function(data) {
|
|
2193
|
+
const _this = data?.automatic_messages?.find((m) => m.id === this.id);
|
|
2194
|
+
for (let key in _this) {
|
|
2195
|
+
if (key === "id" || key === "createdAt") continue;
|
|
2196
|
+
if (key in this) {
|
|
2197
|
+
this[key] = _this[key];
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2201
|
+
this.createdAt = new Date(data.createdAt);
|
|
2202
|
+
this.manager._add(data.automatic_messages);
|
|
2203
|
+
return this;
|
|
2204
|
+
};
|
|
2179
2205
|
|
|
2180
2206
|
// src/utils/randomKeyGenerator.ts
|
|
2181
2207
|
var import_crypto = require("crypto");
|
|
@@ -2189,25 +2215,19 @@ var AutomaticMessageManager = class extends BaseManager {
|
|
|
2189
2215
|
super(guild);
|
|
2190
2216
|
this.guild = guild;
|
|
2191
2217
|
this.rest = guild.rest;
|
|
2192
|
-
this.base_url = Routes.guilds.resource(guild.id
|
|
2218
|
+
this.base_url = Routes.guilds.resource(guild.id);
|
|
2193
2219
|
this.cache = new Collection();
|
|
2194
2220
|
if (guild.automatic_messages && guild.automatic_messages.length !== 0) this.set(guild.automatic_messages);
|
|
2195
2221
|
else this.guild.automatic_messages = [];
|
|
2196
2222
|
}
|
|
2197
2223
|
async fetch(messageId) {
|
|
2198
2224
|
const route = this.base_url;
|
|
2199
|
-
if (messageId) {
|
|
2200
|
-
const response2 = await this.rest.request({
|
|
2201
|
-
method: "get",
|
|
2202
|
-
url: `${route}`
|
|
2203
|
-
});
|
|
2204
|
-
return this._add(response2).find((m) => m.id === messageId);
|
|
2205
|
-
}
|
|
2206
2225
|
const response = await this.rest.request({
|
|
2207
2226
|
method: "get",
|
|
2208
2227
|
url: route
|
|
2209
2228
|
});
|
|
2210
|
-
|
|
2229
|
+
this._add(response.automatic_messages);
|
|
2230
|
+
return this.cache;
|
|
2211
2231
|
}
|
|
2212
2232
|
async create(data) {
|
|
2213
2233
|
if (!data.type) throw new Error(`Missing message's type.`);
|
|
@@ -2234,6 +2254,7 @@ var AutomaticMessageManager = class extends BaseManager {
|
|
|
2234
2254
|
if (data instanceof AutomaticMessage) this.cache.set(data.id, data);
|
|
2235
2255
|
else this.cache.set(data.id, new AutomaticMessage(data, this));
|
|
2236
2256
|
}
|
|
2257
|
+
this.guild.automatic_messages = this.cache.toArray();
|
|
2237
2258
|
return this.cache;
|
|
2238
2259
|
}
|
|
2239
2260
|
set(data) {
|
|
@@ -2262,6 +2283,10 @@ var AutomaticMessageManager = class extends BaseManager {
|
|
|
2262
2283
|
});
|
|
2263
2284
|
return response;
|
|
2264
2285
|
}
|
|
2286
|
+
toJSON() {
|
|
2287
|
+
[...this.cache.values()].map((m) => console.log(m instanceof AutomaticMessage));
|
|
2288
|
+
return this.cache.toArray();
|
|
2289
|
+
}
|
|
2265
2290
|
};
|
|
2266
2291
|
|
|
2267
2292
|
// src/managers/bet/GuildBetManager.ts
|
|
@@ -2779,15 +2804,14 @@ var GuildTicketManager = class {
|
|
|
2779
2804
|
} else {
|
|
2780
2805
|
categories.push(data);
|
|
2781
2806
|
}
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2807
|
+
return this.guild.update({
|
|
2808
|
+
tickets_configuration: {
|
|
2809
|
+
categories,
|
|
2810
|
+
creationCategory: this.guild.tickets_configuration.creationCategory,
|
|
2811
|
+
deletionCategory: this.guild.tickets_configuration.deletionCategory,
|
|
2812
|
+
rating_channel_id: this.guild.tickets_configuration.rating_channel_id
|
|
2813
|
+
}
|
|
2788
2814
|
});
|
|
2789
|
-
this.guild._updateInternals(response);
|
|
2790
|
-
return response;
|
|
2791
2815
|
}
|
|
2792
2816
|
async deleteTicketCategory(data) {
|
|
2793
2817
|
let categories = this.guild.tickets_configuration.categories;
|
|
@@ -2801,8 +2825,14 @@ var GuildTicketManager = class {
|
|
|
2801
2825
|
url: route,
|
|
2802
2826
|
payload
|
|
2803
2827
|
});
|
|
2804
|
-
this.guild.
|
|
2805
|
-
|
|
2828
|
+
return this.guild.update({
|
|
2829
|
+
tickets_configuration: {
|
|
2830
|
+
categories,
|
|
2831
|
+
creationCategory: this.guild.tickets_configuration.creationCategory,
|
|
2832
|
+
deletionCategory: this.guild.tickets_configuration.deletionCategory,
|
|
2833
|
+
rating_channel_id: this.guild.tickets_configuration.rating_channel_id
|
|
2834
|
+
}
|
|
2835
|
+
});
|
|
2806
2836
|
}
|
|
2807
2837
|
async fetch(options) {
|
|
2808
2838
|
if (options && options.cache) return this.cache;
|
|
@@ -3068,14 +3098,150 @@ var VipMemberManager = class extends BaseManager {
|
|
|
3068
3098
|
}
|
|
3069
3099
|
};
|
|
3070
3100
|
|
|
3101
|
+
// src/structures/tournament/Tournament.ts
|
|
3102
|
+
var _Tournament_instances, updateInternals_fn9;
|
|
3103
|
+
var Tournament = class {
|
|
3104
|
+
constructor(data, manager) {
|
|
3105
|
+
__privateAdd(this, _Tournament_instances);
|
|
3106
|
+
__publicField(this, "_id");
|
|
3107
|
+
__publicField(this, "guild_id");
|
|
3108
|
+
__publicField(this, "type");
|
|
3109
|
+
__publicField(this, "max_teams");
|
|
3110
|
+
__publicField(this, "teams");
|
|
3111
|
+
__publicField(this, "message");
|
|
3112
|
+
__publicField(this, "message_id");
|
|
3113
|
+
__publicField(this, "status");
|
|
3114
|
+
__publicField(this, "createdAt");
|
|
3115
|
+
__publicField(this, "updatedAt");
|
|
3116
|
+
__publicField(this, "guild");
|
|
3117
|
+
__publicField(this, "rest");
|
|
3118
|
+
__publicField(this, "manager");
|
|
3119
|
+
__publicField(this, "data");
|
|
3120
|
+
this.manager = manager;
|
|
3121
|
+
this.guild = manager.guild;
|
|
3122
|
+
this.rest = manager.rest;
|
|
3123
|
+
this.guild_id = data?.guild_id;
|
|
3124
|
+
this.type = data?.type;
|
|
3125
|
+
this.teams = data?.teams;
|
|
3126
|
+
this.message = data?.message;
|
|
3127
|
+
this.message_id = data?.message_id;
|
|
3128
|
+
this.status = data?.status;
|
|
3129
|
+
this.createdAt = data?.createdAt ? new Date(data?.createdAt) : /* @__PURE__ */ new Date();
|
|
3130
|
+
this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
|
|
3131
|
+
this.data = data;
|
|
3132
|
+
}
|
|
3133
|
+
async fetch() {
|
|
3134
|
+
const route = Routes.fields("guilds", this.guild.id, "tournaments", this._id);
|
|
3135
|
+
const response = await this.rest.request({
|
|
3136
|
+
method: "get",
|
|
3137
|
+
url: route
|
|
3138
|
+
});
|
|
3139
|
+
return __privateMethod(this, _Tournament_instances, updateInternals_fn9).call(this, response);
|
|
3140
|
+
}
|
|
3141
|
+
async update(data) {
|
|
3142
|
+
const route = Routes.fields("guilds", this.guild.id, "tournaments", this._id);
|
|
3143
|
+
const response = await this.rest.request({
|
|
3144
|
+
method: "patch",
|
|
3145
|
+
url: route,
|
|
3146
|
+
payload: data
|
|
3147
|
+
});
|
|
3148
|
+
return __privateMethod(this, _Tournament_instances, updateInternals_fn9).call(this, response);
|
|
3149
|
+
}
|
|
3150
|
+
toJSON() {
|
|
3151
|
+
return {
|
|
3152
|
+
guild_id: this.guild_id,
|
|
3153
|
+
type: this.type,
|
|
3154
|
+
max_teams: this.max_teams,
|
|
3155
|
+
teams: this.teams,
|
|
3156
|
+
message: this.message,
|
|
3157
|
+
message_id: this.message_id,
|
|
3158
|
+
status: this.status,
|
|
3159
|
+
createdAt: this.createdAt ? new Date(this?.createdAt) : /* @__PURE__ */ new Date(),
|
|
3160
|
+
updatedAt: this.updatedAt ? new Date(this?.updatedAt) : /* @__PURE__ */ new Date()
|
|
3161
|
+
};
|
|
3162
|
+
}
|
|
3163
|
+
};
|
|
3164
|
+
_Tournament_instances = new WeakSet();
|
|
3165
|
+
updateInternals_fn9 = function(data) {
|
|
3166
|
+
for (let key in data) {
|
|
3167
|
+
if (key === "id" || key === "createdAt") continue;
|
|
3168
|
+
if (key in this) {
|
|
3169
|
+
this[key] = data[key];
|
|
3170
|
+
}
|
|
3171
|
+
}
|
|
3172
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
3173
|
+
this.createdAt = new Date(data.createdAt);
|
|
3174
|
+
this.manager._add(this);
|
|
3175
|
+
return this;
|
|
3176
|
+
};
|
|
3177
|
+
|
|
3178
|
+
// src/managers/tournament/TournamentManager.ts
|
|
3179
|
+
var TournamentManager = class extends BaseManager {
|
|
3180
|
+
constructor(guild) {
|
|
3181
|
+
super(guild);
|
|
3182
|
+
this.guild = guild;
|
|
3183
|
+
this.rest = guild.rest;
|
|
3184
|
+
this.base_url = Routes.guilds.resource(guild.id, "tournaments");
|
|
3185
|
+
this.cache = new Collection();
|
|
3186
|
+
}
|
|
3187
|
+
async fetch(options) {
|
|
3188
|
+
if (options && options.cache) return this.cache;
|
|
3189
|
+
if (options && options.tournamentId) {
|
|
3190
|
+
const response2 = await this.rest.request({
|
|
3191
|
+
method: "GET",
|
|
3192
|
+
url: Routes.fields(this.base_url, options.tournamentId)
|
|
3193
|
+
});
|
|
3194
|
+
const tournament = new Tournament(response2, this);
|
|
3195
|
+
this._add(tournament);
|
|
3196
|
+
return tournament;
|
|
3197
|
+
}
|
|
3198
|
+
const response = await this.rest.request({
|
|
3199
|
+
method: "GET",
|
|
3200
|
+
url: this.base_url
|
|
3201
|
+
});
|
|
3202
|
+
return this.set(response);
|
|
3203
|
+
}
|
|
3204
|
+
set(data) {
|
|
3205
|
+
this.cache.clear();
|
|
3206
|
+
if (Array.isArray(data)) {
|
|
3207
|
+
for (let _m of data) {
|
|
3208
|
+
if (!_m._id) continue;
|
|
3209
|
+
if (_m instanceof Tournament) this.cache.set(_m._id, _m);
|
|
3210
|
+
else this.cache.set(_m._id, new Tournament(_m, this));
|
|
3211
|
+
}
|
|
3212
|
+
} else {
|
|
3213
|
+
if (!data._id) return this.cache;
|
|
3214
|
+
if (data instanceof Tournament) this.cache.set(data._id, data);
|
|
3215
|
+
else this.cache.set(data._id, new Tournament(data, this));
|
|
3216
|
+
}
|
|
3217
|
+
return this.cache;
|
|
3218
|
+
}
|
|
3219
|
+
_add(data) {
|
|
3220
|
+
if (Array.isArray(data)) {
|
|
3221
|
+
for (let _m of data) {
|
|
3222
|
+
if (!_m._id) continue;
|
|
3223
|
+
if (_m instanceof Tournament) this.cache.set(_m._id, _m);
|
|
3224
|
+
else this.cache.set(_m._id, new Tournament(_m, this));
|
|
3225
|
+
}
|
|
3226
|
+
} else {
|
|
3227
|
+
if (!data._id) return this.cache;
|
|
3228
|
+
if (data instanceof Tournament) this.cache.set(data._id, data);
|
|
3229
|
+
else this.cache.set(data._id, new Tournament(data, this));
|
|
3230
|
+
}
|
|
3231
|
+
return this.cache;
|
|
3232
|
+
}
|
|
3233
|
+
};
|
|
3234
|
+
|
|
3071
3235
|
// src/structures/guild/Guild.ts
|
|
3072
|
-
var
|
|
3236
|
+
var _Guild_instances, updateInternals_fn10;
|
|
3237
|
+
var Guild6 = class {
|
|
3073
3238
|
/**
|
|
3074
3239
|
* The guild structure
|
|
3075
3240
|
* @param data The guild's data
|
|
3076
3241
|
* @param rest The rest client
|
|
3077
3242
|
*/
|
|
3078
3243
|
constructor(data, rest) {
|
|
3244
|
+
__privateAdd(this, _Guild_instances);
|
|
3079
3245
|
/** The data of this guild */
|
|
3080
3246
|
__publicField(this, "data");
|
|
3081
3247
|
/** The rest client */
|
|
@@ -3101,6 +3267,7 @@ var Guild5 = class {
|
|
|
3101
3267
|
__publicField(this, "roulette_settings");
|
|
3102
3268
|
/** Guild Prefix */
|
|
3103
3269
|
__publicField(this, "prefix");
|
|
3270
|
+
__publicField(this, "prefixes");
|
|
3104
3271
|
/** Guild Creation Date */
|
|
3105
3272
|
__publicField(this, "createdAt");
|
|
3106
3273
|
/** Guild Updated Date */
|
|
@@ -3120,6 +3287,7 @@ var Guild5 = class {
|
|
|
3120
3287
|
__publicField(this, "mediators");
|
|
3121
3288
|
__publicField(this, "automatic_messages");
|
|
3122
3289
|
__publicField(this, "automaticMessagesManager");
|
|
3290
|
+
__publicField(this, "tournaments");
|
|
3123
3291
|
__publicField(this, "adverts");
|
|
3124
3292
|
__publicField(this, "codes");
|
|
3125
3293
|
__publicField(this, "coin_symbol");
|
|
@@ -3134,6 +3302,7 @@ var Guild5 = class {
|
|
|
3134
3302
|
this.scores = data?.scores;
|
|
3135
3303
|
this.codes = data?.codes;
|
|
3136
3304
|
this.prefix = data?.prefix;
|
|
3305
|
+
this.prefixes = data?.prefixes;
|
|
3137
3306
|
this.status = data?.status;
|
|
3138
3307
|
this.tickets_configuration = data?.tickets_configuration;
|
|
3139
3308
|
this.automatic_messages = data?.automatic_messages;
|
|
@@ -3154,6 +3323,7 @@ var Guild5 = class {
|
|
|
3154
3323
|
this.bets = new GuildBetManager2(this);
|
|
3155
3324
|
this.mediators = new GuildMediatorManager(this);
|
|
3156
3325
|
this.automaticMessagesManager = new AutomaticMessageManager(this);
|
|
3326
|
+
this.tournaments = new TournamentManager(this);
|
|
3157
3327
|
this.adverts = [];
|
|
3158
3328
|
for (let _adv of data?.adverts || []) {
|
|
3159
3329
|
this.adverts.push({
|
|
@@ -3190,7 +3360,7 @@ var Guild5 = class {
|
|
|
3190
3360
|
url: route,
|
|
3191
3361
|
payload: { channels }
|
|
3192
3362
|
});
|
|
3193
|
-
this.
|
|
3363
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3194
3364
|
return response.channels.find((t) => t.type === type);
|
|
3195
3365
|
}
|
|
3196
3366
|
}
|
|
@@ -3205,7 +3375,7 @@ var Guild5 = class {
|
|
|
3205
3375
|
url: route,
|
|
3206
3376
|
payload: { permissions }
|
|
3207
3377
|
});
|
|
3208
|
-
this.
|
|
3378
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3209
3379
|
return response.permissions.find((t) => t.type === type);
|
|
3210
3380
|
}
|
|
3211
3381
|
}
|
|
@@ -3214,26 +3384,26 @@ var Guild5 = class {
|
|
|
3214
3384
|
const route = Routes.guilds.get(this.id);
|
|
3215
3385
|
const payload = { adverts: this.adverts };
|
|
3216
3386
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
3217
|
-
return this.
|
|
3387
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3218
3388
|
}
|
|
3219
3389
|
async removeAdvert(advertId) {
|
|
3220
3390
|
const route = Routes.guilds.get(this.id);
|
|
3221
3391
|
const payload = { adverts: this.adverts.filter((a) => a._id !== advertId) };
|
|
3222
3392
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
3223
|
-
return this.
|
|
3393
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3224
3394
|
}
|
|
3225
3395
|
async createCode(data) {
|
|
3226
3396
|
this.codes.push(data);
|
|
3227
3397
|
const route = Routes.guilds.get(this.id);
|
|
3228
3398
|
const payload = { codes: this.codes };
|
|
3229
3399
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
3230
|
-
return this.
|
|
3400
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3231
3401
|
}
|
|
3232
3402
|
async removeCode(codeId) {
|
|
3233
3403
|
const route = Routes.guilds.get(this.id);
|
|
3234
3404
|
const payload = { codes: this.codes.filter((a) => a._id !== codeId) };
|
|
3235
3405
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
3236
|
-
return this.
|
|
3406
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3237
3407
|
}
|
|
3238
3408
|
async addIdToChannel(type, id) {
|
|
3239
3409
|
const channel = this.channels.find((c) => c.type === type);
|
|
@@ -3252,7 +3422,7 @@ var Guild5 = class {
|
|
|
3252
3422
|
url: route,
|
|
3253
3423
|
payload
|
|
3254
3424
|
});
|
|
3255
|
-
return this.
|
|
3425
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3256
3426
|
}
|
|
3257
3427
|
async setChannelIds(type, ...ids) {
|
|
3258
3428
|
const channel = this.channels.find((c) => c.type === type);
|
|
@@ -3271,7 +3441,7 @@ var Guild5 = class {
|
|
|
3271
3441
|
url: route,
|
|
3272
3442
|
payload
|
|
3273
3443
|
});
|
|
3274
|
-
return this.
|
|
3444
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3275
3445
|
}
|
|
3276
3446
|
async removeIdInChannel(type, id) {
|
|
3277
3447
|
const chIndex = this.channels.findIndex((c) => c.type === type);
|
|
@@ -3293,7 +3463,7 @@ var Guild5 = class {
|
|
|
3293
3463
|
url: route,
|
|
3294
3464
|
payload
|
|
3295
3465
|
});
|
|
3296
|
-
return this.
|
|
3466
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3297
3467
|
}
|
|
3298
3468
|
async updateRouletteSettings(data) {
|
|
3299
3469
|
const _data = {
|
|
@@ -3350,58 +3520,21 @@ var Guild5 = class {
|
|
|
3350
3520
|
this.logEntries.fetch(),
|
|
3351
3521
|
this.betusers.fetch(),
|
|
3352
3522
|
this.bets.fetch(),
|
|
3353
|
-
this.mediators.fetch()
|
|
3523
|
+
this.mediators.fetch(),
|
|
3524
|
+
this.tournaments.fetch()
|
|
3354
3525
|
]);
|
|
3355
3526
|
return this;
|
|
3356
3527
|
}
|
|
3357
|
-
_updateInternals(data) {
|
|
3358
|
-
for (let key in data) {
|
|
3359
|
-
if (key === "id" || key === "createdAt") continue;
|
|
3360
|
-
if (key in this) {
|
|
3361
|
-
this[key] = data[key];
|
|
3362
|
-
}
|
|
3363
|
-
if (key === "adverts") {
|
|
3364
|
-
this.adverts = [];
|
|
3365
|
-
for (let _adv of data.adverts) {
|
|
3366
|
-
this.adverts.push({
|
|
3367
|
-
_id: _adv._id,
|
|
3368
|
-
admin_id: _adv.admin_id,
|
|
3369
|
-
points_to_remove: _adv.points_to_remove,
|
|
3370
|
-
role_id: _adv.role_id,
|
|
3371
|
-
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
3372
|
-
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
3373
|
-
});
|
|
3374
|
-
}
|
|
3375
|
-
}
|
|
3376
|
-
if (key === "code") {
|
|
3377
|
-
this.codes = [];
|
|
3378
|
-
for (let _adv of data.codes) {
|
|
3379
|
-
this.codes.push({
|
|
3380
|
-
_id: _adv._id,
|
|
3381
|
-
admin_id: _adv.admin_id,
|
|
3382
|
-
type: _adv.type,
|
|
3383
|
-
add: _adv.add,
|
|
3384
|
-
code: _adv.code,
|
|
3385
|
-
expire: _adv.expire ? new Date(_adv.expire) : /* @__PURE__ */ new Date(),
|
|
3386
|
-
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
3387
|
-
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
3388
|
-
});
|
|
3389
|
-
}
|
|
3390
|
-
}
|
|
3391
|
-
}
|
|
3392
|
-
this.automaticMessagesManager.set(this.automatic_messages);
|
|
3393
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
3394
|
-
this.rest.guilds.cache.set(this.id, this);
|
|
3395
|
-
this.rest.emit("guildUpdate", this);
|
|
3396
|
-
return this;
|
|
3397
|
-
}
|
|
3398
3528
|
async fetch() {
|
|
3399
3529
|
const route = Routes.guilds.get(this.id);
|
|
3400
3530
|
const response = await this.rest.request({
|
|
3401
3531
|
method: "get",
|
|
3402
3532
|
url: route
|
|
3403
3533
|
});
|
|
3404
|
-
return this.
|
|
3534
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3535
|
+
}
|
|
3536
|
+
async reset() {
|
|
3537
|
+
return this.update({ reset: true });
|
|
3405
3538
|
}
|
|
3406
3539
|
async update(data) {
|
|
3407
3540
|
const route = Routes.guilds.get(this.id);
|
|
@@ -3410,16 +3543,7 @@ var Guild5 = class {
|
|
|
3410
3543
|
url: route,
|
|
3411
3544
|
payload: data
|
|
3412
3545
|
});
|
|
3413
|
-
|
|
3414
|
-
if (k === "id" || k == "createdAt") continue;
|
|
3415
|
-
if (k in this) {
|
|
3416
|
-
this[k] = response[k];
|
|
3417
|
-
}
|
|
3418
|
-
}
|
|
3419
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
3420
|
-
this.rest.guilds.cache.set(this.id, this);
|
|
3421
|
-
this.rest.emit("guildUpdate", this);
|
|
3422
|
-
return this;
|
|
3546
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3423
3547
|
}
|
|
3424
3548
|
async setStatus(key, status) {
|
|
3425
3549
|
Assertion.assertString(key);
|
|
@@ -3444,16 +3568,27 @@ var Guild5 = class {
|
|
|
3444
3568
|
await this.update({ prices: this.prices });
|
|
3445
3569
|
return this;
|
|
3446
3570
|
}
|
|
3447
|
-
async
|
|
3448
|
-
|
|
3449
|
-
const
|
|
3450
|
-
const payload = { set:
|
|
3571
|
+
async addPrefix(prefixes) {
|
|
3572
|
+
const route = Routes.fields(Routes.guilds.resource(this.id, "prefixes"));
|
|
3573
|
+
const _p = Array.isArray(prefixes) ? prefixes : [prefixes];
|
|
3574
|
+
const payload = { set: [.../* @__PURE__ */ new Set([...this.prefixes, ..._p])] };
|
|
3575
|
+
const response = await this.rest.request({
|
|
3576
|
+
method: "PATCH",
|
|
3577
|
+
url: route,
|
|
3578
|
+
payload
|
|
3579
|
+
});
|
|
3580
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3581
|
+
return this;
|
|
3582
|
+
}
|
|
3583
|
+
async setPrefix(prefixes) {
|
|
3584
|
+
const route = Routes.fields(Routes.guilds.resource(this.id, "prefixes"));
|
|
3585
|
+
const payload = { set: Array.isArray(prefixes) ? prefixes : [prefixes] };
|
|
3451
3586
|
const response = await this.rest.request({
|
|
3452
3587
|
method: "PATCH",
|
|
3453
3588
|
url: route,
|
|
3454
3589
|
payload
|
|
3455
3590
|
});
|
|
3456
|
-
this.
|
|
3591
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3457
3592
|
return this;
|
|
3458
3593
|
}
|
|
3459
3594
|
async toggleDailyCategory(category) {
|
|
@@ -3473,7 +3608,7 @@ var Guild5 = class {
|
|
|
3473
3608
|
url: route,
|
|
3474
3609
|
payload
|
|
3475
3610
|
});
|
|
3476
|
-
this.
|
|
3611
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3477
3612
|
return this;
|
|
3478
3613
|
}
|
|
3479
3614
|
async setScores(name, amount) {
|
|
@@ -3486,7 +3621,7 @@ var Guild5 = class {
|
|
|
3486
3621
|
url: route,
|
|
3487
3622
|
payload
|
|
3488
3623
|
});
|
|
3489
|
-
this.
|
|
3624
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3490
3625
|
return this;
|
|
3491
3626
|
}
|
|
3492
3627
|
async toggleMode(mode) {
|
|
@@ -3511,10 +3646,52 @@ var Guild5 = class {
|
|
|
3511
3646
|
url: route,
|
|
3512
3647
|
payload
|
|
3513
3648
|
});
|
|
3514
|
-
this.
|
|
3649
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3515
3650
|
return this;
|
|
3516
3651
|
}
|
|
3517
3652
|
};
|
|
3653
|
+
_Guild_instances = new WeakSet();
|
|
3654
|
+
updateInternals_fn10 = function(data) {
|
|
3655
|
+
for (let key in data) {
|
|
3656
|
+
if (key === "id" || key === "createdAt") continue;
|
|
3657
|
+
if (key in this) {
|
|
3658
|
+
this[key] = data[key];
|
|
3659
|
+
}
|
|
3660
|
+
if (key === "adverts") {
|
|
3661
|
+
this.adverts = [];
|
|
3662
|
+
for (let _adv of data.adverts) {
|
|
3663
|
+
this.adverts.push({
|
|
3664
|
+
_id: _adv._id,
|
|
3665
|
+
admin_id: _adv.admin_id,
|
|
3666
|
+
points_to_remove: _adv.points_to_remove,
|
|
3667
|
+
role_id: _adv.role_id,
|
|
3668
|
+
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
3669
|
+
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
3670
|
+
});
|
|
3671
|
+
}
|
|
3672
|
+
}
|
|
3673
|
+
if (key === "code") {
|
|
3674
|
+
this.codes = [];
|
|
3675
|
+
for (let _adv of data.codes) {
|
|
3676
|
+
this.codes.push({
|
|
3677
|
+
_id: _adv._id,
|
|
3678
|
+
admin_id: _adv.admin_id,
|
|
3679
|
+
type: _adv.type,
|
|
3680
|
+
add: _adv.add,
|
|
3681
|
+
code: _adv.code,
|
|
3682
|
+
expire: _adv.expire ? new Date(_adv.expire) : /* @__PURE__ */ new Date(),
|
|
3683
|
+
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
3684
|
+
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
3685
|
+
});
|
|
3686
|
+
}
|
|
3687
|
+
}
|
|
3688
|
+
}
|
|
3689
|
+
this.automaticMessagesManager.set(this.automatic_messages);
|
|
3690
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
3691
|
+
this.rest.guilds.cache.set(this.id, this);
|
|
3692
|
+
this.rest.emit("guildUpdate", this);
|
|
3693
|
+
return this;
|
|
3694
|
+
};
|
|
3518
3695
|
|
|
3519
3696
|
// src/managers/guild/GuildManager.ts
|
|
3520
3697
|
var GuildManager = class {
|
|
@@ -3544,7 +3721,7 @@ var GuildManager = class {
|
|
|
3544
3721
|
method: "get",
|
|
3545
3722
|
url: route2
|
|
3546
3723
|
});
|
|
3547
|
-
const guild = new
|
|
3724
|
+
const guild = new Guild6(response2, this.rest);
|
|
3548
3725
|
await guild._start().then((g) => {
|
|
3549
3726
|
this.cache.set(g.id, g);
|
|
3550
3727
|
});
|
|
@@ -3558,13 +3735,22 @@ var GuildManager = class {
|
|
|
3558
3735
|
});
|
|
3559
3736
|
for (let _guild of response) {
|
|
3560
3737
|
if (!_guild.id) continue;
|
|
3561
|
-
const guild = new
|
|
3738
|
+
const guild = new Guild6(_guild, this.rest);
|
|
3562
3739
|
await guild._start().then((g) => {
|
|
3563
3740
|
this.cache.set(g.id, g);
|
|
3564
3741
|
});
|
|
3565
3742
|
}
|
|
3566
3743
|
return this.cache;
|
|
3567
3744
|
}
|
|
3745
|
+
async reset(guildId) {
|
|
3746
|
+
if (guildId) {
|
|
3747
|
+
return await this.cache.get(guildId).reset();
|
|
3748
|
+
}
|
|
3749
|
+
for (let [_, g] of this.cache) {
|
|
3750
|
+
await g.reset();
|
|
3751
|
+
}
|
|
3752
|
+
return this.cache;
|
|
3753
|
+
}
|
|
3568
3754
|
async delete(options) {
|
|
3569
3755
|
if (options && options.guildId) {
|
|
3570
3756
|
Assertion.assertString(options.guildId);
|
|
@@ -3591,12 +3777,12 @@ var GuildManager = class {
|
|
|
3591
3777
|
if (!data) return this.cache;
|
|
3592
3778
|
if (Array.isArray(data)) {
|
|
3593
3779
|
for (let _guild of data) {
|
|
3594
|
-
const guild = new
|
|
3780
|
+
const guild = new Guild6(_guild, this.rest);
|
|
3595
3781
|
this.cache.set(guild.id, guild);
|
|
3596
3782
|
}
|
|
3597
3783
|
return this.cache;
|
|
3598
3784
|
} else {
|
|
3599
|
-
const guild = new
|
|
3785
|
+
const guild = new Guild6(data, this.rest);
|
|
3600
3786
|
this.cache.set(guild.id, guild);
|
|
3601
3787
|
return guild;
|
|
3602
3788
|
}
|