@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/index.mjs
CHANGED
|
@@ -413,7 +413,7 @@ var APIEndpoints = {
|
|
|
413
413
|
// src/rest/Routes.ts
|
|
414
414
|
var Routes = {
|
|
415
415
|
//base: "http://localhost:80/api/v1",
|
|
416
|
-
base: "https://
|
|
416
|
+
base: "https://duqueapi.shardweb.app/api/v1",
|
|
417
417
|
field: (field) => `/${field}`,
|
|
418
418
|
fields: (...fields) => `${fields.join("/")}`,
|
|
419
419
|
guilds: {
|
|
@@ -665,6 +665,9 @@ var BaseManager = class {
|
|
|
665
665
|
this.rest = guild.rest;
|
|
666
666
|
this.cache = new Collection();
|
|
667
667
|
}
|
|
668
|
+
toJSON() {
|
|
669
|
+
return [...this.cache.values()].map((m) => m && "toJSON" in m && typeof m.toJSON === "function" ? m.toJSON() : m);
|
|
670
|
+
}
|
|
668
671
|
};
|
|
669
672
|
|
|
670
673
|
// src/managers/player/PlayerManager.ts
|
|
@@ -736,8 +739,10 @@ var PlayerManager = class extends Collection {
|
|
|
736
739
|
};
|
|
737
740
|
|
|
738
741
|
// src/structures/bet/GuildBet.ts
|
|
742
|
+
var _GuildBet_instances, updateInternals_fn;
|
|
739
743
|
var GuildBet = class {
|
|
740
744
|
constructor(data, manager) {
|
|
745
|
+
__privateAdd(this, _GuildBet_instances);
|
|
741
746
|
/** The bet's type */
|
|
742
747
|
__publicField(this, "type");
|
|
743
748
|
/** The bet's mode */
|
|
@@ -816,7 +821,7 @@ var GuildBet = class {
|
|
|
816
821
|
async fetch() {
|
|
817
822
|
const route = Routes.guilds.bets.get(this.guild.id, this._id);
|
|
818
823
|
const response = await this.rest.request({ url: route, method: "GET" });
|
|
819
|
-
return this.
|
|
824
|
+
return __privateMethod(this, _GuildBet_instances, updateInternals_fn).call(this, response);
|
|
820
825
|
}
|
|
821
826
|
async addPlayer(player, queue_type) {
|
|
822
827
|
if (this.players.length === 2) return this;
|
|
@@ -853,7 +858,7 @@ var GuildBet = class {
|
|
|
853
858
|
const payload = data;
|
|
854
859
|
const route = Routes.guilds.bets.update(this.guild.id, this._id);
|
|
855
860
|
const response = await this.rest.request({ method: "patch", url: route, payload });
|
|
856
|
-
return this.
|
|
861
|
+
return __privateMethod(this, _GuildBet_instances, updateInternals_fn).call(this, response);
|
|
857
862
|
}
|
|
858
863
|
async delete() {
|
|
859
864
|
const route = Routes.guilds.bets.delete(this.manager.guild.id, this._id);
|
|
@@ -865,33 +870,6 @@ var GuildBet = class {
|
|
|
865
870
|
this.manager.cache.delete(this._id);
|
|
866
871
|
return response;
|
|
867
872
|
}
|
|
868
|
-
_updateInternals(data) {
|
|
869
|
-
for (let key in data) {
|
|
870
|
-
if (key === "_id" || key === "createdAt") continue;
|
|
871
|
-
if (key === "messages") {
|
|
872
|
-
this.messages.set(data[key]);
|
|
873
|
-
continue;
|
|
874
|
-
}
|
|
875
|
-
if (key === "players") {
|
|
876
|
-
this.players._set(data[key]);
|
|
877
|
-
continue;
|
|
878
|
-
}
|
|
879
|
-
if (key in this) {
|
|
880
|
-
this[key] = data[key];
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
if (data?.messages?.length !== 0) {
|
|
884
|
-
if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
|
|
885
|
-
else {
|
|
886
|
-
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
887
|
-
this.messages.set(data.messages);
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
891
|
-
this.createdAt = new Date(data.createdAt);
|
|
892
|
-
this.manager.set(this);
|
|
893
|
-
return this;
|
|
894
|
-
}
|
|
895
873
|
toJSON() {
|
|
896
874
|
let json = {};
|
|
897
875
|
for (const [key, value] of Object.entries(this)) {
|
|
@@ -908,9 +886,38 @@ var GuildBet = class {
|
|
|
908
886
|
};
|
|
909
887
|
}
|
|
910
888
|
};
|
|
889
|
+
_GuildBet_instances = new WeakSet();
|
|
890
|
+
updateInternals_fn = function(data) {
|
|
891
|
+
for (let key in data) {
|
|
892
|
+
if (key === "_id" || key === "createdAt") continue;
|
|
893
|
+
if (key === "messages") {
|
|
894
|
+
this.messages.set(data[key]);
|
|
895
|
+
continue;
|
|
896
|
+
}
|
|
897
|
+
if (key === "players") {
|
|
898
|
+
this.players._set(data[key]);
|
|
899
|
+
continue;
|
|
900
|
+
}
|
|
901
|
+
if (key in this) {
|
|
902
|
+
this[key] = data[key];
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
if (data?.messages?.length !== 0) {
|
|
906
|
+
if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
|
|
907
|
+
else {
|
|
908
|
+
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
909
|
+
this.messages.set(data.messages);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
913
|
+
this.createdAt = new Date(data.createdAt);
|
|
914
|
+
this.manager.set(this);
|
|
915
|
+
return this;
|
|
916
|
+
};
|
|
911
917
|
|
|
912
918
|
// src/structures/betuser/GuildBetUser.ts
|
|
913
|
-
var
|
|
919
|
+
var _GuildBetUser_instances, updateInternals_fn2;
|
|
920
|
+
var _GuildBetUser = class _GuildBetUser {
|
|
914
921
|
/**
|
|
915
922
|
* Bet user
|
|
916
923
|
* @param data The user's data
|
|
@@ -918,6 +925,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
918
925
|
* @param rest The rest client
|
|
919
926
|
*/
|
|
920
927
|
constructor(data, manager) {
|
|
928
|
+
__privateAdd(this, _GuildBetUser_instances);
|
|
921
929
|
/** User daily */
|
|
922
930
|
__publicField(this, "daily");
|
|
923
931
|
__publicField(this, "profile");
|
|
@@ -1012,7 +1020,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
1012
1020
|
url: route,
|
|
1013
1021
|
payload
|
|
1014
1022
|
});
|
|
1015
|
-
return this.
|
|
1023
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn2).call(this, response);
|
|
1016
1024
|
}
|
|
1017
1025
|
async updateProfile(data) {
|
|
1018
1026
|
const _data = {
|
|
@@ -1032,20 +1040,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
1032
1040
|
url: route,
|
|
1033
1041
|
payload: _data
|
|
1034
1042
|
});
|
|
1035
|
-
return this.
|
|
1036
|
-
}
|
|
1037
|
-
_updateInternals(data) {
|
|
1038
|
-
for (let key in data) {
|
|
1039
|
-
if (key === "id" || key === "createdAt") continue;
|
|
1040
|
-
if (key in this) {
|
|
1041
|
-
this[key] = data[key];
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1045
|
-
this.createdAt = new Date(data.createdAt);
|
|
1046
|
-
this.manager.set(this);
|
|
1047
|
-
this.rest.emit("betuserUpdate", this);
|
|
1048
|
-
return this;
|
|
1043
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn2).call(this, response);
|
|
1049
1044
|
}
|
|
1050
1045
|
/**
|
|
1051
1046
|
* Update certain property
|
|
@@ -1082,7 +1077,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
1082
1077
|
url: route,
|
|
1083
1078
|
payload
|
|
1084
1079
|
});
|
|
1085
|
-
return this.
|
|
1080
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn2).call(this, response);
|
|
1086
1081
|
}
|
|
1087
1082
|
async _update(data) {
|
|
1088
1083
|
const route = Routes.guilds.betusers.get(this.manager.guild.id, this.id);
|
|
@@ -1092,7 +1087,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
1092
1087
|
url: route,
|
|
1093
1088
|
payload
|
|
1094
1089
|
});
|
|
1095
|
-
return this.
|
|
1090
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn2).call(this, response);
|
|
1096
1091
|
}
|
|
1097
1092
|
async delete() {
|
|
1098
1093
|
const route = Routes.guilds.betusers.delete(this.manager.guild.id, this.id);
|
|
@@ -1116,10 +1111,27 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
1116
1111
|
return json;
|
|
1117
1112
|
}
|
|
1118
1113
|
};
|
|
1114
|
+
_GuildBetUser_instances = new WeakSet();
|
|
1115
|
+
updateInternals_fn2 = function(data) {
|
|
1116
|
+
for (let key in data) {
|
|
1117
|
+
if (key === "id" || key === "createdAt") continue;
|
|
1118
|
+
if (key in this) {
|
|
1119
|
+
this[key] = data[key];
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1123
|
+
this.createdAt = new Date(data.createdAt);
|
|
1124
|
+
this.manager.set(this);
|
|
1125
|
+
this.rest.emit("betuserUpdate", this);
|
|
1126
|
+
return this;
|
|
1127
|
+
};
|
|
1128
|
+
var GuildBetUser = _GuildBetUser;
|
|
1119
1129
|
|
|
1120
1130
|
// src/structures/logentry/LogEntry.ts
|
|
1131
|
+
var _LogEntry_instances, updateInternals_fn3;
|
|
1121
1132
|
var LogEntry = class {
|
|
1122
1133
|
constructor(data, manager) {
|
|
1134
|
+
__privateAdd(this, _LogEntry_instances);
|
|
1123
1135
|
__publicField(this, "_id");
|
|
1124
1136
|
__publicField(this, "guild_id");
|
|
1125
1137
|
__publicField(this, "user_id");
|
|
@@ -1155,9 +1167,9 @@ var LogEntry = class {
|
|
|
1155
1167
|
this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
|
|
1156
1168
|
}
|
|
1157
1169
|
async fetch() {
|
|
1158
|
-
const route = Routes.guilds
|
|
1170
|
+
const route = Routes.fields("guilds", this.guild.id, "logentries", this._id);
|
|
1159
1171
|
const response = await this.rest.request({ url: route, method: "GET" });
|
|
1160
|
-
return this.
|
|
1172
|
+
return __privateMethod(this, _LogEntry_instances, updateInternals_fn3).call(this, response);
|
|
1161
1173
|
}
|
|
1162
1174
|
toJSON() {
|
|
1163
1175
|
const json = {};
|
|
@@ -1168,21 +1180,23 @@ var LogEntry = class {
|
|
|
1168
1180
|
}
|
|
1169
1181
|
return json;
|
|
1170
1182
|
}
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1183
|
+
};
|
|
1184
|
+
_LogEntry_instances = new WeakSet();
|
|
1185
|
+
updateInternals_fn3 = function(data) {
|
|
1186
|
+
for (let key in data) {
|
|
1187
|
+
if (key === "id" || key === "createdAt") continue;
|
|
1188
|
+
if (key in this) {
|
|
1189
|
+
this[key] = data[key];
|
|
1177
1190
|
}
|
|
1178
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1179
|
-
this.manager.set(this);
|
|
1180
|
-
return this;
|
|
1181
1191
|
}
|
|
1192
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1193
|
+
this.manager.set(this);
|
|
1194
|
+
return this;
|
|
1182
1195
|
};
|
|
1183
1196
|
|
|
1184
1197
|
// src/structures/match/GuildMatch.ts
|
|
1185
|
-
var
|
|
1198
|
+
var _GuildMatch_instances, updateInternals_fn4;
|
|
1199
|
+
var _GuildMatch = class _GuildMatch {
|
|
1186
1200
|
/**
|
|
1187
1201
|
* GuildMatch match
|
|
1188
1202
|
* @param data The match's data
|
|
@@ -1190,6 +1204,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1190
1204
|
* @param rest The rest client
|
|
1191
1205
|
*/
|
|
1192
1206
|
constructor(data, manager) {
|
|
1207
|
+
__privateAdd(this, _GuildMatch_instances);
|
|
1193
1208
|
__publicField(this, "_id");
|
|
1194
1209
|
__publicField(this, "selections");
|
|
1195
1210
|
/** Match's type */
|
|
@@ -1273,7 +1288,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1273
1288
|
method: "get",
|
|
1274
1289
|
url: route
|
|
1275
1290
|
});
|
|
1276
|
-
return await this.
|
|
1291
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1277
1292
|
}
|
|
1278
1293
|
async addConfirmed(type, id) {
|
|
1279
1294
|
const confirmed = this.confirmed.find((c) => c.type === type);
|
|
@@ -1295,7 +1310,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1295
1310
|
url: route,
|
|
1296
1311
|
payload: set
|
|
1297
1312
|
});
|
|
1298
|
-
return await this.
|
|
1313
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1299
1314
|
}
|
|
1300
1315
|
async setStatus(status) {
|
|
1301
1316
|
Assertion.assertString(status);
|
|
@@ -1306,7 +1321,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1306
1321
|
url: route,
|
|
1307
1322
|
payload
|
|
1308
1323
|
});
|
|
1309
|
-
return await this.
|
|
1324
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1310
1325
|
}
|
|
1311
1326
|
async setWinners(players) {
|
|
1312
1327
|
if (!Array.isArray(players)) players = [players];
|
|
@@ -1317,7 +1332,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1317
1332
|
url: route,
|
|
1318
1333
|
payload
|
|
1319
1334
|
});
|
|
1320
|
-
return await this.
|
|
1335
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1321
1336
|
}
|
|
1322
1337
|
async setLoser(players) {
|
|
1323
1338
|
if (!Array.isArray(players)) players = [players];
|
|
@@ -1328,7 +1343,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1328
1343
|
url: route,
|
|
1329
1344
|
payload
|
|
1330
1345
|
});
|
|
1331
|
-
return await this.
|
|
1346
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1332
1347
|
}
|
|
1333
1348
|
async setMvps(...usersId) {
|
|
1334
1349
|
const payload = { set: usersId };
|
|
@@ -1338,7 +1353,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1338
1353
|
url: route,
|
|
1339
1354
|
payload
|
|
1340
1355
|
});
|
|
1341
|
-
return await this.
|
|
1356
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1342
1357
|
}
|
|
1343
1358
|
async setRoomCreatorId(userId) {
|
|
1344
1359
|
Assertion.assertString(userId);
|
|
@@ -1349,7 +1364,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1349
1364
|
url: route,
|
|
1350
1365
|
payload
|
|
1351
1366
|
});
|
|
1352
|
-
return await this.
|
|
1367
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1353
1368
|
}
|
|
1354
1369
|
async setRoomAdminId(userId) {
|
|
1355
1370
|
Assertion.assertString(userId);
|
|
@@ -1360,7 +1375,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1360
1375
|
url: route,
|
|
1361
1376
|
payload
|
|
1362
1377
|
});
|
|
1363
|
-
return await this.
|
|
1378
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1364
1379
|
}
|
|
1365
1380
|
async kick(player) {
|
|
1366
1381
|
this.players = this.players.filter((p) => p.id !== player.id);
|
|
@@ -1384,7 +1399,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1384
1399
|
payload: data
|
|
1385
1400
|
});
|
|
1386
1401
|
this.rest.emit("matchUpdate", this, new _GuildMatch(response, this.manager));
|
|
1387
|
-
return await this.
|
|
1402
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1388
1403
|
}
|
|
1389
1404
|
async delete() {
|
|
1390
1405
|
const route = Routes.guilds.matches.resource(this.guild.id, this._id);
|
|
@@ -1410,35 +1425,38 @@ var GuildMatch = class _GuildMatch {
|
|
|
1410
1425
|
messages: this?.messages instanceof MessagesManager ? this.messages?.cache?.toArray() : []
|
|
1411
1426
|
};
|
|
1412
1427
|
}
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
this.bet = this.guild.bets.set(data.bet);
|
|
1422
|
-
}
|
|
1428
|
+
};
|
|
1429
|
+
_GuildMatch_instances = new WeakSet();
|
|
1430
|
+
updateInternals_fn4 = async function(data) {
|
|
1431
|
+
if (!data) return;
|
|
1432
|
+
for (let key in data) {
|
|
1433
|
+
if (key === "id" || key === "createdAt" || key === "messages") continue;
|
|
1434
|
+
if (key in this) {
|
|
1435
|
+
this[key] = data[key];
|
|
1423
1436
|
}
|
|
1424
|
-
if (
|
|
1425
|
-
|
|
1426
|
-
else {
|
|
1427
|
-
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
1428
|
-
this.messages.set(data.messages);
|
|
1429
|
-
}
|
|
1437
|
+
if (key === "bet") {
|
|
1438
|
+
this.bet = this.guild.bets.set(data.bet);
|
|
1430
1439
|
}
|
|
1431
|
-
|
|
1432
|
-
|
|
1440
|
+
}
|
|
1441
|
+
if (data?.messages?.length !== 0) {
|
|
1442
|
+
if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
|
|
1443
|
+
else {
|
|
1444
|
+
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
1445
|
+
this.messages.set(data.messages);
|
|
1433
1446
|
}
|
|
1434
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1435
|
-
this.manager.set(this);
|
|
1436
|
-
return this;
|
|
1437
1447
|
}
|
|
1448
|
+
if (!(this.bet instanceof GuildBet) && data?.bet) {
|
|
1449
|
+
this.bet = this.guild.bets.cache.get(data._id) ?? await this.guild.bets.fetch({ betId: data?.bet?._id });
|
|
1450
|
+
}
|
|
1451
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1452
|
+
this.manager.set(this);
|
|
1453
|
+
return this;
|
|
1438
1454
|
};
|
|
1455
|
+
var GuildMatch = _GuildMatch;
|
|
1439
1456
|
|
|
1440
1457
|
// src/structures/mediator/GuildMediator.ts
|
|
1441
|
-
var
|
|
1458
|
+
var _GuildMediator_instances, updateInternals_fn5;
|
|
1459
|
+
var _GuildMediator = class _GuildMediator {
|
|
1442
1460
|
/**
|
|
1443
1461
|
* Bet user
|
|
1444
1462
|
* @param data The user's data
|
|
@@ -1446,6 +1464,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1446
1464
|
* @param rest The rest client
|
|
1447
1465
|
*/
|
|
1448
1466
|
constructor(data, manager) {
|
|
1467
|
+
__privateAdd(this, _GuildMediator_instances);
|
|
1449
1468
|
/** User's name */
|
|
1450
1469
|
__publicField(this, "id");
|
|
1451
1470
|
__publicField(this, "guild_id");
|
|
@@ -1504,19 +1523,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1504
1523
|
url: route,
|
|
1505
1524
|
payload
|
|
1506
1525
|
});
|
|
1507
|
-
return this.
|
|
1508
|
-
}
|
|
1509
|
-
_updateInternals(data) {
|
|
1510
|
-
for (let key in data) {
|
|
1511
|
-
if (key === "id" || key === "createdAt") continue;
|
|
1512
|
-
if (key in this) {
|
|
1513
|
-
this[key] = data[key];
|
|
1514
|
-
}
|
|
1515
|
-
}
|
|
1516
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1517
|
-
this.createdAt = new Date(data.createdAt);
|
|
1518
|
-
this.manager.set(this);
|
|
1519
|
-
return this;
|
|
1526
|
+
return __privateMethod(this, _GuildMediator_instances, updateInternals_fn5).call(this, response);
|
|
1520
1527
|
}
|
|
1521
1528
|
/**
|
|
1522
1529
|
* Update certain property
|
|
@@ -1531,7 +1538,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1531
1538
|
url: route,
|
|
1532
1539
|
payload
|
|
1533
1540
|
});
|
|
1534
|
-
return this.
|
|
1541
|
+
return __privateMethod(this, _GuildMediator_instances, updateInternals_fn5).call(this, response);
|
|
1535
1542
|
}
|
|
1536
1543
|
async setPaymentlink(type, link) {
|
|
1537
1544
|
const route = Routes.guilds.mediators.get(this.manager.guild.id, this.id);
|
|
@@ -1541,7 +1548,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1541
1548
|
url: route,
|
|
1542
1549
|
payload
|
|
1543
1550
|
});
|
|
1544
|
-
return this.
|
|
1551
|
+
return __privateMethod(this, _GuildMediator_instances, updateInternals_fn5).call(this, response);
|
|
1545
1552
|
}
|
|
1546
1553
|
async delete() {
|
|
1547
1554
|
const route = Routes.guilds.mediators.delete(this.manager.guild.id, this.id);
|
|
@@ -1564,9 +1571,24 @@ var GuildMediator = class _GuildMediator {
|
|
|
1564
1571
|
return json;
|
|
1565
1572
|
}
|
|
1566
1573
|
};
|
|
1574
|
+
_GuildMediator_instances = new WeakSet();
|
|
1575
|
+
updateInternals_fn5 = function(data) {
|
|
1576
|
+
for (let key in data) {
|
|
1577
|
+
if (key === "id" || key === "createdAt") continue;
|
|
1578
|
+
if (key in this) {
|
|
1579
|
+
this[key] = data[key];
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1583
|
+
this.createdAt = new Date(data.createdAt);
|
|
1584
|
+
this.manager.set(this);
|
|
1585
|
+
return this;
|
|
1586
|
+
};
|
|
1587
|
+
var GuildMediator = _GuildMediator;
|
|
1567
1588
|
|
|
1568
1589
|
// src/structures/user/GuildUser.ts
|
|
1569
|
-
var
|
|
1590
|
+
var _GuildUser_instances, updateInternals_fn6;
|
|
1591
|
+
var _GuildUser = class _GuildUser {
|
|
1570
1592
|
/**
|
|
1571
1593
|
* Bet user
|
|
1572
1594
|
* @param data The user's data
|
|
@@ -1574,6 +1596,7 @@ var GuildUser = class _GuildUser {
|
|
|
1574
1596
|
* @param rest The rest client
|
|
1575
1597
|
*/
|
|
1576
1598
|
constructor(data, manager) {
|
|
1599
|
+
__privateAdd(this, _GuildUser_instances);
|
|
1577
1600
|
/** User's id */
|
|
1578
1601
|
__publicField(this, "id");
|
|
1579
1602
|
__publicField(this, "guild_id");
|
|
@@ -1686,7 +1709,7 @@ var GuildUser = class _GuildUser {
|
|
|
1686
1709
|
url: route,
|
|
1687
1710
|
payload
|
|
1688
1711
|
});
|
|
1689
|
-
this.
|
|
1712
|
+
__privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1690
1713
|
return this;
|
|
1691
1714
|
}
|
|
1692
1715
|
async updateProfile(data) {
|
|
@@ -1707,43 +1730,14 @@ var GuildUser = class _GuildUser {
|
|
|
1707
1730
|
url: route,
|
|
1708
1731
|
payload: _data
|
|
1709
1732
|
});
|
|
1710
|
-
this.
|
|
1711
|
-
return this;
|
|
1712
|
-
}
|
|
1713
|
-
_updateInternals(data) {
|
|
1714
|
-
for (let key in data) {
|
|
1715
|
-
if (key === "id" || key === "createdAt") continue;
|
|
1716
|
-
if (key in this) {
|
|
1717
|
-
this[key] = data[key];
|
|
1718
|
-
}
|
|
1719
|
-
if (key === "adverts") {
|
|
1720
|
-
this.adverts = [];
|
|
1721
|
-
for (let _adv of data.adverts) {
|
|
1722
|
-
this.adverts.push({
|
|
1723
|
-
_id: _adv._id,
|
|
1724
|
-
admin_id: _adv.admin_id,
|
|
1725
|
-
role_id: _adv.role_id,
|
|
1726
|
-
reason: _adv.reason,
|
|
1727
|
-
points_removed: _adv.points_removed,
|
|
1728
|
-
proof: _adv.proof,
|
|
1729
|
-
proof_ext: _adv.proof_ext,
|
|
1730
|
-
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
1731
|
-
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
1732
|
-
});
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
}
|
|
1736
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1737
|
-
this.createdAt = new Date(data.createdAt);
|
|
1738
|
-
this.manager.set(this);
|
|
1739
|
-
this.rest.emit("userUpdate", this);
|
|
1733
|
+
__privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1740
1734
|
return this;
|
|
1741
1735
|
}
|
|
1742
1736
|
async addAdvert(data) {
|
|
1743
1737
|
const route = Routes.guilds.users.resource(this.manager.guild.id, this.id, "adverts");
|
|
1744
1738
|
const payload = data;
|
|
1745
1739
|
const response = await this.rest.request({ method: "POST", url: route, payload });
|
|
1746
|
-
return this.
|
|
1740
|
+
return __privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1747
1741
|
}
|
|
1748
1742
|
async removeAdvert(advertId) {
|
|
1749
1743
|
let advs = this.adverts;
|
|
@@ -1752,7 +1746,7 @@ var GuildUser = class _GuildUser {
|
|
|
1752
1746
|
const payload = { adverts: advs };
|
|
1753
1747
|
const route = Routes.guilds.users.update(this.manager.guild.id, this.id);
|
|
1754
1748
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
1755
|
-
return this.
|
|
1749
|
+
return __privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1756
1750
|
}
|
|
1757
1751
|
/**
|
|
1758
1752
|
* Update certain property
|
|
@@ -1803,7 +1797,7 @@ var GuildUser = class _GuildUser {
|
|
|
1803
1797
|
url: route,
|
|
1804
1798
|
payload
|
|
1805
1799
|
});
|
|
1806
|
-
this.
|
|
1800
|
+
__privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1807
1801
|
return this;
|
|
1808
1802
|
}
|
|
1809
1803
|
async delete() {
|
|
@@ -1828,6 +1822,37 @@ var GuildUser = class _GuildUser {
|
|
|
1828
1822
|
return json;
|
|
1829
1823
|
}
|
|
1830
1824
|
};
|
|
1825
|
+
_GuildUser_instances = new WeakSet();
|
|
1826
|
+
updateInternals_fn6 = function(data) {
|
|
1827
|
+
for (let key in data) {
|
|
1828
|
+
if (key === "id" || key === "createdAt") continue;
|
|
1829
|
+
if (key in this) {
|
|
1830
|
+
this[key] = data[key];
|
|
1831
|
+
}
|
|
1832
|
+
if (key === "adverts") {
|
|
1833
|
+
this.adverts = [];
|
|
1834
|
+
for (let _adv of data.adverts) {
|
|
1835
|
+
this.adverts.push({
|
|
1836
|
+
_id: _adv._id,
|
|
1837
|
+
admin_id: _adv.admin_id,
|
|
1838
|
+
role_id: _adv.role_id,
|
|
1839
|
+
reason: _adv.reason,
|
|
1840
|
+
points_removed: _adv.points_removed,
|
|
1841
|
+
proof: _adv.proof,
|
|
1842
|
+
proof_ext: _adv.proof_ext,
|
|
1843
|
+
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
1844
|
+
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1850
|
+
this.createdAt = new Date(data.createdAt);
|
|
1851
|
+
this.manager.set(this);
|
|
1852
|
+
this.rest.emit("userUpdate", this);
|
|
1853
|
+
return this;
|
|
1854
|
+
};
|
|
1855
|
+
var GuildUser = _GuildUser;
|
|
1831
1856
|
|
|
1832
1857
|
// src/structures/vipmember/VipMember.ts
|
|
1833
1858
|
var _VipMember_instances, updateData_fn;
|
|
@@ -1966,8 +1991,10 @@ updateData_fn = function(data) {
|
|
|
1966
1991
|
var VipMember = _VipMember;
|
|
1967
1992
|
|
|
1968
1993
|
// src/structures/ticket/Ticket.ts
|
|
1994
|
+
var _GuildTicket_instances, updateInternals_fn7;
|
|
1969
1995
|
var GuildTicket = class {
|
|
1970
1996
|
constructor(data, manager) {
|
|
1997
|
+
__privateAdd(this, _GuildTicket_instances);
|
|
1971
1998
|
__publicField(this, "_id");
|
|
1972
1999
|
__publicField(this, "guild_id");
|
|
1973
2000
|
__publicField(this, "type");
|
|
@@ -2004,7 +2031,7 @@ var GuildTicket = class {
|
|
|
2004
2031
|
method: "GET",
|
|
2005
2032
|
url: route
|
|
2006
2033
|
});
|
|
2007
|
-
return this.
|
|
2034
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2008
2035
|
}
|
|
2009
2036
|
async setCustomerRating(rating) {
|
|
2010
2037
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "customer_rating");
|
|
@@ -2014,7 +2041,7 @@ var GuildTicket = class {
|
|
|
2014
2041
|
url: route,
|
|
2015
2042
|
payload
|
|
2016
2043
|
});
|
|
2017
|
-
return this.
|
|
2044
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2018
2045
|
}
|
|
2019
2046
|
async setAdminId(id) {
|
|
2020
2047
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "admin_id");
|
|
@@ -2024,7 +2051,7 @@ var GuildTicket = class {
|
|
|
2024
2051
|
url: route,
|
|
2025
2052
|
payload
|
|
2026
2053
|
});
|
|
2027
|
-
return this.
|
|
2054
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2028
2055
|
}
|
|
2029
2056
|
async setChannelId(id) {
|
|
2030
2057
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "channel_id");
|
|
@@ -2034,7 +2061,7 @@ var GuildTicket = class {
|
|
|
2034
2061
|
url: route,
|
|
2035
2062
|
payload
|
|
2036
2063
|
});
|
|
2037
|
-
return this.
|
|
2064
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2038
2065
|
}
|
|
2039
2066
|
async setClosedById(id) {
|
|
2040
2067
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "closed_by_id");
|
|
@@ -2044,7 +2071,7 @@ var GuildTicket = class {
|
|
|
2044
2071
|
url: route,
|
|
2045
2072
|
payload
|
|
2046
2073
|
});
|
|
2047
|
-
return this.
|
|
2074
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2048
2075
|
}
|
|
2049
2076
|
async setStatus(status) {
|
|
2050
2077
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "status");
|
|
@@ -2054,7 +2081,7 @@ var GuildTicket = class {
|
|
|
2054
2081
|
url: route,
|
|
2055
2082
|
payload
|
|
2056
2083
|
});
|
|
2057
|
-
return this.
|
|
2084
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2058
2085
|
}
|
|
2059
2086
|
async addMessage(message) {
|
|
2060
2087
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "messages");
|
|
@@ -2064,25 +2091,28 @@ var GuildTicket = class {
|
|
|
2064
2091
|
url: route,
|
|
2065
2092
|
payload
|
|
2066
2093
|
});
|
|
2067
|
-
return this.
|
|
2068
|
-
}
|
|
2069
|
-
_updateInternals(data) {
|
|
2070
|
-
for (let key in data) {
|
|
2071
|
-
if (key === "id" || key === "createdAt") continue;
|
|
2072
|
-
if (key in this) {
|
|
2073
|
-
this[key] = data[key];
|
|
2074
|
-
}
|
|
2075
|
-
}
|
|
2076
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2077
|
-
this.createdAt = new Date(data.createdAt);
|
|
2078
|
-
this.manager.set(this);
|
|
2079
|
-
return this;
|
|
2094
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2080
2095
|
}
|
|
2081
2096
|
};
|
|
2097
|
+
_GuildTicket_instances = new WeakSet();
|
|
2098
|
+
updateInternals_fn7 = function(data) {
|
|
2099
|
+
for (let key in data) {
|
|
2100
|
+
if (key === "id" || key === "createdAt") continue;
|
|
2101
|
+
if (key in this) {
|
|
2102
|
+
this[key] = data[key];
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2106
|
+
this.createdAt = new Date(data.createdAt);
|
|
2107
|
+
this.manager.set(this);
|
|
2108
|
+
return this;
|
|
2109
|
+
};
|
|
2082
2110
|
|
|
2083
2111
|
// src/structures/minesgame/MinesGame.ts
|
|
2112
|
+
var _MinesGame_instances, updateInternals_fn8;
|
|
2084
2113
|
var MinesGame = class {
|
|
2085
2114
|
constructor(data, manager) {
|
|
2115
|
+
__privateAdd(this, _MinesGame_instances);
|
|
2086
2116
|
__publicField(this, "guild_id");
|
|
2087
2117
|
__publicField(this, "_id");
|
|
2088
2118
|
__publicField(this, "creatorId");
|
|
@@ -2116,7 +2146,7 @@ var MinesGame = class {
|
|
|
2116
2146
|
method: "GET",
|
|
2117
2147
|
url: route
|
|
2118
2148
|
});
|
|
2119
|
-
return this.
|
|
2149
|
+
return __privateMethod(this, _MinesGame_instances, updateInternals_fn8).call(this, response);
|
|
2120
2150
|
}
|
|
2121
2151
|
async delete() {
|
|
2122
2152
|
const route = `/${Routes.fields("minesgames", this._id)}`;
|
|
@@ -2124,7 +2154,7 @@ var MinesGame = class {
|
|
|
2124
2154
|
method: "delete",
|
|
2125
2155
|
url: route
|
|
2126
2156
|
});
|
|
2127
|
-
return this.
|
|
2157
|
+
return __privateMethod(this, _MinesGame_instances, updateInternals_fn8).call(this, response);
|
|
2128
2158
|
}
|
|
2129
2159
|
async update(data) {
|
|
2130
2160
|
const route = `/${Routes.fields("minesgames", this._id)}`;
|
|
@@ -2133,25 +2163,27 @@ var MinesGame = class {
|
|
|
2133
2163
|
url: route,
|
|
2134
2164
|
payload: data
|
|
2135
2165
|
});
|
|
2136
|
-
return this.
|
|
2166
|
+
return __privateMethod(this, _MinesGame_instances, updateInternals_fn8).call(this, response);
|
|
2137
2167
|
}
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2168
|
+
};
|
|
2169
|
+
_MinesGame_instances = new WeakSet();
|
|
2170
|
+
updateInternals_fn8 = function(data) {
|
|
2171
|
+
for (let key in data) {
|
|
2172
|
+
if (key === "id" || key === "createdAt") continue;
|
|
2173
|
+
if (key in this) {
|
|
2174
|
+
this[key] = data[key];
|
|
2144
2175
|
}
|
|
2145
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2146
|
-
this.manager.set(this);
|
|
2147
|
-
return this;
|
|
2148
2176
|
}
|
|
2177
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2178
|
+
this.manager.set(this);
|
|
2179
|
+
return this;
|
|
2149
2180
|
};
|
|
2150
2181
|
|
|
2151
2182
|
// src/structures/automaticmessage/AutomaticMessage.ts
|
|
2183
|
+
var _AutomaticMessage_instances, updateInternals_fn9;
|
|
2152
2184
|
var AutomaticMessage = class {
|
|
2153
2185
|
constructor(data, manager) {
|
|
2154
|
-
|
|
2186
|
+
__privateAdd(this, _AutomaticMessage_instances);
|
|
2155
2187
|
__publicField(this, "id");
|
|
2156
2188
|
__publicField(this, "type");
|
|
2157
2189
|
__publicField(this, "admin_id");
|
|
@@ -2170,7 +2202,6 @@ var AutomaticMessage = class {
|
|
|
2170
2202
|
this.manager = manager;
|
|
2171
2203
|
this.guild = manager.guild;
|
|
2172
2204
|
this.rest = manager.rest;
|
|
2173
|
-
this._id = data?._id;
|
|
2174
2205
|
this.id = data?.id;
|
|
2175
2206
|
this.type = data?.type;
|
|
2176
2207
|
this.admin_id = data?.admin_id;
|
|
@@ -2185,12 +2216,7 @@ var AutomaticMessage = class {
|
|
|
2185
2216
|
this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
|
|
2186
2217
|
}
|
|
2187
2218
|
async fetch() {
|
|
2188
|
-
|
|
2189
|
-
const response = await this.rest.request({
|
|
2190
|
-
method: "get",
|
|
2191
|
-
url: route
|
|
2192
|
-
});
|
|
2193
|
-
return this._updateInternals(response);
|
|
2219
|
+
return this.manager.fetch(this.id);
|
|
2194
2220
|
}
|
|
2195
2221
|
async addChannelId(...id) {
|
|
2196
2222
|
const ids = [.../* @__PURE__ */ new Set([...this.channel_ids, ...id])];
|
|
@@ -2202,39 +2228,28 @@ var AutomaticMessage = class {
|
|
|
2202
2228
|
return this.update({ channel_ids: ids });
|
|
2203
2229
|
}
|
|
2204
2230
|
async update(data) {
|
|
2231
|
+
this.manager.cache.set(this.id, { ...this, ...data, id: this.id });
|
|
2205
2232
|
const route = Routes.guilds.get(this.guild.id);
|
|
2206
2233
|
const response = await this.rest.request({
|
|
2207
2234
|
method: "patch",
|
|
2208
2235
|
url: route,
|
|
2209
|
-
payload: { automatic_messages: this.manager.
|
|
2236
|
+
payload: { automatic_messages: this.manager.toJSON() }
|
|
2210
2237
|
});
|
|
2211
|
-
return this.
|
|
2238
|
+
return __privateMethod(this, _AutomaticMessage_instances, updateInternals_fn9).call(this, response);
|
|
2212
2239
|
}
|
|
2213
2240
|
async delete() {
|
|
2214
|
-
this.manager.cache.delete(this.
|
|
2241
|
+
this.manager.cache.delete(this.id);
|
|
2242
|
+
this.guild.automatic_messages = this.manager.cache.toArray();
|
|
2215
2243
|
const route = Routes.guilds.get(this.guild.id);
|
|
2216
2244
|
const response = await this.rest.request({
|
|
2217
2245
|
method: "patch",
|
|
2218
2246
|
url: route,
|
|
2219
|
-
payload: { automatic_messages: this.manager.
|
|
2247
|
+
payload: { automatic_messages: this.manager.toJSON() }
|
|
2220
2248
|
});
|
|
2221
2249
|
return this.manager.set(response.automatic_messages);
|
|
2222
2250
|
}
|
|
2223
|
-
_updateInternals(data) {
|
|
2224
|
-
for (let key in data) {
|
|
2225
|
-
if (key === "_id" || key === "createdAt") continue;
|
|
2226
|
-
if (key in this) {
|
|
2227
|
-
this[key] = data[key];
|
|
2228
|
-
}
|
|
2229
|
-
}
|
|
2230
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2231
|
-
this.createdAt = new Date(data.createdAt);
|
|
2232
|
-
this.manager._add(this);
|
|
2233
|
-
return this;
|
|
2234
|
-
}
|
|
2235
2251
|
toJSON() {
|
|
2236
2252
|
return {
|
|
2237
|
-
_id: this._id,
|
|
2238
2253
|
id: this.id,
|
|
2239
2254
|
type: this.type,
|
|
2240
2255
|
admin_id: this.admin_id,
|
|
@@ -2250,6 +2265,20 @@ var AutomaticMessage = class {
|
|
|
2250
2265
|
};
|
|
2251
2266
|
}
|
|
2252
2267
|
};
|
|
2268
|
+
_AutomaticMessage_instances = new WeakSet();
|
|
2269
|
+
updateInternals_fn9 = function(data) {
|
|
2270
|
+
const _this = data?.automatic_messages?.find((m) => m.id === this.id);
|
|
2271
|
+
for (let key in _this) {
|
|
2272
|
+
if (key === "id" || key === "createdAt") continue;
|
|
2273
|
+
if (key in this) {
|
|
2274
|
+
this[key] = _this[key];
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2278
|
+
this.createdAt = new Date(data.createdAt);
|
|
2279
|
+
this.manager._add(data.automatic_messages);
|
|
2280
|
+
return this;
|
|
2281
|
+
};
|
|
2253
2282
|
|
|
2254
2283
|
// src/utils/randomKeyGenerator.ts
|
|
2255
2284
|
import { randomBytes } from "crypto";
|
|
@@ -2263,25 +2292,19 @@ var AutomaticMessageManager = class extends BaseManager {
|
|
|
2263
2292
|
super(guild);
|
|
2264
2293
|
this.guild = guild;
|
|
2265
2294
|
this.rest = guild.rest;
|
|
2266
|
-
this.base_url = Routes.guilds.resource(guild.id
|
|
2295
|
+
this.base_url = Routes.guilds.resource(guild.id);
|
|
2267
2296
|
this.cache = new Collection();
|
|
2268
2297
|
if (guild.automatic_messages && guild.automatic_messages.length !== 0) this.set(guild.automatic_messages);
|
|
2269
2298
|
else this.guild.automatic_messages = [];
|
|
2270
2299
|
}
|
|
2271
2300
|
async fetch(messageId) {
|
|
2272
2301
|
const route = this.base_url;
|
|
2273
|
-
if (messageId) {
|
|
2274
|
-
const response2 = await this.rest.request({
|
|
2275
|
-
method: "get",
|
|
2276
|
-
url: `${route}`
|
|
2277
|
-
});
|
|
2278
|
-
return this._add(response2).find((m) => m.id === messageId);
|
|
2279
|
-
}
|
|
2280
2302
|
const response = await this.rest.request({
|
|
2281
2303
|
method: "get",
|
|
2282
2304
|
url: route
|
|
2283
2305
|
});
|
|
2284
|
-
|
|
2306
|
+
this._add(response.automatic_messages);
|
|
2307
|
+
return this.cache;
|
|
2285
2308
|
}
|
|
2286
2309
|
async create(data) {
|
|
2287
2310
|
if (!data.type) throw new Error(`Missing message's type.`);
|
|
@@ -2308,6 +2331,7 @@ var AutomaticMessageManager = class extends BaseManager {
|
|
|
2308
2331
|
if (data instanceof AutomaticMessage) this.cache.set(data.id, data);
|
|
2309
2332
|
else this.cache.set(data.id, new AutomaticMessage(data, this));
|
|
2310
2333
|
}
|
|
2334
|
+
this.guild.automatic_messages = this.cache.toArray();
|
|
2311
2335
|
return this.cache;
|
|
2312
2336
|
}
|
|
2313
2337
|
set(data) {
|
|
@@ -2336,6 +2360,10 @@ var AutomaticMessageManager = class extends BaseManager {
|
|
|
2336
2360
|
});
|
|
2337
2361
|
return response;
|
|
2338
2362
|
}
|
|
2363
|
+
toJSON() {
|
|
2364
|
+
[...this.cache.values()].map((m) => console.log(m instanceof AutomaticMessage));
|
|
2365
|
+
return this.cache.toArray();
|
|
2366
|
+
}
|
|
2339
2367
|
};
|
|
2340
2368
|
|
|
2341
2369
|
// src/managers/bet/GuildBetManager.ts
|
|
@@ -2914,15 +2942,14 @@ var GuildTicketManager = class {
|
|
|
2914
2942
|
} else {
|
|
2915
2943
|
categories.push(data);
|
|
2916
2944
|
}
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2945
|
+
return this.guild.update({
|
|
2946
|
+
tickets_configuration: {
|
|
2947
|
+
categories,
|
|
2948
|
+
creationCategory: this.guild.tickets_configuration.creationCategory,
|
|
2949
|
+
deletionCategory: this.guild.tickets_configuration.deletionCategory,
|
|
2950
|
+
rating_channel_id: this.guild.tickets_configuration.rating_channel_id
|
|
2951
|
+
}
|
|
2923
2952
|
});
|
|
2924
|
-
this.guild._updateInternals(response);
|
|
2925
|
-
return response;
|
|
2926
2953
|
}
|
|
2927
2954
|
async deleteTicketCategory(data) {
|
|
2928
2955
|
let categories = this.guild.tickets_configuration.categories;
|
|
@@ -2936,8 +2963,14 @@ var GuildTicketManager = class {
|
|
|
2936
2963
|
url: route,
|
|
2937
2964
|
payload
|
|
2938
2965
|
});
|
|
2939
|
-
this.guild.
|
|
2940
|
-
|
|
2966
|
+
return this.guild.update({
|
|
2967
|
+
tickets_configuration: {
|
|
2968
|
+
categories,
|
|
2969
|
+
creationCategory: this.guild.tickets_configuration.creationCategory,
|
|
2970
|
+
deletionCategory: this.guild.tickets_configuration.deletionCategory,
|
|
2971
|
+
rating_channel_id: this.guild.tickets_configuration.rating_channel_id
|
|
2972
|
+
}
|
|
2973
|
+
});
|
|
2941
2974
|
}
|
|
2942
2975
|
async fetch(options) {
|
|
2943
2976
|
if (options && options.cache) return this.cache;
|
|
@@ -3203,14 +3236,150 @@ var VipMemberManager = class extends BaseManager {
|
|
|
3203
3236
|
}
|
|
3204
3237
|
};
|
|
3205
3238
|
|
|
3239
|
+
// src/structures/tournament/Tournament.ts
|
|
3240
|
+
var _Tournament_instances, updateInternals_fn10;
|
|
3241
|
+
var Tournament = class {
|
|
3242
|
+
constructor(data, manager) {
|
|
3243
|
+
__privateAdd(this, _Tournament_instances);
|
|
3244
|
+
__publicField(this, "_id");
|
|
3245
|
+
__publicField(this, "guild_id");
|
|
3246
|
+
__publicField(this, "type");
|
|
3247
|
+
__publicField(this, "max_teams");
|
|
3248
|
+
__publicField(this, "teams");
|
|
3249
|
+
__publicField(this, "message");
|
|
3250
|
+
__publicField(this, "message_id");
|
|
3251
|
+
__publicField(this, "status");
|
|
3252
|
+
__publicField(this, "createdAt");
|
|
3253
|
+
__publicField(this, "updatedAt");
|
|
3254
|
+
__publicField(this, "guild");
|
|
3255
|
+
__publicField(this, "rest");
|
|
3256
|
+
__publicField(this, "manager");
|
|
3257
|
+
__publicField(this, "data");
|
|
3258
|
+
this.manager = manager;
|
|
3259
|
+
this.guild = manager.guild;
|
|
3260
|
+
this.rest = manager.rest;
|
|
3261
|
+
this.guild_id = data?.guild_id;
|
|
3262
|
+
this.type = data?.type;
|
|
3263
|
+
this.teams = data?.teams;
|
|
3264
|
+
this.message = data?.message;
|
|
3265
|
+
this.message_id = data?.message_id;
|
|
3266
|
+
this.status = data?.status;
|
|
3267
|
+
this.createdAt = data?.createdAt ? new Date(data?.createdAt) : /* @__PURE__ */ new Date();
|
|
3268
|
+
this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
|
|
3269
|
+
this.data = data;
|
|
3270
|
+
}
|
|
3271
|
+
async fetch() {
|
|
3272
|
+
const route = Routes.fields("guilds", this.guild.id, "tournaments", this._id);
|
|
3273
|
+
const response = await this.rest.request({
|
|
3274
|
+
method: "get",
|
|
3275
|
+
url: route
|
|
3276
|
+
});
|
|
3277
|
+
return __privateMethod(this, _Tournament_instances, updateInternals_fn10).call(this, response);
|
|
3278
|
+
}
|
|
3279
|
+
async update(data) {
|
|
3280
|
+
const route = Routes.fields("guilds", this.guild.id, "tournaments", this._id);
|
|
3281
|
+
const response = await this.rest.request({
|
|
3282
|
+
method: "patch",
|
|
3283
|
+
url: route,
|
|
3284
|
+
payload: data
|
|
3285
|
+
});
|
|
3286
|
+
return __privateMethod(this, _Tournament_instances, updateInternals_fn10).call(this, response);
|
|
3287
|
+
}
|
|
3288
|
+
toJSON() {
|
|
3289
|
+
return {
|
|
3290
|
+
guild_id: this.guild_id,
|
|
3291
|
+
type: this.type,
|
|
3292
|
+
max_teams: this.max_teams,
|
|
3293
|
+
teams: this.teams,
|
|
3294
|
+
message: this.message,
|
|
3295
|
+
message_id: this.message_id,
|
|
3296
|
+
status: this.status,
|
|
3297
|
+
createdAt: this.createdAt ? new Date(this?.createdAt) : /* @__PURE__ */ new Date(),
|
|
3298
|
+
updatedAt: this.updatedAt ? new Date(this?.updatedAt) : /* @__PURE__ */ new Date()
|
|
3299
|
+
};
|
|
3300
|
+
}
|
|
3301
|
+
};
|
|
3302
|
+
_Tournament_instances = new WeakSet();
|
|
3303
|
+
updateInternals_fn10 = function(data) {
|
|
3304
|
+
for (let key in data) {
|
|
3305
|
+
if (key === "id" || key === "createdAt") continue;
|
|
3306
|
+
if (key in this) {
|
|
3307
|
+
this[key] = data[key];
|
|
3308
|
+
}
|
|
3309
|
+
}
|
|
3310
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
3311
|
+
this.createdAt = new Date(data.createdAt);
|
|
3312
|
+
this.manager._add(this);
|
|
3313
|
+
return this;
|
|
3314
|
+
};
|
|
3315
|
+
|
|
3316
|
+
// src/managers/tournament/TournamentManager.ts
|
|
3317
|
+
var TournamentManager = class extends BaseManager {
|
|
3318
|
+
constructor(guild) {
|
|
3319
|
+
super(guild);
|
|
3320
|
+
this.guild = guild;
|
|
3321
|
+
this.rest = guild.rest;
|
|
3322
|
+
this.base_url = Routes.guilds.resource(guild.id, "tournaments");
|
|
3323
|
+
this.cache = new Collection();
|
|
3324
|
+
}
|
|
3325
|
+
async fetch(options) {
|
|
3326
|
+
if (options && options.cache) return this.cache;
|
|
3327
|
+
if (options && options.tournamentId) {
|
|
3328
|
+
const response2 = await this.rest.request({
|
|
3329
|
+
method: "GET",
|
|
3330
|
+
url: Routes.fields(this.base_url, options.tournamentId)
|
|
3331
|
+
});
|
|
3332
|
+
const tournament = new Tournament(response2, this);
|
|
3333
|
+
this._add(tournament);
|
|
3334
|
+
return tournament;
|
|
3335
|
+
}
|
|
3336
|
+
const response = await this.rest.request({
|
|
3337
|
+
method: "GET",
|
|
3338
|
+
url: this.base_url
|
|
3339
|
+
});
|
|
3340
|
+
return this.set(response);
|
|
3341
|
+
}
|
|
3342
|
+
set(data) {
|
|
3343
|
+
this.cache.clear();
|
|
3344
|
+
if (Array.isArray(data)) {
|
|
3345
|
+
for (let _m of data) {
|
|
3346
|
+
if (!_m._id) continue;
|
|
3347
|
+
if (_m instanceof Tournament) this.cache.set(_m._id, _m);
|
|
3348
|
+
else this.cache.set(_m._id, new Tournament(_m, this));
|
|
3349
|
+
}
|
|
3350
|
+
} else {
|
|
3351
|
+
if (!data._id) return this.cache;
|
|
3352
|
+
if (data instanceof Tournament) this.cache.set(data._id, data);
|
|
3353
|
+
else this.cache.set(data._id, new Tournament(data, this));
|
|
3354
|
+
}
|
|
3355
|
+
return this.cache;
|
|
3356
|
+
}
|
|
3357
|
+
_add(data) {
|
|
3358
|
+
if (Array.isArray(data)) {
|
|
3359
|
+
for (let _m of data) {
|
|
3360
|
+
if (!_m._id) continue;
|
|
3361
|
+
if (_m instanceof Tournament) this.cache.set(_m._id, _m);
|
|
3362
|
+
else this.cache.set(_m._id, new Tournament(_m, this));
|
|
3363
|
+
}
|
|
3364
|
+
} else {
|
|
3365
|
+
if (!data._id) return this.cache;
|
|
3366
|
+
if (data instanceof Tournament) this.cache.set(data._id, data);
|
|
3367
|
+
else this.cache.set(data._id, new Tournament(data, this));
|
|
3368
|
+
}
|
|
3369
|
+
return this.cache;
|
|
3370
|
+
}
|
|
3371
|
+
};
|
|
3372
|
+
|
|
3206
3373
|
// src/structures/guild/Guild.ts
|
|
3207
|
-
var
|
|
3374
|
+
var _Guild_instances, updateInternals_fn11;
|
|
3375
|
+
var Guild7 = class {
|
|
3208
3376
|
/**
|
|
3209
3377
|
* The guild structure
|
|
3210
3378
|
* @param data The guild's data
|
|
3211
3379
|
* @param rest The rest client
|
|
3212
3380
|
*/
|
|
3213
3381
|
constructor(data, rest) {
|
|
3382
|
+
__privateAdd(this, _Guild_instances);
|
|
3214
3383
|
/** The data of this guild */
|
|
3215
3384
|
__publicField(this, "data");
|
|
3216
3385
|
/** The rest client */
|
|
@@ -3236,6 +3405,7 @@ var Guild6 = class {
|
|
|
3236
3405
|
__publicField(this, "roulette_settings");
|
|
3237
3406
|
/** Guild Prefix */
|
|
3238
3407
|
__publicField(this, "prefix");
|
|
3408
|
+
__publicField(this, "prefixes");
|
|
3239
3409
|
/** Guild Creation Date */
|
|
3240
3410
|
__publicField(this, "createdAt");
|
|
3241
3411
|
/** Guild Updated Date */
|
|
@@ -3255,6 +3425,7 @@ var Guild6 = class {
|
|
|
3255
3425
|
__publicField(this, "mediators");
|
|
3256
3426
|
__publicField(this, "automatic_messages");
|
|
3257
3427
|
__publicField(this, "automaticMessagesManager");
|
|
3428
|
+
__publicField(this, "tournaments");
|
|
3258
3429
|
__publicField(this, "adverts");
|
|
3259
3430
|
__publicField(this, "codes");
|
|
3260
3431
|
__publicField(this, "coin_symbol");
|
|
@@ -3269,6 +3440,7 @@ var Guild6 = class {
|
|
|
3269
3440
|
this.scores = data?.scores;
|
|
3270
3441
|
this.codes = data?.codes;
|
|
3271
3442
|
this.prefix = data?.prefix;
|
|
3443
|
+
this.prefixes = data?.prefixes;
|
|
3272
3444
|
this.status = data?.status;
|
|
3273
3445
|
this.tickets_configuration = data?.tickets_configuration;
|
|
3274
3446
|
this.automatic_messages = data?.automatic_messages;
|
|
@@ -3289,6 +3461,7 @@ var Guild6 = class {
|
|
|
3289
3461
|
this.bets = new GuildBetManager2(this);
|
|
3290
3462
|
this.mediators = new GuildMediatorManager(this);
|
|
3291
3463
|
this.automaticMessagesManager = new AutomaticMessageManager(this);
|
|
3464
|
+
this.tournaments = new TournamentManager(this);
|
|
3292
3465
|
this.adverts = [];
|
|
3293
3466
|
for (let _adv of data?.adverts || []) {
|
|
3294
3467
|
this.adverts.push({
|
|
@@ -3325,7 +3498,7 @@ var Guild6 = class {
|
|
|
3325
3498
|
url: route,
|
|
3326
3499
|
payload: { channels }
|
|
3327
3500
|
});
|
|
3328
|
-
this.
|
|
3501
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3329
3502
|
return response.channels.find((t) => t.type === type);
|
|
3330
3503
|
}
|
|
3331
3504
|
}
|
|
@@ -3340,7 +3513,7 @@ var Guild6 = class {
|
|
|
3340
3513
|
url: route,
|
|
3341
3514
|
payload: { permissions }
|
|
3342
3515
|
});
|
|
3343
|
-
this.
|
|
3516
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3344
3517
|
return response.permissions.find((t) => t.type === type);
|
|
3345
3518
|
}
|
|
3346
3519
|
}
|
|
@@ -3349,26 +3522,26 @@ var Guild6 = class {
|
|
|
3349
3522
|
const route = Routes.guilds.get(this.id);
|
|
3350
3523
|
const payload = { adverts: this.adverts };
|
|
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 removeAdvert(advertId) {
|
|
3355
3528
|
const route = Routes.guilds.get(this.id);
|
|
3356
3529
|
const payload = { adverts: this.adverts.filter((a) => a._id !== advertId) };
|
|
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 createCode(data) {
|
|
3361
3534
|
this.codes.push(data);
|
|
3362
3535
|
const route = Routes.guilds.get(this.id);
|
|
3363
3536
|
const payload = { codes: this.codes };
|
|
3364
3537
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
3365
|
-
return this.
|
|
3538
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3366
3539
|
}
|
|
3367
3540
|
async removeCode(codeId) {
|
|
3368
3541
|
const route = Routes.guilds.get(this.id);
|
|
3369
3542
|
const payload = { codes: this.codes.filter((a) => a._id !== codeId) };
|
|
3370
3543
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
3371
|
-
return this.
|
|
3544
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3372
3545
|
}
|
|
3373
3546
|
async addIdToChannel(type, id) {
|
|
3374
3547
|
const channel = this.channels.find((c) => c.type === type);
|
|
@@ -3387,7 +3560,7 @@ var Guild6 = class {
|
|
|
3387
3560
|
url: route,
|
|
3388
3561
|
payload
|
|
3389
3562
|
});
|
|
3390
|
-
return this.
|
|
3563
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3391
3564
|
}
|
|
3392
3565
|
async setChannelIds(type, ...ids) {
|
|
3393
3566
|
const channel = this.channels.find((c) => c.type === type);
|
|
@@ -3406,7 +3579,7 @@ var Guild6 = class {
|
|
|
3406
3579
|
url: route,
|
|
3407
3580
|
payload
|
|
3408
3581
|
});
|
|
3409
|
-
return this.
|
|
3582
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3410
3583
|
}
|
|
3411
3584
|
async removeIdInChannel(type, id) {
|
|
3412
3585
|
const chIndex = this.channels.findIndex((c) => c.type === type);
|
|
@@ -3428,7 +3601,7 @@ var Guild6 = class {
|
|
|
3428
3601
|
url: route,
|
|
3429
3602
|
payload
|
|
3430
3603
|
});
|
|
3431
|
-
return this.
|
|
3604
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3432
3605
|
}
|
|
3433
3606
|
async updateRouletteSettings(data) {
|
|
3434
3607
|
const _data = {
|
|
@@ -3485,58 +3658,21 @@ var Guild6 = class {
|
|
|
3485
3658
|
this.logEntries.fetch(),
|
|
3486
3659
|
this.betusers.fetch(),
|
|
3487
3660
|
this.bets.fetch(),
|
|
3488
|
-
this.mediators.fetch()
|
|
3661
|
+
this.mediators.fetch(),
|
|
3662
|
+
this.tournaments.fetch()
|
|
3489
3663
|
]);
|
|
3490
3664
|
return this;
|
|
3491
3665
|
}
|
|
3492
|
-
_updateInternals(data) {
|
|
3493
|
-
for (let key in data) {
|
|
3494
|
-
if (key === "id" || key === "createdAt") continue;
|
|
3495
|
-
if (key in this) {
|
|
3496
|
-
this[key] = data[key];
|
|
3497
|
-
}
|
|
3498
|
-
if (key === "adverts") {
|
|
3499
|
-
this.adverts = [];
|
|
3500
|
-
for (let _adv of data.adverts) {
|
|
3501
|
-
this.adverts.push({
|
|
3502
|
-
_id: _adv._id,
|
|
3503
|
-
admin_id: _adv.admin_id,
|
|
3504
|
-
points_to_remove: _adv.points_to_remove,
|
|
3505
|
-
role_id: _adv.role_id,
|
|
3506
|
-
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
3507
|
-
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
3508
|
-
});
|
|
3509
|
-
}
|
|
3510
|
-
}
|
|
3511
|
-
if (key === "code") {
|
|
3512
|
-
this.codes = [];
|
|
3513
|
-
for (let _adv of data.codes) {
|
|
3514
|
-
this.codes.push({
|
|
3515
|
-
_id: _adv._id,
|
|
3516
|
-
admin_id: _adv.admin_id,
|
|
3517
|
-
type: _adv.type,
|
|
3518
|
-
add: _adv.add,
|
|
3519
|
-
code: _adv.code,
|
|
3520
|
-
expire: _adv.expire ? new Date(_adv.expire) : /* @__PURE__ */ new Date(),
|
|
3521
|
-
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
3522
|
-
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
3523
|
-
});
|
|
3524
|
-
}
|
|
3525
|
-
}
|
|
3526
|
-
}
|
|
3527
|
-
this.automaticMessagesManager.set(this.automatic_messages);
|
|
3528
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
3529
|
-
this.rest.guilds.cache.set(this.id, this);
|
|
3530
|
-
this.rest.emit("guildUpdate", this);
|
|
3531
|
-
return this;
|
|
3532
|
-
}
|
|
3533
3666
|
async fetch() {
|
|
3534
3667
|
const route = Routes.guilds.get(this.id);
|
|
3535
3668
|
const response = await this.rest.request({
|
|
3536
3669
|
method: "get",
|
|
3537
3670
|
url: route
|
|
3538
3671
|
});
|
|
3539
|
-
return this.
|
|
3672
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3673
|
+
}
|
|
3674
|
+
async reset() {
|
|
3675
|
+
return this.update({ reset: true });
|
|
3540
3676
|
}
|
|
3541
3677
|
async update(data) {
|
|
3542
3678
|
const route = Routes.guilds.get(this.id);
|
|
@@ -3545,16 +3681,7 @@ var Guild6 = class {
|
|
|
3545
3681
|
url: route,
|
|
3546
3682
|
payload: data
|
|
3547
3683
|
});
|
|
3548
|
-
|
|
3549
|
-
if (k === "id" || k == "createdAt") continue;
|
|
3550
|
-
if (k in this) {
|
|
3551
|
-
this[k] = response[k];
|
|
3552
|
-
}
|
|
3553
|
-
}
|
|
3554
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
3555
|
-
this.rest.guilds.cache.set(this.id, this);
|
|
3556
|
-
this.rest.emit("guildUpdate", this);
|
|
3557
|
-
return this;
|
|
3684
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3558
3685
|
}
|
|
3559
3686
|
async setStatus(key, status) {
|
|
3560
3687
|
Assertion.assertString(key);
|
|
@@ -3579,16 +3706,27 @@ var Guild6 = class {
|
|
|
3579
3706
|
await this.update({ prices: this.prices });
|
|
3580
3707
|
return this;
|
|
3581
3708
|
}
|
|
3582
|
-
async
|
|
3583
|
-
|
|
3584
|
-
const
|
|
3585
|
-
const payload = { set:
|
|
3709
|
+
async addPrefix(prefixes) {
|
|
3710
|
+
const route = Routes.fields(Routes.guilds.resource(this.id, "prefixes"));
|
|
3711
|
+
const _p = Array.isArray(prefixes) ? prefixes : [prefixes];
|
|
3712
|
+
const payload = { set: [.../* @__PURE__ */ new Set([...this.prefixes, ..._p])] };
|
|
3713
|
+
const response = await this.rest.request({
|
|
3714
|
+
method: "PATCH",
|
|
3715
|
+
url: route,
|
|
3716
|
+
payload
|
|
3717
|
+
});
|
|
3718
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3719
|
+
return this;
|
|
3720
|
+
}
|
|
3721
|
+
async setPrefix(prefixes) {
|
|
3722
|
+
const route = Routes.fields(Routes.guilds.resource(this.id, "prefixes"));
|
|
3723
|
+
const payload = { set: Array.isArray(prefixes) ? prefixes : [prefixes] };
|
|
3586
3724
|
const response = await this.rest.request({
|
|
3587
3725
|
method: "PATCH",
|
|
3588
3726
|
url: route,
|
|
3589
3727
|
payload
|
|
3590
3728
|
});
|
|
3591
|
-
this.
|
|
3729
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3592
3730
|
return this;
|
|
3593
3731
|
}
|
|
3594
3732
|
async toggleDailyCategory(category) {
|
|
@@ -3608,7 +3746,7 @@ var Guild6 = 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 setScores(name, amount) {
|
|
@@ -3621,7 +3759,7 @@ var Guild6 = class {
|
|
|
3621
3759
|
url: route,
|
|
3622
3760
|
payload
|
|
3623
3761
|
});
|
|
3624
|
-
this.
|
|
3762
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3625
3763
|
return this;
|
|
3626
3764
|
}
|
|
3627
3765
|
async toggleMode(mode) {
|
|
@@ -3646,10 +3784,52 @@ var Guild6 = class {
|
|
|
3646
3784
|
url: route,
|
|
3647
3785
|
payload
|
|
3648
3786
|
});
|
|
3649
|
-
this.
|
|
3787
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn11).call(this, response);
|
|
3650
3788
|
return this;
|
|
3651
3789
|
}
|
|
3652
3790
|
};
|
|
3791
|
+
_Guild_instances = new WeakSet();
|
|
3792
|
+
updateInternals_fn11 = function(data) {
|
|
3793
|
+
for (let key in data) {
|
|
3794
|
+
if (key === "id" || key === "createdAt") continue;
|
|
3795
|
+
if (key in this) {
|
|
3796
|
+
this[key] = data[key];
|
|
3797
|
+
}
|
|
3798
|
+
if (key === "adverts") {
|
|
3799
|
+
this.adverts = [];
|
|
3800
|
+
for (let _adv of data.adverts) {
|
|
3801
|
+
this.adverts.push({
|
|
3802
|
+
_id: _adv._id,
|
|
3803
|
+
admin_id: _adv.admin_id,
|
|
3804
|
+
points_to_remove: _adv.points_to_remove,
|
|
3805
|
+
role_id: _adv.role_id,
|
|
3806
|
+
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
3807
|
+
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
3808
|
+
});
|
|
3809
|
+
}
|
|
3810
|
+
}
|
|
3811
|
+
if (key === "code") {
|
|
3812
|
+
this.codes = [];
|
|
3813
|
+
for (let _adv of data.codes) {
|
|
3814
|
+
this.codes.push({
|
|
3815
|
+
_id: _adv._id,
|
|
3816
|
+
admin_id: _adv.admin_id,
|
|
3817
|
+
type: _adv.type,
|
|
3818
|
+
add: _adv.add,
|
|
3819
|
+
code: _adv.code,
|
|
3820
|
+
expire: _adv.expire ? new Date(_adv.expire) : /* @__PURE__ */ new Date(),
|
|
3821
|
+
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
3822
|
+
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
3823
|
+
});
|
|
3824
|
+
}
|
|
3825
|
+
}
|
|
3826
|
+
}
|
|
3827
|
+
this.automaticMessagesManager.set(this.automatic_messages);
|
|
3828
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
3829
|
+
this.rest.guilds.cache.set(this.id, this);
|
|
3830
|
+
this.rest.emit("guildUpdate", this);
|
|
3831
|
+
return this;
|
|
3832
|
+
};
|
|
3653
3833
|
|
|
3654
3834
|
// src/managers/guild/GuildManager.ts
|
|
3655
3835
|
var GuildManager = class {
|
|
@@ -3679,7 +3859,7 @@ var GuildManager = class {
|
|
|
3679
3859
|
method: "get",
|
|
3680
3860
|
url: route2
|
|
3681
3861
|
});
|
|
3682
|
-
const guild = new
|
|
3862
|
+
const guild = new Guild7(response2, this.rest);
|
|
3683
3863
|
await guild._start().then((g) => {
|
|
3684
3864
|
this.cache.set(g.id, g);
|
|
3685
3865
|
});
|
|
@@ -3693,13 +3873,22 @@ var GuildManager = class {
|
|
|
3693
3873
|
});
|
|
3694
3874
|
for (let _guild of response) {
|
|
3695
3875
|
if (!_guild.id) continue;
|
|
3696
|
-
const guild = new
|
|
3876
|
+
const guild = new Guild7(_guild, this.rest);
|
|
3697
3877
|
await guild._start().then((g) => {
|
|
3698
3878
|
this.cache.set(g.id, g);
|
|
3699
3879
|
});
|
|
3700
3880
|
}
|
|
3701
3881
|
return this.cache;
|
|
3702
3882
|
}
|
|
3883
|
+
async reset(guildId) {
|
|
3884
|
+
if (guildId) {
|
|
3885
|
+
return await this.cache.get(guildId).reset();
|
|
3886
|
+
}
|
|
3887
|
+
for (let [_, g] of this.cache) {
|
|
3888
|
+
await g.reset();
|
|
3889
|
+
}
|
|
3890
|
+
return this.cache;
|
|
3891
|
+
}
|
|
3703
3892
|
async delete(options) {
|
|
3704
3893
|
if (options && options.guildId) {
|
|
3705
3894
|
Assertion.assertString(options.guildId);
|
|
@@ -3726,12 +3915,12 @@ var GuildManager = class {
|
|
|
3726
3915
|
if (!data) return this.cache;
|
|
3727
3916
|
if (Array.isArray(data)) {
|
|
3728
3917
|
for (let _guild of data) {
|
|
3729
|
-
const guild = new
|
|
3918
|
+
const guild = new Guild7(_guild, this.rest);
|
|
3730
3919
|
this.cache.set(guild.id, guild);
|
|
3731
3920
|
}
|
|
3732
3921
|
return this.cache;
|
|
3733
3922
|
} else {
|
|
3734
|
-
const guild = new
|
|
3923
|
+
const guild = new Guild7(data, this.rest);
|
|
3735
3924
|
this.cache.set(guild.id, guild);
|
|
3736
3925
|
return guild;
|
|
3737
3926
|
}
|
|
@@ -3745,7 +3934,7 @@ var FgGreen = "\x1B[32m";
|
|
|
3745
3934
|
var FgRed = "\x1B[31m";
|
|
3746
3935
|
var FgBlue = "\x1B[34m";
|
|
3747
3936
|
var FgCyan = "\x1B[36m";
|
|
3748
|
-
var
|
|
3937
|
+
var REST9 = class extends EventEmitter {
|
|
3749
3938
|
/**
|
|
3750
3939
|
*
|
|
3751
3940
|
* @param key The unique key for he client
|
|
@@ -3842,6 +4031,6 @@ var REST8 = class extends EventEmitter {
|
|
|
3842
4031
|
};
|
|
3843
4032
|
export {
|
|
3844
4033
|
APIEndpoints,
|
|
3845
|
-
|
|
4034
|
+
REST9 as REST,
|
|
3846
4035
|
Routes
|
|
3847
4036
|
};
|