@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
|
@@ -400,7 +400,7 @@ var require_main = __commonJS({
|
|
|
400
400
|
// src/rest/Routes.ts
|
|
401
401
|
var Routes = {
|
|
402
402
|
//base: "http://localhost:80/api/v1",
|
|
403
|
-
base: "https://
|
|
403
|
+
base: "https://duqueapi.shardweb.app/api/v1",
|
|
404
404
|
field: (field) => `/${field}`,
|
|
405
405
|
fields: (...fields) => `${fields.join("/")}`,
|
|
406
406
|
guilds: {
|
|
@@ -595,6 +595,9 @@ var BaseManager = class {
|
|
|
595
595
|
this.rest = guild.rest;
|
|
596
596
|
this.cache = new Collection();
|
|
597
597
|
}
|
|
598
|
+
toJSON() {
|
|
599
|
+
return [...this.cache.values()].map((m) => m && "toJSON" in m && typeof m.toJSON === "function" ? m.toJSON() : m);
|
|
600
|
+
}
|
|
598
601
|
};
|
|
599
602
|
|
|
600
603
|
// src/managers/player/PlayerManager.ts
|
|
@@ -723,8 +726,10 @@ import { request, Headers } from "undici";
|
|
|
723
726
|
import_dotenv.default.config();
|
|
724
727
|
|
|
725
728
|
// src/structures/bet/GuildBet.ts
|
|
729
|
+
var _GuildBet_instances, updateInternals_fn;
|
|
726
730
|
var GuildBet = class {
|
|
727
731
|
constructor(data, manager) {
|
|
732
|
+
__privateAdd(this, _GuildBet_instances);
|
|
728
733
|
/** The bet's type */
|
|
729
734
|
__publicField(this, "type");
|
|
730
735
|
/** The bet's mode */
|
|
@@ -803,7 +808,7 @@ var GuildBet = class {
|
|
|
803
808
|
async fetch() {
|
|
804
809
|
const route = Routes.guilds.bets.get(this.guild.id, this._id);
|
|
805
810
|
const response = await this.rest.request({ url: route, method: "GET" });
|
|
806
|
-
return this.
|
|
811
|
+
return __privateMethod(this, _GuildBet_instances, updateInternals_fn).call(this, response);
|
|
807
812
|
}
|
|
808
813
|
async addPlayer(player, queue_type) {
|
|
809
814
|
if (this.players.length === 2) return this;
|
|
@@ -840,7 +845,7 @@ var GuildBet = class {
|
|
|
840
845
|
const payload = data;
|
|
841
846
|
const route = Routes.guilds.bets.update(this.guild.id, this._id);
|
|
842
847
|
const response = await this.rest.request({ method: "patch", url: route, payload });
|
|
843
|
-
return this.
|
|
848
|
+
return __privateMethod(this, _GuildBet_instances, updateInternals_fn).call(this, response);
|
|
844
849
|
}
|
|
845
850
|
async delete() {
|
|
846
851
|
const route = Routes.guilds.bets.delete(this.manager.guild.id, this._id);
|
|
@@ -852,33 +857,6 @@ var GuildBet = class {
|
|
|
852
857
|
this.manager.cache.delete(this._id);
|
|
853
858
|
return response;
|
|
854
859
|
}
|
|
855
|
-
_updateInternals(data) {
|
|
856
|
-
for (let key in data) {
|
|
857
|
-
if (key === "_id" || key === "createdAt") continue;
|
|
858
|
-
if (key === "messages") {
|
|
859
|
-
this.messages.set(data[key]);
|
|
860
|
-
continue;
|
|
861
|
-
}
|
|
862
|
-
if (key === "players") {
|
|
863
|
-
this.players._set(data[key]);
|
|
864
|
-
continue;
|
|
865
|
-
}
|
|
866
|
-
if (key in this) {
|
|
867
|
-
this[key] = data[key];
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
if (data?.messages?.length !== 0) {
|
|
871
|
-
if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
|
|
872
|
-
else {
|
|
873
|
-
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
874
|
-
this.messages.set(data.messages);
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
878
|
-
this.createdAt = new Date(data.createdAt);
|
|
879
|
-
this.manager.set(this);
|
|
880
|
-
return this;
|
|
881
|
-
}
|
|
882
860
|
toJSON() {
|
|
883
861
|
let json = {};
|
|
884
862
|
for (const [key, value] of Object.entries(this)) {
|
|
@@ -895,9 +873,38 @@ var GuildBet = class {
|
|
|
895
873
|
};
|
|
896
874
|
}
|
|
897
875
|
};
|
|
876
|
+
_GuildBet_instances = new WeakSet();
|
|
877
|
+
updateInternals_fn = function(data) {
|
|
878
|
+
for (let key in data) {
|
|
879
|
+
if (key === "_id" || key === "createdAt") continue;
|
|
880
|
+
if (key === "messages") {
|
|
881
|
+
this.messages.set(data[key]);
|
|
882
|
+
continue;
|
|
883
|
+
}
|
|
884
|
+
if (key === "players") {
|
|
885
|
+
this.players._set(data[key]);
|
|
886
|
+
continue;
|
|
887
|
+
}
|
|
888
|
+
if (key in this) {
|
|
889
|
+
this[key] = data[key];
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
if (data?.messages?.length !== 0) {
|
|
893
|
+
if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
|
|
894
|
+
else {
|
|
895
|
+
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
896
|
+
this.messages.set(data.messages);
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
900
|
+
this.createdAt = new Date(data.createdAt);
|
|
901
|
+
this.manager.set(this);
|
|
902
|
+
return this;
|
|
903
|
+
};
|
|
898
904
|
|
|
899
905
|
// src/structures/betuser/GuildBetUser.ts
|
|
900
|
-
var
|
|
906
|
+
var _GuildBetUser_instances, updateInternals_fn2;
|
|
907
|
+
var _GuildBetUser = class _GuildBetUser {
|
|
901
908
|
/**
|
|
902
909
|
* Bet user
|
|
903
910
|
* @param data The user's data
|
|
@@ -905,6 +912,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
905
912
|
* @param rest The rest client
|
|
906
913
|
*/
|
|
907
914
|
constructor(data, manager) {
|
|
915
|
+
__privateAdd(this, _GuildBetUser_instances);
|
|
908
916
|
/** User daily */
|
|
909
917
|
__publicField(this, "daily");
|
|
910
918
|
__publicField(this, "profile");
|
|
@@ -999,7 +1007,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
999
1007
|
url: route,
|
|
1000
1008
|
payload
|
|
1001
1009
|
});
|
|
1002
|
-
return this.
|
|
1010
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn2).call(this, response);
|
|
1003
1011
|
}
|
|
1004
1012
|
async updateProfile(data) {
|
|
1005
1013
|
const _data = {
|
|
@@ -1019,20 +1027,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
1019
1027
|
url: route,
|
|
1020
1028
|
payload: _data
|
|
1021
1029
|
});
|
|
1022
|
-
return this.
|
|
1023
|
-
}
|
|
1024
|
-
_updateInternals(data) {
|
|
1025
|
-
for (let key in data) {
|
|
1026
|
-
if (key === "id" || key === "createdAt") continue;
|
|
1027
|
-
if (key in this) {
|
|
1028
|
-
this[key] = data[key];
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1032
|
-
this.createdAt = new Date(data.createdAt);
|
|
1033
|
-
this.manager.set(this);
|
|
1034
|
-
this.rest.emit("betuserUpdate", this);
|
|
1035
|
-
return this;
|
|
1030
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn2).call(this, response);
|
|
1036
1031
|
}
|
|
1037
1032
|
/**
|
|
1038
1033
|
* Update certain property
|
|
@@ -1069,7 +1064,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
1069
1064
|
url: route,
|
|
1070
1065
|
payload
|
|
1071
1066
|
});
|
|
1072
|
-
return this.
|
|
1067
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn2).call(this, response);
|
|
1073
1068
|
}
|
|
1074
1069
|
async _update(data) {
|
|
1075
1070
|
const route = Routes.guilds.betusers.get(this.manager.guild.id, this.id);
|
|
@@ -1079,7 +1074,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
1079
1074
|
url: route,
|
|
1080
1075
|
payload
|
|
1081
1076
|
});
|
|
1082
|
-
return this.
|
|
1077
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn2).call(this, response);
|
|
1083
1078
|
}
|
|
1084
1079
|
async delete() {
|
|
1085
1080
|
const route = Routes.guilds.betusers.delete(this.manager.guild.id, this.id);
|
|
@@ -1103,10 +1098,27 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
1103
1098
|
return json;
|
|
1104
1099
|
}
|
|
1105
1100
|
};
|
|
1101
|
+
_GuildBetUser_instances = new WeakSet();
|
|
1102
|
+
updateInternals_fn2 = function(data) {
|
|
1103
|
+
for (let key in data) {
|
|
1104
|
+
if (key === "id" || key === "createdAt") continue;
|
|
1105
|
+
if (key in this) {
|
|
1106
|
+
this[key] = data[key];
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1110
|
+
this.createdAt = new Date(data.createdAt);
|
|
1111
|
+
this.manager.set(this);
|
|
1112
|
+
this.rest.emit("betuserUpdate", this);
|
|
1113
|
+
return this;
|
|
1114
|
+
};
|
|
1115
|
+
var GuildBetUser = _GuildBetUser;
|
|
1106
1116
|
|
|
1107
1117
|
// src/structures/logentry/LogEntry.ts
|
|
1118
|
+
var _LogEntry_instances, updateInternals_fn3;
|
|
1108
1119
|
var LogEntry = class {
|
|
1109
1120
|
constructor(data, manager) {
|
|
1121
|
+
__privateAdd(this, _LogEntry_instances);
|
|
1110
1122
|
__publicField(this, "_id");
|
|
1111
1123
|
__publicField(this, "guild_id");
|
|
1112
1124
|
__publicField(this, "user_id");
|
|
@@ -1142,9 +1154,9 @@ var LogEntry = class {
|
|
|
1142
1154
|
this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
|
|
1143
1155
|
}
|
|
1144
1156
|
async fetch() {
|
|
1145
|
-
const route = Routes.guilds
|
|
1157
|
+
const route = Routes.fields("guilds", this.guild.id, "logentries", this._id);
|
|
1146
1158
|
const response = await this.rest.request({ url: route, method: "GET" });
|
|
1147
|
-
return this.
|
|
1159
|
+
return __privateMethod(this, _LogEntry_instances, updateInternals_fn3).call(this, response);
|
|
1148
1160
|
}
|
|
1149
1161
|
toJSON() {
|
|
1150
1162
|
const json = {};
|
|
@@ -1155,21 +1167,23 @@ var LogEntry = class {
|
|
|
1155
1167
|
}
|
|
1156
1168
|
return json;
|
|
1157
1169
|
}
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1170
|
+
};
|
|
1171
|
+
_LogEntry_instances = new WeakSet();
|
|
1172
|
+
updateInternals_fn3 = function(data) {
|
|
1173
|
+
for (let key in data) {
|
|
1174
|
+
if (key === "id" || key === "createdAt") continue;
|
|
1175
|
+
if (key in this) {
|
|
1176
|
+
this[key] = data[key];
|
|
1164
1177
|
}
|
|
1165
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1166
|
-
this.manager.set(this);
|
|
1167
|
-
return this;
|
|
1168
1178
|
}
|
|
1179
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1180
|
+
this.manager.set(this);
|
|
1181
|
+
return this;
|
|
1169
1182
|
};
|
|
1170
1183
|
|
|
1171
1184
|
// src/structures/match/GuildMatch.ts
|
|
1172
|
-
var
|
|
1185
|
+
var _GuildMatch_instances, updateInternals_fn4;
|
|
1186
|
+
var _GuildMatch = class _GuildMatch {
|
|
1173
1187
|
/**
|
|
1174
1188
|
* GuildMatch match
|
|
1175
1189
|
* @param data The match's data
|
|
@@ -1177,6 +1191,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1177
1191
|
* @param rest The rest client
|
|
1178
1192
|
*/
|
|
1179
1193
|
constructor(data, manager) {
|
|
1194
|
+
__privateAdd(this, _GuildMatch_instances);
|
|
1180
1195
|
__publicField(this, "_id");
|
|
1181
1196
|
__publicField(this, "selections");
|
|
1182
1197
|
/** Match's type */
|
|
@@ -1260,7 +1275,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1260
1275
|
method: "get",
|
|
1261
1276
|
url: route
|
|
1262
1277
|
});
|
|
1263
|
-
return await this.
|
|
1278
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1264
1279
|
}
|
|
1265
1280
|
async addConfirmed(type, id) {
|
|
1266
1281
|
const confirmed = this.confirmed.find((c) => c.type === type);
|
|
@@ -1282,7 +1297,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1282
1297
|
url: route,
|
|
1283
1298
|
payload: set
|
|
1284
1299
|
});
|
|
1285
|
-
return await this.
|
|
1300
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1286
1301
|
}
|
|
1287
1302
|
async setStatus(status) {
|
|
1288
1303
|
Assertion.assertString(status);
|
|
@@ -1293,7 +1308,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1293
1308
|
url: route,
|
|
1294
1309
|
payload
|
|
1295
1310
|
});
|
|
1296
|
-
return await this.
|
|
1311
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1297
1312
|
}
|
|
1298
1313
|
async setWinners(players) {
|
|
1299
1314
|
if (!Array.isArray(players)) players = [players];
|
|
@@ -1304,7 +1319,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1304
1319
|
url: route,
|
|
1305
1320
|
payload
|
|
1306
1321
|
});
|
|
1307
|
-
return await this.
|
|
1322
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1308
1323
|
}
|
|
1309
1324
|
async setLoser(players) {
|
|
1310
1325
|
if (!Array.isArray(players)) players = [players];
|
|
@@ -1315,7 +1330,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1315
1330
|
url: route,
|
|
1316
1331
|
payload
|
|
1317
1332
|
});
|
|
1318
|
-
return await this.
|
|
1333
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1319
1334
|
}
|
|
1320
1335
|
async setMvps(...usersId) {
|
|
1321
1336
|
const payload = { set: usersId };
|
|
@@ -1325,7 +1340,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1325
1340
|
url: route,
|
|
1326
1341
|
payload
|
|
1327
1342
|
});
|
|
1328
|
-
return await this.
|
|
1343
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1329
1344
|
}
|
|
1330
1345
|
async setRoomCreatorId(userId) {
|
|
1331
1346
|
Assertion.assertString(userId);
|
|
@@ -1336,7 +1351,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1336
1351
|
url: route,
|
|
1337
1352
|
payload
|
|
1338
1353
|
});
|
|
1339
|
-
return await this.
|
|
1354
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1340
1355
|
}
|
|
1341
1356
|
async setRoomAdminId(userId) {
|
|
1342
1357
|
Assertion.assertString(userId);
|
|
@@ -1347,7 +1362,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1347
1362
|
url: route,
|
|
1348
1363
|
payload
|
|
1349
1364
|
});
|
|
1350
|
-
return await this.
|
|
1365
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1351
1366
|
}
|
|
1352
1367
|
async kick(player) {
|
|
1353
1368
|
this.players = this.players.filter((p) => p.id !== player.id);
|
|
@@ -1371,7 +1386,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
1371
1386
|
payload: data
|
|
1372
1387
|
});
|
|
1373
1388
|
this.rest.emit("matchUpdate", this, new _GuildMatch(response, this.manager));
|
|
1374
|
-
return await this.
|
|
1389
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn4).call(this, response);
|
|
1375
1390
|
}
|
|
1376
1391
|
async delete() {
|
|
1377
1392
|
const route = Routes.guilds.matches.resource(this.guild.id, this._id);
|
|
@@ -1397,35 +1412,38 @@ var GuildMatch = class _GuildMatch {
|
|
|
1397
1412
|
messages: this?.messages instanceof MessagesManager ? this.messages?.cache?.toArray() : []
|
|
1398
1413
|
};
|
|
1399
1414
|
}
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
this.bet = this.guild.bets.set(data.bet);
|
|
1409
|
-
}
|
|
1415
|
+
};
|
|
1416
|
+
_GuildMatch_instances = new WeakSet();
|
|
1417
|
+
updateInternals_fn4 = async function(data) {
|
|
1418
|
+
if (!data) return;
|
|
1419
|
+
for (let key in data) {
|
|
1420
|
+
if (key === "id" || key === "createdAt" || key === "messages") continue;
|
|
1421
|
+
if (key in this) {
|
|
1422
|
+
this[key] = data[key];
|
|
1410
1423
|
}
|
|
1411
|
-
if (
|
|
1412
|
-
|
|
1413
|
-
else {
|
|
1414
|
-
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
1415
|
-
this.messages.set(data.messages);
|
|
1416
|
-
}
|
|
1424
|
+
if (key === "bet") {
|
|
1425
|
+
this.bet = this.guild.bets.set(data.bet);
|
|
1417
1426
|
}
|
|
1418
|
-
|
|
1419
|
-
|
|
1427
|
+
}
|
|
1428
|
+
if (data?.messages?.length !== 0) {
|
|
1429
|
+
if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
|
|
1430
|
+
else {
|
|
1431
|
+
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
1432
|
+
this.messages.set(data.messages);
|
|
1420
1433
|
}
|
|
1421
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1422
|
-
this.manager.set(this);
|
|
1423
|
-
return this;
|
|
1424
1434
|
}
|
|
1435
|
+
if (!(this.bet instanceof GuildBet) && data?.bet) {
|
|
1436
|
+
this.bet = this.guild.bets.cache.get(data._id) ?? await this.guild.bets.fetch({ betId: data?.bet?._id });
|
|
1437
|
+
}
|
|
1438
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1439
|
+
this.manager.set(this);
|
|
1440
|
+
return this;
|
|
1425
1441
|
};
|
|
1442
|
+
var GuildMatch = _GuildMatch;
|
|
1426
1443
|
|
|
1427
1444
|
// src/structures/mediator/GuildMediator.ts
|
|
1428
|
-
var
|
|
1445
|
+
var _GuildMediator_instances, updateInternals_fn5;
|
|
1446
|
+
var _GuildMediator = class _GuildMediator {
|
|
1429
1447
|
/**
|
|
1430
1448
|
* Bet user
|
|
1431
1449
|
* @param data The user's data
|
|
@@ -1433,6 +1451,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1433
1451
|
* @param rest The rest client
|
|
1434
1452
|
*/
|
|
1435
1453
|
constructor(data, manager) {
|
|
1454
|
+
__privateAdd(this, _GuildMediator_instances);
|
|
1436
1455
|
/** User's name */
|
|
1437
1456
|
__publicField(this, "id");
|
|
1438
1457
|
__publicField(this, "guild_id");
|
|
@@ -1491,19 +1510,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1491
1510
|
url: route,
|
|
1492
1511
|
payload
|
|
1493
1512
|
});
|
|
1494
|
-
return this.
|
|
1495
|
-
}
|
|
1496
|
-
_updateInternals(data) {
|
|
1497
|
-
for (let key in data) {
|
|
1498
|
-
if (key === "id" || key === "createdAt") continue;
|
|
1499
|
-
if (key in this) {
|
|
1500
|
-
this[key] = data[key];
|
|
1501
|
-
}
|
|
1502
|
-
}
|
|
1503
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1504
|
-
this.createdAt = new Date(data.createdAt);
|
|
1505
|
-
this.manager.set(this);
|
|
1506
|
-
return this;
|
|
1513
|
+
return __privateMethod(this, _GuildMediator_instances, updateInternals_fn5).call(this, response);
|
|
1507
1514
|
}
|
|
1508
1515
|
/**
|
|
1509
1516
|
* Update certain property
|
|
@@ -1518,7 +1525,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1518
1525
|
url: route,
|
|
1519
1526
|
payload
|
|
1520
1527
|
});
|
|
1521
|
-
return this.
|
|
1528
|
+
return __privateMethod(this, _GuildMediator_instances, updateInternals_fn5).call(this, response);
|
|
1522
1529
|
}
|
|
1523
1530
|
async setPaymentlink(type, link) {
|
|
1524
1531
|
const route = Routes.guilds.mediators.get(this.manager.guild.id, this.id);
|
|
@@ -1528,7 +1535,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1528
1535
|
url: route,
|
|
1529
1536
|
payload
|
|
1530
1537
|
});
|
|
1531
|
-
return this.
|
|
1538
|
+
return __privateMethod(this, _GuildMediator_instances, updateInternals_fn5).call(this, response);
|
|
1532
1539
|
}
|
|
1533
1540
|
async delete() {
|
|
1534
1541
|
const route = Routes.guilds.mediators.delete(this.manager.guild.id, this.id);
|
|
@@ -1551,9 +1558,24 @@ var GuildMediator = class _GuildMediator {
|
|
|
1551
1558
|
return json;
|
|
1552
1559
|
}
|
|
1553
1560
|
};
|
|
1561
|
+
_GuildMediator_instances = new WeakSet();
|
|
1562
|
+
updateInternals_fn5 = function(data) {
|
|
1563
|
+
for (let key in data) {
|
|
1564
|
+
if (key === "id" || key === "createdAt") continue;
|
|
1565
|
+
if (key in this) {
|
|
1566
|
+
this[key] = data[key];
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1570
|
+
this.createdAt = new Date(data.createdAt);
|
|
1571
|
+
this.manager.set(this);
|
|
1572
|
+
return this;
|
|
1573
|
+
};
|
|
1574
|
+
var GuildMediator = _GuildMediator;
|
|
1554
1575
|
|
|
1555
1576
|
// src/structures/user/GuildUser.ts
|
|
1556
|
-
var
|
|
1577
|
+
var _GuildUser_instances, updateInternals_fn6;
|
|
1578
|
+
var _GuildUser = class _GuildUser {
|
|
1557
1579
|
/**
|
|
1558
1580
|
* Bet user
|
|
1559
1581
|
* @param data The user's data
|
|
@@ -1561,6 +1583,7 @@ var GuildUser = class _GuildUser {
|
|
|
1561
1583
|
* @param rest The rest client
|
|
1562
1584
|
*/
|
|
1563
1585
|
constructor(data, manager) {
|
|
1586
|
+
__privateAdd(this, _GuildUser_instances);
|
|
1564
1587
|
/** User's id */
|
|
1565
1588
|
__publicField(this, "id");
|
|
1566
1589
|
__publicField(this, "guild_id");
|
|
@@ -1673,7 +1696,7 @@ var GuildUser = class _GuildUser {
|
|
|
1673
1696
|
url: route,
|
|
1674
1697
|
payload
|
|
1675
1698
|
});
|
|
1676
|
-
this.
|
|
1699
|
+
__privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1677
1700
|
return this;
|
|
1678
1701
|
}
|
|
1679
1702
|
async updateProfile(data) {
|
|
@@ -1694,43 +1717,14 @@ var GuildUser = class _GuildUser {
|
|
|
1694
1717
|
url: route,
|
|
1695
1718
|
payload: _data
|
|
1696
1719
|
});
|
|
1697
|
-
this.
|
|
1698
|
-
return this;
|
|
1699
|
-
}
|
|
1700
|
-
_updateInternals(data) {
|
|
1701
|
-
for (let key in data) {
|
|
1702
|
-
if (key === "id" || key === "createdAt") continue;
|
|
1703
|
-
if (key in this) {
|
|
1704
|
-
this[key] = data[key];
|
|
1705
|
-
}
|
|
1706
|
-
if (key === "adverts") {
|
|
1707
|
-
this.adverts = [];
|
|
1708
|
-
for (let _adv of data.adverts) {
|
|
1709
|
-
this.adverts.push({
|
|
1710
|
-
_id: _adv._id,
|
|
1711
|
-
admin_id: _adv.admin_id,
|
|
1712
|
-
role_id: _adv.role_id,
|
|
1713
|
-
reason: _adv.reason,
|
|
1714
|
-
points_removed: _adv.points_removed,
|
|
1715
|
-
proof: _adv.proof,
|
|
1716
|
-
proof_ext: _adv.proof_ext,
|
|
1717
|
-
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
1718
|
-
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
1719
|
-
});
|
|
1720
|
-
}
|
|
1721
|
-
}
|
|
1722
|
-
}
|
|
1723
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1724
|
-
this.createdAt = new Date(data.createdAt);
|
|
1725
|
-
this.manager.set(this);
|
|
1726
|
-
this.rest.emit("userUpdate", this);
|
|
1720
|
+
__privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1727
1721
|
return this;
|
|
1728
1722
|
}
|
|
1729
1723
|
async addAdvert(data) {
|
|
1730
1724
|
const route = Routes.guilds.users.resource(this.manager.guild.id, this.id, "adverts");
|
|
1731
1725
|
const payload = data;
|
|
1732
1726
|
const response = await this.rest.request({ method: "POST", url: route, payload });
|
|
1733
|
-
return this.
|
|
1727
|
+
return __privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1734
1728
|
}
|
|
1735
1729
|
async removeAdvert(advertId) {
|
|
1736
1730
|
let advs = this.adverts;
|
|
@@ -1739,7 +1733,7 @@ var GuildUser = class _GuildUser {
|
|
|
1739
1733
|
const payload = { adverts: advs };
|
|
1740
1734
|
const route = Routes.guilds.users.update(this.manager.guild.id, this.id);
|
|
1741
1735
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
1742
|
-
return this.
|
|
1736
|
+
return __privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1743
1737
|
}
|
|
1744
1738
|
/**
|
|
1745
1739
|
* Update certain property
|
|
@@ -1790,7 +1784,7 @@ var GuildUser = class _GuildUser {
|
|
|
1790
1784
|
url: route,
|
|
1791
1785
|
payload
|
|
1792
1786
|
});
|
|
1793
|
-
this.
|
|
1787
|
+
__privateMethod(this, _GuildUser_instances, updateInternals_fn6).call(this, response);
|
|
1794
1788
|
return this;
|
|
1795
1789
|
}
|
|
1796
1790
|
async delete() {
|
|
@@ -1815,6 +1809,37 @@ var GuildUser = class _GuildUser {
|
|
|
1815
1809
|
return json;
|
|
1816
1810
|
}
|
|
1817
1811
|
};
|
|
1812
|
+
_GuildUser_instances = new WeakSet();
|
|
1813
|
+
updateInternals_fn6 = function(data) {
|
|
1814
|
+
for (let key in data) {
|
|
1815
|
+
if (key === "id" || key === "createdAt") continue;
|
|
1816
|
+
if (key in this) {
|
|
1817
|
+
this[key] = data[key];
|
|
1818
|
+
}
|
|
1819
|
+
if (key === "adverts") {
|
|
1820
|
+
this.adverts = [];
|
|
1821
|
+
for (let _adv of data.adverts) {
|
|
1822
|
+
this.adverts.push({
|
|
1823
|
+
_id: _adv._id,
|
|
1824
|
+
admin_id: _adv.admin_id,
|
|
1825
|
+
role_id: _adv.role_id,
|
|
1826
|
+
reason: _adv.reason,
|
|
1827
|
+
points_removed: _adv.points_removed,
|
|
1828
|
+
proof: _adv.proof,
|
|
1829
|
+
proof_ext: _adv.proof_ext,
|
|
1830
|
+
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
1831
|
+
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
1832
|
+
});
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1837
|
+
this.createdAt = new Date(data.createdAt);
|
|
1838
|
+
this.manager.set(this);
|
|
1839
|
+
this.rest.emit("userUpdate", this);
|
|
1840
|
+
return this;
|
|
1841
|
+
};
|
|
1842
|
+
var GuildUser = _GuildUser;
|
|
1818
1843
|
|
|
1819
1844
|
// src/structures/vipmember/VipMember.ts
|
|
1820
1845
|
var _VipMember_instances, updateData_fn;
|
|
@@ -1953,8 +1978,10 @@ updateData_fn = function(data) {
|
|
|
1953
1978
|
var VipMember = _VipMember;
|
|
1954
1979
|
|
|
1955
1980
|
// src/structures/ticket/Ticket.ts
|
|
1981
|
+
var _GuildTicket_instances, updateInternals_fn7;
|
|
1956
1982
|
var GuildTicket = class {
|
|
1957
1983
|
constructor(data, manager) {
|
|
1984
|
+
__privateAdd(this, _GuildTicket_instances);
|
|
1958
1985
|
__publicField(this, "_id");
|
|
1959
1986
|
__publicField(this, "guild_id");
|
|
1960
1987
|
__publicField(this, "type");
|
|
@@ -1991,7 +2018,7 @@ var GuildTicket = class {
|
|
|
1991
2018
|
method: "GET",
|
|
1992
2019
|
url: route
|
|
1993
2020
|
});
|
|
1994
|
-
return this.
|
|
2021
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
1995
2022
|
}
|
|
1996
2023
|
async setCustomerRating(rating) {
|
|
1997
2024
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "customer_rating");
|
|
@@ -2001,7 +2028,7 @@ var GuildTicket = class {
|
|
|
2001
2028
|
url: route,
|
|
2002
2029
|
payload
|
|
2003
2030
|
});
|
|
2004
|
-
return this.
|
|
2031
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2005
2032
|
}
|
|
2006
2033
|
async setAdminId(id) {
|
|
2007
2034
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "admin_id");
|
|
@@ -2011,7 +2038,7 @@ var GuildTicket = class {
|
|
|
2011
2038
|
url: route,
|
|
2012
2039
|
payload
|
|
2013
2040
|
});
|
|
2014
|
-
return this.
|
|
2041
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2015
2042
|
}
|
|
2016
2043
|
async setChannelId(id) {
|
|
2017
2044
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "channel_id");
|
|
@@ -2021,7 +2048,7 @@ var GuildTicket = class {
|
|
|
2021
2048
|
url: route,
|
|
2022
2049
|
payload
|
|
2023
2050
|
});
|
|
2024
|
-
return this.
|
|
2051
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2025
2052
|
}
|
|
2026
2053
|
async setClosedById(id) {
|
|
2027
2054
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "closed_by_id");
|
|
@@ -2031,7 +2058,7 @@ var GuildTicket = class {
|
|
|
2031
2058
|
url: route,
|
|
2032
2059
|
payload
|
|
2033
2060
|
});
|
|
2034
|
-
return this.
|
|
2061
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2035
2062
|
}
|
|
2036
2063
|
async setStatus(status) {
|
|
2037
2064
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "status");
|
|
@@ -2041,7 +2068,7 @@ var GuildTicket = class {
|
|
|
2041
2068
|
url: route,
|
|
2042
2069
|
payload
|
|
2043
2070
|
});
|
|
2044
|
-
return this.
|
|
2071
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2045
2072
|
}
|
|
2046
2073
|
async addMessage(message) {
|
|
2047
2074
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "messages");
|
|
@@ -2051,26 +2078,28 @@ var GuildTicket = class {
|
|
|
2051
2078
|
url: route,
|
|
2052
2079
|
payload
|
|
2053
2080
|
});
|
|
2054
|
-
return this.
|
|
2055
|
-
}
|
|
2056
|
-
_updateInternals(data) {
|
|
2057
|
-
for (let key in data) {
|
|
2058
|
-
if (key === "id" || key === "createdAt") continue;
|
|
2059
|
-
if (key in this) {
|
|
2060
|
-
this[key] = data[key];
|
|
2061
|
-
}
|
|
2062
|
-
}
|
|
2063
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2064
|
-
this.createdAt = new Date(data.createdAt);
|
|
2065
|
-
this.manager.set(this);
|
|
2066
|
-
return this;
|
|
2081
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn7).call(this, response);
|
|
2067
2082
|
}
|
|
2068
2083
|
};
|
|
2084
|
+
_GuildTicket_instances = new WeakSet();
|
|
2085
|
+
updateInternals_fn7 = function(data) {
|
|
2086
|
+
for (let key in data) {
|
|
2087
|
+
if (key === "id" || key === "createdAt") continue;
|
|
2088
|
+
if (key in this) {
|
|
2089
|
+
this[key] = data[key];
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2093
|
+
this.createdAt = new Date(data.createdAt);
|
|
2094
|
+
this.manager.set(this);
|
|
2095
|
+
return this;
|
|
2096
|
+
};
|
|
2069
2097
|
|
|
2070
2098
|
// src/structures/automaticmessage/AutomaticMessage.ts
|
|
2099
|
+
var _AutomaticMessage_instances, updateInternals_fn8;
|
|
2071
2100
|
var AutomaticMessage = class {
|
|
2072
2101
|
constructor(data, manager) {
|
|
2073
|
-
|
|
2102
|
+
__privateAdd(this, _AutomaticMessage_instances);
|
|
2074
2103
|
__publicField(this, "id");
|
|
2075
2104
|
__publicField(this, "type");
|
|
2076
2105
|
__publicField(this, "admin_id");
|
|
@@ -2089,7 +2118,6 @@ var AutomaticMessage = class {
|
|
|
2089
2118
|
this.manager = manager;
|
|
2090
2119
|
this.guild = manager.guild;
|
|
2091
2120
|
this.rest = manager.rest;
|
|
2092
|
-
this._id = data?._id;
|
|
2093
2121
|
this.id = data?.id;
|
|
2094
2122
|
this.type = data?.type;
|
|
2095
2123
|
this.admin_id = data?.admin_id;
|
|
@@ -2104,12 +2132,7 @@ var AutomaticMessage = class {
|
|
|
2104
2132
|
this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
|
|
2105
2133
|
}
|
|
2106
2134
|
async fetch() {
|
|
2107
|
-
|
|
2108
|
-
const response = await this.rest.request({
|
|
2109
|
-
method: "get",
|
|
2110
|
-
url: route
|
|
2111
|
-
});
|
|
2112
|
-
return this._updateInternals(response);
|
|
2135
|
+
return this.manager.fetch(this.id);
|
|
2113
2136
|
}
|
|
2114
2137
|
async addChannelId(...id) {
|
|
2115
2138
|
const ids = [.../* @__PURE__ */ new Set([...this.channel_ids, ...id])];
|
|
@@ -2121,39 +2144,28 @@ var AutomaticMessage = class {
|
|
|
2121
2144
|
return this.update({ channel_ids: ids });
|
|
2122
2145
|
}
|
|
2123
2146
|
async update(data) {
|
|
2147
|
+
this.manager.cache.set(this.id, { ...this, ...data, id: this.id });
|
|
2124
2148
|
const route = Routes.guilds.get(this.guild.id);
|
|
2125
2149
|
const response = await this.rest.request({
|
|
2126
2150
|
method: "patch",
|
|
2127
2151
|
url: route,
|
|
2128
|
-
payload: { automatic_messages: this.manager.
|
|
2152
|
+
payload: { automatic_messages: this.manager.toJSON() }
|
|
2129
2153
|
});
|
|
2130
|
-
return this.
|
|
2154
|
+
return __privateMethod(this, _AutomaticMessage_instances, updateInternals_fn8).call(this, response);
|
|
2131
2155
|
}
|
|
2132
2156
|
async delete() {
|
|
2133
|
-
this.manager.cache.delete(this.
|
|
2157
|
+
this.manager.cache.delete(this.id);
|
|
2158
|
+
this.guild.automatic_messages = this.manager.cache.toArray();
|
|
2134
2159
|
const route = Routes.guilds.get(this.guild.id);
|
|
2135
2160
|
const response = await this.rest.request({
|
|
2136
2161
|
method: "patch",
|
|
2137
2162
|
url: route,
|
|
2138
|
-
payload: { automatic_messages: this.manager.
|
|
2163
|
+
payload: { automatic_messages: this.manager.toJSON() }
|
|
2139
2164
|
});
|
|
2140
2165
|
return this.manager.set(response.automatic_messages);
|
|
2141
2166
|
}
|
|
2142
|
-
_updateInternals(data) {
|
|
2143
|
-
for (let key in data) {
|
|
2144
|
-
if (key === "_id" || key === "createdAt") continue;
|
|
2145
|
-
if (key in this) {
|
|
2146
|
-
this[key] = data[key];
|
|
2147
|
-
}
|
|
2148
|
-
}
|
|
2149
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2150
|
-
this.createdAt = new Date(data.createdAt);
|
|
2151
|
-
this.manager._add(this);
|
|
2152
|
-
return this;
|
|
2153
|
-
}
|
|
2154
2167
|
toJSON() {
|
|
2155
2168
|
return {
|
|
2156
|
-
_id: this._id,
|
|
2157
2169
|
id: this.id,
|
|
2158
2170
|
type: this.type,
|
|
2159
2171
|
admin_id: this.admin_id,
|
|
@@ -2169,6 +2181,20 @@ var AutomaticMessage = class {
|
|
|
2169
2181
|
};
|
|
2170
2182
|
}
|
|
2171
2183
|
};
|
|
2184
|
+
_AutomaticMessage_instances = new WeakSet();
|
|
2185
|
+
updateInternals_fn8 = function(data) {
|
|
2186
|
+
const _this = data?.automatic_messages?.find((m) => m.id === this.id);
|
|
2187
|
+
for (let key in _this) {
|
|
2188
|
+
if (key === "id" || key === "createdAt") continue;
|
|
2189
|
+
if (key in this) {
|
|
2190
|
+
this[key] = _this[key];
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2194
|
+
this.createdAt = new Date(data.createdAt);
|
|
2195
|
+
this.manager._add(data.automatic_messages);
|
|
2196
|
+
return this;
|
|
2197
|
+
};
|
|
2172
2198
|
|
|
2173
2199
|
// src/utils/randomKeyGenerator.ts
|
|
2174
2200
|
import { randomBytes } from "crypto";
|
|
@@ -2182,25 +2208,19 @@ var AutomaticMessageManager = class extends BaseManager {
|
|
|
2182
2208
|
super(guild);
|
|
2183
2209
|
this.guild = guild;
|
|
2184
2210
|
this.rest = guild.rest;
|
|
2185
|
-
this.base_url = Routes.guilds.resource(guild.id
|
|
2211
|
+
this.base_url = Routes.guilds.resource(guild.id);
|
|
2186
2212
|
this.cache = new Collection();
|
|
2187
2213
|
if (guild.automatic_messages && guild.automatic_messages.length !== 0) this.set(guild.automatic_messages);
|
|
2188
2214
|
else this.guild.automatic_messages = [];
|
|
2189
2215
|
}
|
|
2190
2216
|
async fetch(messageId) {
|
|
2191
2217
|
const route = this.base_url;
|
|
2192
|
-
if (messageId) {
|
|
2193
|
-
const response2 = await this.rest.request({
|
|
2194
|
-
method: "get",
|
|
2195
|
-
url: `${route}`
|
|
2196
|
-
});
|
|
2197
|
-
return this._add(response2).find((m) => m.id === messageId);
|
|
2198
|
-
}
|
|
2199
2218
|
const response = await this.rest.request({
|
|
2200
2219
|
method: "get",
|
|
2201
2220
|
url: route
|
|
2202
2221
|
});
|
|
2203
|
-
|
|
2222
|
+
this._add(response.automatic_messages);
|
|
2223
|
+
return this.cache;
|
|
2204
2224
|
}
|
|
2205
2225
|
async create(data) {
|
|
2206
2226
|
if (!data.type) throw new Error(`Missing message's type.`);
|
|
@@ -2227,6 +2247,7 @@ var AutomaticMessageManager = class extends BaseManager {
|
|
|
2227
2247
|
if (data instanceof AutomaticMessage) this.cache.set(data.id, data);
|
|
2228
2248
|
else this.cache.set(data.id, new AutomaticMessage(data, this));
|
|
2229
2249
|
}
|
|
2250
|
+
this.guild.automatic_messages = this.cache.toArray();
|
|
2230
2251
|
return this.cache;
|
|
2231
2252
|
}
|
|
2232
2253
|
set(data) {
|
|
@@ -2255,6 +2276,10 @@ var AutomaticMessageManager = class extends BaseManager {
|
|
|
2255
2276
|
});
|
|
2256
2277
|
return response;
|
|
2257
2278
|
}
|
|
2279
|
+
toJSON() {
|
|
2280
|
+
[...this.cache.values()].map((m) => console.log(m instanceof AutomaticMessage));
|
|
2281
|
+
return this.cache.toArray();
|
|
2282
|
+
}
|
|
2258
2283
|
};
|
|
2259
2284
|
|
|
2260
2285
|
// src/managers/bet/GuildBetManager.ts
|
|
@@ -2772,15 +2797,14 @@ var GuildTicketManager = class {
|
|
|
2772
2797
|
} else {
|
|
2773
2798
|
categories.push(data);
|
|
2774
2799
|
}
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2800
|
+
return this.guild.update({
|
|
2801
|
+
tickets_configuration: {
|
|
2802
|
+
categories,
|
|
2803
|
+
creationCategory: this.guild.tickets_configuration.creationCategory,
|
|
2804
|
+
deletionCategory: this.guild.tickets_configuration.deletionCategory,
|
|
2805
|
+
rating_channel_id: this.guild.tickets_configuration.rating_channel_id
|
|
2806
|
+
}
|
|
2781
2807
|
});
|
|
2782
|
-
this.guild._updateInternals(response);
|
|
2783
|
-
return response;
|
|
2784
2808
|
}
|
|
2785
2809
|
async deleteTicketCategory(data) {
|
|
2786
2810
|
let categories = this.guild.tickets_configuration.categories;
|
|
@@ -2794,8 +2818,14 @@ var GuildTicketManager = class {
|
|
|
2794
2818
|
url: route,
|
|
2795
2819
|
payload
|
|
2796
2820
|
});
|
|
2797
|
-
this.guild.
|
|
2798
|
-
|
|
2821
|
+
return this.guild.update({
|
|
2822
|
+
tickets_configuration: {
|
|
2823
|
+
categories,
|
|
2824
|
+
creationCategory: this.guild.tickets_configuration.creationCategory,
|
|
2825
|
+
deletionCategory: this.guild.tickets_configuration.deletionCategory,
|
|
2826
|
+
rating_channel_id: this.guild.tickets_configuration.rating_channel_id
|
|
2827
|
+
}
|
|
2828
|
+
});
|
|
2799
2829
|
}
|
|
2800
2830
|
async fetch(options) {
|
|
2801
2831
|
if (options && options.cache) return this.cache;
|
|
@@ -3061,14 +3091,150 @@ var VipMemberManager = class extends BaseManager {
|
|
|
3061
3091
|
}
|
|
3062
3092
|
};
|
|
3063
3093
|
|
|
3094
|
+
// src/structures/tournament/Tournament.ts
|
|
3095
|
+
var _Tournament_instances, updateInternals_fn9;
|
|
3096
|
+
var Tournament = class {
|
|
3097
|
+
constructor(data, manager) {
|
|
3098
|
+
__privateAdd(this, _Tournament_instances);
|
|
3099
|
+
__publicField(this, "_id");
|
|
3100
|
+
__publicField(this, "guild_id");
|
|
3101
|
+
__publicField(this, "type");
|
|
3102
|
+
__publicField(this, "max_teams");
|
|
3103
|
+
__publicField(this, "teams");
|
|
3104
|
+
__publicField(this, "message");
|
|
3105
|
+
__publicField(this, "message_id");
|
|
3106
|
+
__publicField(this, "status");
|
|
3107
|
+
__publicField(this, "createdAt");
|
|
3108
|
+
__publicField(this, "updatedAt");
|
|
3109
|
+
__publicField(this, "guild");
|
|
3110
|
+
__publicField(this, "rest");
|
|
3111
|
+
__publicField(this, "manager");
|
|
3112
|
+
__publicField(this, "data");
|
|
3113
|
+
this.manager = manager;
|
|
3114
|
+
this.guild = manager.guild;
|
|
3115
|
+
this.rest = manager.rest;
|
|
3116
|
+
this.guild_id = data?.guild_id;
|
|
3117
|
+
this.type = data?.type;
|
|
3118
|
+
this.teams = data?.teams;
|
|
3119
|
+
this.message = data?.message;
|
|
3120
|
+
this.message_id = data?.message_id;
|
|
3121
|
+
this.status = data?.status;
|
|
3122
|
+
this.createdAt = data?.createdAt ? new Date(data?.createdAt) : /* @__PURE__ */ new Date();
|
|
3123
|
+
this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
|
|
3124
|
+
this.data = data;
|
|
3125
|
+
}
|
|
3126
|
+
async fetch() {
|
|
3127
|
+
const route = Routes.fields("guilds", this.guild.id, "tournaments", this._id);
|
|
3128
|
+
const response = await this.rest.request({
|
|
3129
|
+
method: "get",
|
|
3130
|
+
url: route
|
|
3131
|
+
});
|
|
3132
|
+
return __privateMethod(this, _Tournament_instances, updateInternals_fn9).call(this, response);
|
|
3133
|
+
}
|
|
3134
|
+
async update(data) {
|
|
3135
|
+
const route = Routes.fields("guilds", this.guild.id, "tournaments", this._id);
|
|
3136
|
+
const response = await this.rest.request({
|
|
3137
|
+
method: "patch",
|
|
3138
|
+
url: route,
|
|
3139
|
+
payload: data
|
|
3140
|
+
});
|
|
3141
|
+
return __privateMethod(this, _Tournament_instances, updateInternals_fn9).call(this, response);
|
|
3142
|
+
}
|
|
3143
|
+
toJSON() {
|
|
3144
|
+
return {
|
|
3145
|
+
guild_id: this.guild_id,
|
|
3146
|
+
type: this.type,
|
|
3147
|
+
max_teams: this.max_teams,
|
|
3148
|
+
teams: this.teams,
|
|
3149
|
+
message: this.message,
|
|
3150
|
+
message_id: this.message_id,
|
|
3151
|
+
status: this.status,
|
|
3152
|
+
createdAt: this.createdAt ? new Date(this?.createdAt) : /* @__PURE__ */ new Date(),
|
|
3153
|
+
updatedAt: this.updatedAt ? new Date(this?.updatedAt) : /* @__PURE__ */ new Date()
|
|
3154
|
+
};
|
|
3155
|
+
}
|
|
3156
|
+
};
|
|
3157
|
+
_Tournament_instances = new WeakSet();
|
|
3158
|
+
updateInternals_fn9 = function(data) {
|
|
3159
|
+
for (let key in data) {
|
|
3160
|
+
if (key === "id" || key === "createdAt") continue;
|
|
3161
|
+
if (key in this) {
|
|
3162
|
+
this[key] = data[key];
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
3166
|
+
this.createdAt = new Date(data.createdAt);
|
|
3167
|
+
this.manager._add(this);
|
|
3168
|
+
return this;
|
|
3169
|
+
};
|
|
3170
|
+
|
|
3171
|
+
// src/managers/tournament/TournamentManager.ts
|
|
3172
|
+
var TournamentManager = class extends BaseManager {
|
|
3173
|
+
constructor(guild) {
|
|
3174
|
+
super(guild);
|
|
3175
|
+
this.guild = guild;
|
|
3176
|
+
this.rest = guild.rest;
|
|
3177
|
+
this.base_url = Routes.guilds.resource(guild.id, "tournaments");
|
|
3178
|
+
this.cache = new Collection();
|
|
3179
|
+
}
|
|
3180
|
+
async fetch(options) {
|
|
3181
|
+
if (options && options.cache) return this.cache;
|
|
3182
|
+
if (options && options.tournamentId) {
|
|
3183
|
+
const response2 = await this.rest.request({
|
|
3184
|
+
method: "GET",
|
|
3185
|
+
url: Routes.fields(this.base_url, options.tournamentId)
|
|
3186
|
+
});
|
|
3187
|
+
const tournament = new Tournament(response2, this);
|
|
3188
|
+
this._add(tournament);
|
|
3189
|
+
return tournament;
|
|
3190
|
+
}
|
|
3191
|
+
const response = await this.rest.request({
|
|
3192
|
+
method: "GET",
|
|
3193
|
+
url: this.base_url
|
|
3194
|
+
});
|
|
3195
|
+
return this.set(response);
|
|
3196
|
+
}
|
|
3197
|
+
set(data) {
|
|
3198
|
+
this.cache.clear();
|
|
3199
|
+
if (Array.isArray(data)) {
|
|
3200
|
+
for (let _m of data) {
|
|
3201
|
+
if (!_m._id) continue;
|
|
3202
|
+
if (_m instanceof Tournament) this.cache.set(_m._id, _m);
|
|
3203
|
+
else this.cache.set(_m._id, new Tournament(_m, this));
|
|
3204
|
+
}
|
|
3205
|
+
} else {
|
|
3206
|
+
if (!data._id) return this.cache;
|
|
3207
|
+
if (data instanceof Tournament) this.cache.set(data._id, data);
|
|
3208
|
+
else this.cache.set(data._id, new Tournament(data, this));
|
|
3209
|
+
}
|
|
3210
|
+
return this.cache;
|
|
3211
|
+
}
|
|
3212
|
+
_add(data) {
|
|
3213
|
+
if (Array.isArray(data)) {
|
|
3214
|
+
for (let _m of data) {
|
|
3215
|
+
if (!_m._id) continue;
|
|
3216
|
+
if (_m instanceof Tournament) this.cache.set(_m._id, _m);
|
|
3217
|
+
else this.cache.set(_m._id, new Tournament(_m, this));
|
|
3218
|
+
}
|
|
3219
|
+
} else {
|
|
3220
|
+
if (!data._id) return this.cache;
|
|
3221
|
+
if (data instanceof Tournament) this.cache.set(data._id, data);
|
|
3222
|
+
else this.cache.set(data._id, new Tournament(data, this));
|
|
3223
|
+
}
|
|
3224
|
+
return this.cache;
|
|
3225
|
+
}
|
|
3226
|
+
};
|
|
3227
|
+
|
|
3064
3228
|
// src/structures/guild/Guild.ts
|
|
3065
|
-
var
|
|
3229
|
+
var _Guild_instances, updateInternals_fn10;
|
|
3230
|
+
var Guild6 = class {
|
|
3066
3231
|
/**
|
|
3067
3232
|
* The guild structure
|
|
3068
3233
|
* @param data The guild's data
|
|
3069
3234
|
* @param rest The rest client
|
|
3070
3235
|
*/
|
|
3071
3236
|
constructor(data, rest) {
|
|
3237
|
+
__privateAdd(this, _Guild_instances);
|
|
3072
3238
|
/** The data of this guild */
|
|
3073
3239
|
__publicField(this, "data");
|
|
3074
3240
|
/** The rest client */
|
|
@@ -3094,6 +3260,7 @@ var Guild5 = class {
|
|
|
3094
3260
|
__publicField(this, "roulette_settings");
|
|
3095
3261
|
/** Guild Prefix */
|
|
3096
3262
|
__publicField(this, "prefix");
|
|
3263
|
+
__publicField(this, "prefixes");
|
|
3097
3264
|
/** Guild Creation Date */
|
|
3098
3265
|
__publicField(this, "createdAt");
|
|
3099
3266
|
/** Guild Updated Date */
|
|
@@ -3113,6 +3280,7 @@ var Guild5 = class {
|
|
|
3113
3280
|
__publicField(this, "mediators");
|
|
3114
3281
|
__publicField(this, "automatic_messages");
|
|
3115
3282
|
__publicField(this, "automaticMessagesManager");
|
|
3283
|
+
__publicField(this, "tournaments");
|
|
3116
3284
|
__publicField(this, "adverts");
|
|
3117
3285
|
__publicField(this, "codes");
|
|
3118
3286
|
__publicField(this, "coin_symbol");
|
|
@@ -3127,6 +3295,7 @@ var Guild5 = class {
|
|
|
3127
3295
|
this.scores = data?.scores;
|
|
3128
3296
|
this.codes = data?.codes;
|
|
3129
3297
|
this.prefix = data?.prefix;
|
|
3298
|
+
this.prefixes = data?.prefixes;
|
|
3130
3299
|
this.status = data?.status;
|
|
3131
3300
|
this.tickets_configuration = data?.tickets_configuration;
|
|
3132
3301
|
this.automatic_messages = data?.automatic_messages;
|
|
@@ -3147,6 +3316,7 @@ var Guild5 = class {
|
|
|
3147
3316
|
this.bets = new GuildBetManager2(this);
|
|
3148
3317
|
this.mediators = new GuildMediatorManager(this);
|
|
3149
3318
|
this.automaticMessagesManager = new AutomaticMessageManager(this);
|
|
3319
|
+
this.tournaments = new TournamentManager(this);
|
|
3150
3320
|
this.adverts = [];
|
|
3151
3321
|
for (let _adv of data?.adverts || []) {
|
|
3152
3322
|
this.adverts.push({
|
|
@@ -3183,7 +3353,7 @@ var Guild5 = class {
|
|
|
3183
3353
|
url: route,
|
|
3184
3354
|
payload: { channels }
|
|
3185
3355
|
});
|
|
3186
|
-
this.
|
|
3356
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3187
3357
|
return response.channels.find((t) => t.type === type);
|
|
3188
3358
|
}
|
|
3189
3359
|
}
|
|
@@ -3198,7 +3368,7 @@ var Guild5 = class {
|
|
|
3198
3368
|
url: route,
|
|
3199
3369
|
payload: { permissions }
|
|
3200
3370
|
});
|
|
3201
|
-
this.
|
|
3371
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3202
3372
|
return response.permissions.find((t) => t.type === type);
|
|
3203
3373
|
}
|
|
3204
3374
|
}
|
|
@@ -3207,26 +3377,26 @@ var Guild5 = class {
|
|
|
3207
3377
|
const route = Routes.guilds.get(this.id);
|
|
3208
3378
|
const payload = { adverts: this.adverts };
|
|
3209
3379
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
3210
|
-
return this.
|
|
3380
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3211
3381
|
}
|
|
3212
3382
|
async removeAdvert(advertId) {
|
|
3213
3383
|
const route = Routes.guilds.get(this.id);
|
|
3214
3384
|
const payload = { adverts: this.adverts.filter((a) => a._id !== advertId) };
|
|
3215
3385
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
3216
|
-
return this.
|
|
3386
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3217
3387
|
}
|
|
3218
3388
|
async createCode(data) {
|
|
3219
3389
|
this.codes.push(data);
|
|
3220
3390
|
const route = Routes.guilds.get(this.id);
|
|
3221
3391
|
const payload = { codes: this.codes };
|
|
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 removeCode(codeId) {
|
|
3226
3396
|
const route = Routes.guilds.get(this.id);
|
|
3227
3397
|
const payload = { codes: this.codes.filter((a) => a._id !== codeId) };
|
|
3228
3398
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
3229
|
-
return this.
|
|
3399
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3230
3400
|
}
|
|
3231
3401
|
async addIdToChannel(type, id) {
|
|
3232
3402
|
const channel = this.channels.find((c) => c.type === type);
|
|
@@ -3245,7 +3415,7 @@ var Guild5 = class {
|
|
|
3245
3415
|
url: route,
|
|
3246
3416
|
payload
|
|
3247
3417
|
});
|
|
3248
|
-
return this.
|
|
3418
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3249
3419
|
}
|
|
3250
3420
|
async setChannelIds(type, ...ids) {
|
|
3251
3421
|
const channel = this.channels.find((c) => c.type === type);
|
|
@@ -3264,7 +3434,7 @@ var Guild5 = class {
|
|
|
3264
3434
|
url: route,
|
|
3265
3435
|
payload
|
|
3266
3436
|
});
|
|
3267
|
-
return this.
|
|
3437
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3268
3438
|
}
|
|
3269
3439
|
async removeIdInChannel(type, id) {
|
|
3270
3440
|
const chIndex = this.channels.findIndex((c) => c.type === type);
|
|
@@ -3286,7 +3456,7 @@ var Guild5 = class {
|
|
|
3286
3456
|
url: route,
|
|
3287
3457
|
payload
|
|
3288
3458
|
});
|
|
3289
|
-
return this.
|
|
3459
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3290
3460
|
}
|
|
3291
3461
|
async updateRouletteSettings(data) {
|
|
3292
3462
|
const _data = {
|
|
@@ -3343,58 +3513,21 @@ var Guild5 = class {
|
|
|
3343
3513
|
this.logEntries.fetch(),
|
|
3344
3514
|
this.betusers.fetch(),
|
|
3345
3515
|
this.bets.fetch(),
|
|
3346
|
-
this.mediators.fetch()
|
|
3516
|
+
this.mediators.fetch(),
|
|
3517
|
+
this.tournaments.fetch()
|
|
3347
3518
|
]);
|
|
3348
3519
|
return this;
|
|
3349
3520
|
}
|
|
3350
|
-
_updateInternals(data) {
|
|
3351
|
-
for (let key in data) {
|
|
3352
|
-
if (key === "id" || key === "createdAt") continue;
|
|
3353
|
-
if (key in this) {
|
|
3354
|
-
this[key] = data[key];
|
|
3355
|
-
}
|
|
3356
|
-
if (key === "adverts") {
|
|
3357
|
-
this.adverts = [];
|
|
3358
|
-
for (let _adv of data.adverts) {
|
|
3359
|
-
this.adverts.push({
|
|
3360
|
-
_id: _adv._id,
|
|
3361
|
-
admin_id: _adv.admin_id,
|
|
3362
|
-
points_to_remove: _adv.points_to_remove,
|
|
3363
|
-
role_id: _adv.role_id,
|
|
3364
|
-
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
3365
|
-
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
3366
|
-
});
|
|
3367
|
-
}
|
|
3368
|
-
}
|
|
3369
|
-
if (key === "code") {
|
|
3370
|
-
this.codes = [];
|
|
3371
|
-
for (let _adv of data.codes) {
|
|
3372
|
-
this.codes.push({
|
|
3373
|
-
_id: _adv._id,
|
|
3374
|
-
admin_id: _adv.admin_id,
|
|
3375
|
-
type: _adv.type,
|
|
3376
|
-
add: _adv.add,
|
|
3377
|
-
code: _adv.code,
|
|
3378
|
-
expire: _adv.expire ? new Date(_adv.expire) : /* @__PURE__ */ new Date(),
|
|
3379
|
-
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
3380
|
-
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
3381
|
-
});
|
|
3382
|
-
}
|
|
3383
|
-
}
|
|
3384
|
-
}
|
|
3385
|
-
this.automaticMessagesManager.set(this.automatic_messages);
|
|
3386
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
3387
|
-
this.rest.guilds.cache.set(this.id, this);
|
|
3388
|
-
this.rest.emit("guildUpdate", this);
|
|
3389
|
-
return this;
|
|
3390
|
-
}
|
|
3391
3521
|
async fetch() {
|
|
3392
3522
|
const route = Routes.guilds.get(this.id);
|
|
3393
3523
|
const response = await this.rest.request({
|
|
3394
3524
|
method: "get",
|
|
3395
3525
|
url: route
|
|
3396
3526
|
});
|
|
3397
|
-
return this.
|
|
3527
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3528
|
+
}
|
|
3529
|
+
async reset() {
|
|
3530
|
+
return this.update({ reset: true });
|
|
3398
3531
|
}
|
|
3399
3532
|
async update(data) {
|
|
3400
3533
|
const route = Routes.guilds.get(this.id);
|
|
@@ -3403,16 +3536,7 @@ var Guild5 = class {
|
|
|
3403
3536
|
url: route,
|
|
3404
3537
|
payload: data
|
|
3405
3538
|
});
|
|
3406
|
-
|
|
3407
|
-
if (k === "id" || k == "createdAt") continue;
|
|
3408
|
-
if (k in this) {
|
|
3409
|
-
this[k] = response[k];
|
|
3410
|
-
}
|
|
3411
|
-
}
|
|
3412
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
3413
|
-
this.rest.guilds.cache.set(this.id, this);
|
|
3414
|
-
this.rest.emit("guildUpdate", this);
|
|
3415
|
-
return this;
|
|
3539
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3416
3540
|
}
|
|
3417
3541
|
async setStatus(key, status) {
|
|
3418
3542
|
Assertion.assertString(key);
|
|
@@ -3437,16 +3561,27 @@ var Guild5 = class {
|
|
|
3437
3561
|
await this.update({ prices: this.prices });
|
|
3438
3562
|
return this;
|
|
3439
3563
|
}
|
|
3440
|
-
async
|
|
3441
|
-
|
|
3442
|
-
const
|
|
3443
|
-
const payload = { set:
|
|
3564
|
+
async addPrefix(prefixes) {
|
|
3565
|
+
const route = Routes.fields(Routes.guilds.resource(this.id, "prefixes"));
|
|
3566
|
+
const _p = Array.isArray(prefixes) ? prefixes : [prefixes];
|
|
3567
|
+
const payload = { set: [.../* @__PURE__ */ new Set([...this.prefixes, ..._p])] };
|
|
3568
|
+
const response = await this.rest.request({
|
|
3569
|
+
method: "PATCH",
|
|
3570
|
+
url: route,
|
|
3571
|
+
payload
|
|
3572
|
+
});
|
|
3573
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3574
|
+
return this;
|
|
3575
|
+
}
|
|
3576
|
+
async setPrefix(prefixes) {
|
|
3577
|
+
const route = Routes.fields(Routes.guilds.resource(this.id, "prefixes"));
|
|
3578
|
+
const payload = { set: Array.isArray(prefixes) ? prefixes : [prefixes] };
|
|
3444
3579
|
const response = await this.rest.request({
|
|
3445
3580
|
method: "PATCH",
|
|
3446
3581
|
url: route,
|
|
3447
3582
|
payload
|
|
3448
3583
|
});
|
|
3449
|
-
this.
|
|
3584
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3450
3585
|
return this;
|
|
3451
3586
|
}
|
|
3452
3587
|
async toggleDailyCategory(category) {
|
|
@@ -3466,7 +3601,7 @@ var Guild5 = class {
|
|
|
3466
3601
|
url: route,
|
|
3467
3602
|
payload
|
|
3468
3603
|
});
|
|
3469
|
-
this.
|
|
3604
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3470
3605
|
return this;
|
|
3471
3606
|
}
|
|
3472
3607
|
async setScores(name, amount) {
|
|
@@ -3479,7 +3614,7 @@ var Guild5 = class {
|
|
|
3479
3614
|
url: route,
|
|
3480
3615
|
payload
|
|
3481
3616
|
});
|
|
3482
|
-
this.
|
|
3617
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3483
3618
|
return this;
|
|
3484
3619
|
}
|
|
3485
3620
|
async toggleMode(mode) {
|
|
@@ -3504,10 +3639,52 @@ var Guild5 = class {
|
|
|
3504
3639
|
url: route,
|
|
3505
3640
|
payload
|
|
3506
3641
|
});
|
|
3507
|
-
this.
|
|
3642
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn10).call(this, response);
|
|
3508
3643
|
return this;
|
|
3509
3644
|
}
|
|
3510
3645
|
};
|
|
3646
|
+
_Guild_instances = new WeakSet();
|
|
3647
|
+
updateInternals_fn10 = function(data) {
|
|
3648
|
+
for (let key in data) {
|
|
3649
|
+
if (key === "id" || key === "createdAt") continue;
|
|
3650
|
+
if (key in this) {
|
|
3651
|
+
this[key] = data[key];
|
|
3652
|
+
}
|
|
3653
|
+
if (key === "adverts") {
|
|
3654
|
+
this.adverts = [];
|
|
3655
|
+
for (let _adv of data.adverts) {
|
|
3656
|
+
this.adverts.push({
|
|
3657
|
+
_id: _adv._id,
|
|
3658
|
+
admin_id: _adv.admin_id,
|
|
3659
|
+
points_to_remove: _adv.points_to_remove,
|
|
3660
|
+
role_id: _adv.role_id,
|
|
3661
|
+
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
3662
|
+
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
3663
|
+
});
|
|
3664
|
+
}
|
|
3665
|
+
}
|
|
3666
|
+
if (key === "code") {
|
|
3667
|
+
this.codes = [];
|
|
3668
|
+
for (let _adv of data.codes) {
|
|
3669
|
+
this.codes.push({
|
|
3670
|
+
_id: _adv._id,
|
|
3671
|
+
admin_id: _adv.admin_id,
|
|
3672
|
+
type: _adv.type,
|
|
3673
|
+
add: _adv.add,
|
|
3674
|
+
code: _adv.code,
|
|
3675
|
+
expire: _adv.expire ? new Date(_adv.expire) : /* @__PURE__ */ new Date(),
|
|
3676
|
+
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
3677
|
+
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
3678
|
+
});
|
|
3679
|
+
}
|
|
3680
|
+
}
|
|
3681
|
+
}
|
|
3682
|
+
this.automaticMessagesManager.set(this.automatic_messages);
|
|
3683
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
3684
|
+
this.rest.guilds.cache.set(this.id, this);
|
|
3685
|
+
this.rest.emit("guildUpdate", this);
|
|
3686
|
+
return this;
|
|
3687
|
+
};
|
|
3511
3688
|
|
|
3512
3689
|
// src/managers/guild/GuildManager.ts
|
|
3513
3690
|
var GuildManager = class {
|
|
@@ -3537,7 +3714,7 @@ var GuildManager = class {
|
|
|
3537
3714
|
method: "get",
|
|
3538
3715
|
url: route2
|
|
3539
3716
|
});
|
|
3540
|
-
const guild = new
|
|
3717
|
+
const guild = new Guild6(response2, this.rest);
|
|
3541
3718
|
await guild._start().then((g) => {
|
|
3542
3719
|
this.cache.set(g.id, g);
|
|
3543
3720
|
});
|
|
@@ -3551,13 +3728,22 @@ var GuildManager = class {
|
|
|
3551
3728
|
});
|
|
3552
3729
|
for (let _guild of response) {
|
|
3553
3730
|
if (!_guild.id) continue;
|
|
3554
|
-
const guild = new
|
|
3731
|
+
const guild = new Guild6(_guild, this.rest);
|
|
3555
3732
|
await guild._start().then((g) => {
|
|
3556
3733
|
this.cache.set(g.id, g);
|
|
3557
3734
|
});
|
|
3558
3735
|
}
|
|
3559
3736
|
return this.cache;
|
|
3560
3737
|
}
|
|
3738
|
+
async reset(guildId) {
|
|
3739
|
+
if (guildId) {
|
|
3740
|
+
return await this.cache.get(guildId).reset();
|
|
3741
|
+
}
|
|
3742
|
+
for (let [_, g] of this.cache) {
|
|
3743
|
+
await g.reset();
|
|
3744
|
+
}
|
|
3745
|
+
return this.cache;
|
|
3746
|
+
}
|
|
3561
3747
|
async delete(options) {
|
|
3562
3748
|
if (options && options.guildId) {
|
|
3563
3749
|
Assertion.assertString(options.guildId);
|
|
@@ -3584,12 +3770,12 @@ var GuildManager = class {
|
|
|
3584
3770
|
if (!data) return this.cache;
|
|
3585
3771
|
if (Array.isArray(data)) {
|
|
3586
3772
|
for (let _guild of data) {
|
|
3587
|
-
const guild = new
|
|
3773
|
+
const guild = new Guild6(_guild, this.rest);
|
|
3588
3774
|
this.cache.set(guild.id, guild);
|
|
3589
3775
|
}
|
|
3590
3776
|
return this.cache;
|
|
3591
3777
|
} else {
|
|
3592
|
-
const guild = new
|
|
3778
|
+
const guild = new Guild6(data, this.rest);
|
|
3593
3779
|
this.cache.set(guild.id, guild);
|
|
3594
3780
|
return guild;
|
|
3595
3781
|
}
|