@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/managers/index.mjs
CHANGED
|
@@ -493,6 +493,9 @@ var BaseManager = class {
|
|
|
493
493
|
this.rest = guild.rest;
|
|
494
494
|
this.cache = new Collection();
|
|
495
495
|
}
|
|
496
|
+
toJSON() {
|
|
497
|
+
return [...this.cache.values()].map((m) => m && "toJSON" in m && typeof m.toJSON === "function" ? m.toJSON() : m);
|
|
498
|
+
}
|
|
496
499
|
};
|
|
497
500
|
|
|
498
501
|
// src/managers/player/PlayerManager.ts
|
|
@@ -566,7 +569,7 @@ var PlayerManager = class extends Collection {
|
|
|
566
569
|
// src/rest/Routes.ts
|
|
567
570
|
var Routes = {
|
|
568
571
|
//base: "http://localhost:80/api/v1",
|
|
569
|
-
base: "https://
|
|
572
|
+
base: "https://duqueapi.shardweb.app/api/v1",
|
|
570
573
|
field: (field) => `/${field}`,
|
|
571
574
|
fields: (...fields) => `${fields.join("/")}`,
|
|
572
575
|
guilds: {
|
|
@@ -722,7 +725,8 @@ var Assertion = class {
|
|
|
722
725
|
import { request, Headers } from "undici";
|
|
723
726
|
|
|
724
727
|
// src/structures/betuser/GuildBetUser.ts
|
|
725
|
-
var
|
|
728
|
+
var _GuildBetUser_instances, updateInternals_fn;
|
|
729
|
+
var _GuildBetUser = class _GuildBetUser {
|
|
726
730
|
/**
|
|
727
731
|
* Bet user
|
|
728
732
|
* @param data The user's data
|
|
@@ -730,6 +734,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
730
734
|
* @param rest The rest client
|
|
731
735
|
*/
|
|
732
736
|
constructor(data, manager) {
|
|
737
|
+
__privateAdd(this, _GuildBetUser_instances);
|
|
733
738
|
/** User daily */
|
|
734
739
|
__publicField(this, "daily");
|
|
735
740
|
__publicField(this, "profile");
|
|
@@ -824,7 +829,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
824
829
|
url: route,
|
|
825
830
|
payload
|
|
826
831
|
});
|
|
827
|
-
return this.
|
|
832
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn).call(this, response);
|
|
828
833
|
}
|
|
829
834
|
async updateProfile(data) {
|
|
830
835
|
const _data = {
|
|
@@ -844,20 +849,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
844
849
|
url: route,
|
|
845
850
|
payload: _data
|
|
846
851
|
});
|
|
847
|
-
return this.
|
|
848
|
-
}
|
|
849
|
-
_updateInternals(data) {
|
|
850
|
-
for (let key in data) {
|
|
851
|
-
if (key === "id" || key === "createdAt") continue;
|
|
852
|
-
if (key in this) {
|
|
853
|
-
this[key] = data[key];
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
857
|
-
this.createdAt = new Date(data.createdAt);
|
|
858
|
-
this.manager.set(this);
|
|
859
|
-
this.rest.emit("betuserUpdate", this);
|
|
860
|
-
return this;
|
|
852
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn).call(this, response);
|
|
861
853
|
}
|
|
862
854
|
/**
|
|
863
855
|
* Update certain property
|
|
@@ -894,7 +886,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
894
886
|
url: route,
|
|
895
887
|
payload
|
|
896
888
|
});
|
|
897
|
-
return this.
|
|
889
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn).call(this, response);
|
|
898
890
|
}
|
|
899
891
|
async _update(data) {
|
|
900
892
|
const route = Routes.guilds.betusers.get(this.manager.guild.id, this.id);
|
|
@@ -904,7 +896,7 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
904
896
|
url: route,
|
|
905
897
|
payload
|
|
906
898
|
});
|
|
907
|
-
return this.
|
|
899
|
+
return __privateMethod(this, _GuildBetUser_instances, updateInternals_fn).call(this, response);
|
|
908
900
|
}
|
|
909
901
|
async delete() {
|
|
910
902
|
const route = Routes.guilds.betusers.delete(this.manager.guild.id, this.id);
|
|
@@ -928,6 +920,21 @@ var GuildBetUser = class _GuildBetUser {
|
|
|
928
920
|
return json;
|
|
929
921
|
}
|
|
930
922
|
};
|
|
923
|
+
_GuildBetUser_instances = new WeakSet();
|
|
924
|
+
updateInternals_fn = function(data) {
|
|
925
|
+
for (let key in data) {
|
|
926
|
+
if (key === "id" || key === "createdAt") continue;
|
|
927
|
+
if (key in this) {
|
|
928
|
+
this[key] = data[key];
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
932
|
+
this.createdAt = new Date(data.createdAt);
|
|
933
|
+
this.manager.set(this);
|
|
934
|
+
this.rest.emit("betuserUpdate", this);
|
|
935
|
+
return this;
|
|
936
|
+
};
|
|
937
|
+
var GuildBetUser = _GuildBetUser;
|
|
931
938
|
|
|
932
939
|
// src/managers/betuser/GuildBetUserManager.ts
|
|
933
940
|
var GuildBetUserManager = class extends BaseManager {
|
|
@@ -1005,7 +1012,8 @@ var GuildBetUserManager = class extends BaseManager {
|
|
|
1005
1012
|
};
|
|
1006
1013
|
|
|
1007
1014
|
// src/structures/mediator/GuildMediator.ts
|
|
1008
|
-
var
|
|
1015
|
+
var _GuildMediator_instances, updateInternals_fn2;
|
|
1016
|
+
var _GuildMediator = class _GuildMediator {
|
|
1009
1017
|
/**
|
|
1010
1018
|
* Bet user
|
|
1011
1019
|
* @param data The user's data
|
|
@@ -1013,6 +1021,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1013
1021
|
* @param rest The rest client
|
|
1014
1022
|
*/
|
|
1015
1023
|
constructor(data, manager) {
|
|
1024
|
+
__privateAdd(this, _GuildMediator_instances);
|
|
1016
1025
|
/** User's name */
|
|
1017
1026
|
__publicField(this, "id");
|
|
1018
1027
|
__publicField(this, "guild_id");
|
|
@@ -1071,19 +1080,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1071
1080
|
url: route,
|
|
1072
1081
|
payload
|
|
1073
1082
|
});
|
|
1074
|
-
return this.
|
|
1075
|
-
}
|
|
1076
|
-
_updateInternals(data) {
|
|
1077
|
-
for (let key in data) {
|
|
1078
|
-
if (key === "id" || key === "createdAt") continue;
|
|
1079
|
-
if (key in this) {
|
|
1080
|
-
this[key] = data[key];
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1084
|
-
this.createdAt = new Date(data.createdAt);
|
|
1085
|
-
this.manager.set(this);
|
|
1086
|
-
return this;
|
|
1083
|
+
return __privateMethod(this, _GuildMediator_instances, updateInternals_fn2).call(this, response);
|
|
1087
1084
|
}
|
|
1088
1085
|
/**
|
|
1089
1086
|
* Update certain property
|
|
@@ -1098,7 +1095,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1098
1095
|
url: route,
|
|
1099
1096
|
payload
|
|
1100
1097
|
});
|
|
1101
|
-
return this.
|
|
1098
|
+
return __privateMethod(this, _GuildMediator_instances, updateInternals_fn2).call(this, response);
|
|
1102
1099
|
}
|
|
1103
1100
|
async setPaymentlink(type, link) {
|
|
1104
1101
|
const route = Routes.guilds.mediators.get(this.manager.guild.id, this.id);
|
|
@@ -1108,7 +1105,7 @@ var GuildMediator = class _GuildMediator {
|
|
|
1108
1105
|
url: route,
|
|
1109
1106
|
payload
|
|
1110
1107
|
});
|
|
1111
|
-
return this.
|
|
1108
|
+
return __privateMethod(this, _GuildMediator_instances, updateInternals_fn2).call(this, response);
|
|
1112
1109
|
}
|
|
1113
1110
|
async delete() {
|
|
1114
1111
|
const route = Routes.guilds.mediators.delete(this.manager.guild.id, this.id);
|
|
@@ -1131,6 +1128,20 @@ var GuildMediator = class _GuildMediator {
|
|
|
1131
1128
|
return json;
|
|
1132
1129
|
}
|
|
1133
1130
|
};
|
|
1131
|
+
_GuildMediator_instances = new WeakSet();
|
|
1132
|
+
updateInternals_fn2 = function(data) {
|
|
1133
|
+
for (let key in data) {
|
|
1134
|
+
if (key === "id" || key === "createdAt") continue;
|
|
1135
|
+
if (key in this) {
|
|
1136
|
+
this[key] = data[key];
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1140
|
+
this.createdAt = new Date(data.createdAt);
|
|
1141
|
+
this.manager.set(this);
|
|
1142
|
+
return this;
|
|
1143
|
+
};
|
|
1144
|
+
var GuildMediator = _GuildMediator;
|
|
1134
1145
|
|
|
1135
1146
|
// src/managers/mediator/GuildMediatorManager.ts
|
|
1136
1147
|
var GuildMediatorManager = class extends BaseManager {
|
|
@@ -1215,14 +1226,150 @@ var GuildMediatorManager = class extends BaseManager {
|
|
|
1215
1226
|
}
|
|
1216
1227
|
};
|
|
1217
1228
|
|
|
1229
|
+
// src/structures/tournament/Tournament.ts
|
|
1230
|
+
var _Tournament_instances, updateInternals_fn3;
|
|
1231
|
+
var Tournament = class {
|
|
1232
|
+
constructor(data, manager) {
|
|
1233
|
+
__privateAdd(this, _Tournament_instances);
|
|
1234
|
+
__publicField(this, "_id");
|
|
1235
|
+
__publicField(this, "guild_id");
|
|
1236
|
+
__publicField(this, "type");
|
|
1237
|
+
__publicField(this, "max_teams");
|
|
1238
|
+
__publicField(this, "teams");
|
|
1239
|
+
__publicField(this, "message");
|
|
1240
|
+
__publicField(this, "message_id");
|
|
1241
|
+
__publicField(this, "status");
|
|
1242
|
+
__publicField(this, "createdAt");
|
|
1243
|
+
__publicField(this, "updatedAt");
|
|
1244
|
+
__publicField(this, "guild");
|
|
1245
|
+
__publicField(this, "rest");
|
|
1246
|
+
__publicField(this, "manager");
|
|
1247
|
+
__publicField(this, "data");
|
|
1248
|
+
this.manager = manager;
|
|
1249
|
+
this.guild = manager.guild;
|
|
1250
|
+
this.rest = manager.rest;
|
|
1251
|
+
this.guild_id = data?.guild_id;
|
|
1252
|
+
this.type = data?.type;
|
|
1253
|
+
this.teams = data?.teams;
|
|
1254
|
+
this.message = data?.message;
|
|
1255
|
+
this.message_id = data?.message_id;
|
|
1256
|
+
this.status = data?.status;
|
|
1257
|
+
this.createdAt = data?.createdAt ? new Date(data?.createdAt) : /* @__PURE__ */ new Date();
|
|
1258
|
+
this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
|
|
1259
|
+
this.data = data;
|
|
1260
|
+
}
|
|
1261
|
+
async fetch() {
|
|
1262
|
+
const route = Routes.fields("guilds", this.guild.id, "tournaments", this._id);
|
|
1263
|
+
const response = await this.rest.request({
|
|
1264
|
+
method: "get",
|
|
1265
|
+
url: route
|
|
1266
|
+
});
|
|
1267
|
+
return __privateMethod(this, _Tournament_instances, updateInternals_fn3).call(this, response);
|
|
1268
|
+
}
|
|
1269
|
+
async update(data) {
|
|
1270
|
+
const route = Routes.fields("guilds", this.guild.id, "tournaments", this._id);
|
|
1271
|
+
const response = await this.rest.request({
|
|
1272
|
+
method: "patch",
|
|
1273
|
+
url: route,
|
|
1274
|
+
payload: data
|
|
1275
|
+
});
|
|
1276
|
+
return __privateMethod(this, _Tournament_instances, updateInternals_fn3).call(this, response);
|
|
1277
|
+
}
|
|
1278
|
+
toJSON() {
|
|
1279
|
+
return {
|
|
1280
|
+
guild_id: this.guild_id,
|
|
1281
|
+
type: this.type,
|
|
1282
|
+
max_teams: this.max_teams,
|
|
1283
|
+
teams: this.teams,
|
|
1284
|
+
message: this.message,
|
|
1285
|
+
message_id: this.message_id,
|
|
1286
|
+
status: this.status,
|
|
1287
|
+
createdAt: this.createdAt ? new Date(this?.createdAt) : /* @__PURE__ */ new Date(),
|
|
1288
|
+
updatedAt: this.updatedAt ? new Date(this?.updatedAt) : /* @__PURE__ */ new Date()
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
};
|
|
1292
|
+
_Tournament_instances = new WeakSet();
|
|
1293
|
+
updateInternals_fn3 = function(data) {
|
|
1294
|
+
for (let key in data) {
|
|
1295
|
+
if (key === "id" || key === "createdAt") continue;
|
|
1296
|
+
if (key in this) {
|
|
1297
|
+
this[key] = data[key];
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1301
|
+
this.createdAt = new Date(data.createdAt);
|
|
1302
|
+
this.manager._add(this);
|
|
1303
|
+
return this;
|
|
1304
|
+
};
|
|
1305
|
+
|
|
1306
|
+
// src/managers/tournament/TournamentManager.ts
|
|
1307
|
+
var TournamentManager = class extends BaseManager {
|
|
1308
|
+
constructor(guild) {
|
|
1309
|
+
super(guild);
|
|
1310
|
+
this.guild = guild;
|
|
1311
|
+
this.rest = guild.rest;
|
|
1312
|
+
this.base_url = Routes.guilds.resource(guild.id, "tournaments");
|
|
1313
|
+
this.cache = new Collection();
|
|
1314
|
+
}
|
|
1315
|
+
async fetch(options) {
|
|
1316
|
+
if (options && options.cache) return this.cache;
|
|
1317
|
+
if (options && options.tournamentId) {
|
|
1318
|
+
const response2 = await this.rest.request({
|
|
1319
|
+
method: "GET",
|
|
1320
|
+
url: Routes.fields(this.base_url, options.tournamentId)
|
|
1321
|
+
});
|
|
1322
|
+
const tournament = new Tournament(response2, this);
|
|
1323
|
+
this._add(tournament);
|
|
1324
|
+
return tournament;
|
|
1325
|
+
}
|
|
1326
|
+
const response = await this.rest.request({
|
|
1327
|
+
method: "GET",
|
|
1328
|
+
url: this.base_url
|
|
1329
|
+
});
|
|
1330
|
+
return this.set(response);
|
|
1331
|
+
}
|
|
1332
|
+
set(data) {
|
|
1333
|
+
this.cache.clear();
|
|
1334
|
+
if (Array.isArray(data)) {
|
|
1335
|
+
for (let _m of data) {
|
|
1336
|
+
if (!_m._id) continue;
|
|
1337
|
+
if (_m instanceof Tournament) this.cache.set(_m._id, _m);
|
|
1338
|
+
else this.cache.set(_m._id, new Tournament(_m, this));
|
|
1339
|
+
}
|
|
1340
|
+
} else {
|
|
1341
|
+
if (!data._id) return this.cache;
|
|
1342
|
+
if (data instanceof Tournament) this.cache.set(data._id, data);
|
|
1343
|
+
else this.cache.set(data._id, new Tournament(data, this));
|
|
1344
|
+
}
|
|
1345
|
+
return this.cache;
|
|
1346
|
+
}
|
|
1347
|
+
_add(data) {
|
|
1348
|
+
if (Array.isArray(data)) {
|
|
1349
|
+
for (let _m of data) {
|
|
1350
|
+
if (!_m._id) continue;
|
|
1351
|
+
if (_m instanceof Tournament) this.cache.set(_m._id, _m);
|
|
1352
|
+
else this.cache.set(_m._id, new Tournament(_m, this));
|
|
1353
|
+
}
|
|
1354
|
+
} else {
|
|
1355
|
+
if (!data._id) return this.cache;
|
|
1356
|
+
if (data instanceof Tournament) this.cache.set(data._id, data);
|
|
1357
|
+
else this.cache.set(data._id, new Tournament(data, this));
|
|
1358
|
+
}
|
|
1359
|
+
return this.cache;
|
|
1360
|
+
}
|
|
1361
|
+
};
|
|
1362
|
+
|
|
1218
1363
|
// src/structures/guild/Guild.ts
|
|
1219
|
-
var
|
|
1364
|
+
var _Guild_instances, updateInternals_fn4;
|
|
1365
|
+
var Guild2 = class {
|
|
1220
1366
|
/**
|
|
1221
1367
|
* The guild structure
|
|
1222
1368
|
* @param data The guild's data
|
|
1223
1369
|
* @param rest The rest client
|
|
1224
1370
|
*/
|
|
1225
1371
|
constructor(data, rest) {
|
|
1372
|
+
__privateAdd(this, _Guild_instances);
|
|
1226
1373
|
/** The data of this guild */
|
|
1227
1374
|
__publicField(this, "data");
|
|
1228
1375
|
/** The rest client */
|
|
@@ -1248,6 +1395,7 @@ var Guild = class {
|
|
|
1248
1395
|
__publicField(this, "roulette_settings");
|
|
1249
1396
|
/** Guild Prefix */
|
|
1250
1397
|
__publicField(this, "prefix");
|
|
1398
|
+
__publicField(this, "prefixes");
|
|
1251
1399
|
/** Guild Creation Date */
|
|
1252
1400
|
__publicField(this, "createdAt");
|
|
1253
1401
|
/** Guild Updated Date */
|
|
@@ -1267,6 +1415,7 @@ var Guild = class {
|
|
|
1267
1415
|
__publicField(this, "mediators");
|
|
1268
1416
|
__publicField(this, "automatic_messages");
|
|
1269
1417
|
__publicField(this, "automaticMessagesManager");
|
|
1418
|
+
__publicField(this, "tournaments");
|
|
1270
1419
|
__publicField(this, "adverts");
|
|
1271
1420
|
__publicField(this, "codes");
|
|
1272
1421
|
__publicField(this, "coin_symbol");
|
|
@@ -1281,6 +1430,7 @@ var Guild = class {
|
|
|
1281
1430
|
this.scores = data?.scores;
|
|
1282
1431
|
this.codes = data?.codes;
|
|
1283
1432
|
this.prefix = data?.prefix;
|
|
1433
|
+
this.prefixes = data?.prefixes;
|
|
1284
1434
|
this.status = data?.status;
|
|
1285
1435
|
this.tickets_configuration = data?.tickets_configuration;
|
|
1286
1436
|
this.automatic_messages = data?.automatic_messages;
|
|
@@ -1301,6 +1451,7 @@ var Guild = class {
|
|
|
1301
1451
|
this.bets = new GuildBetManager(this);
|
|
1302
1452
|
this.mediators = new GuildMediatorManager(this);
|
|
1303
1453
|
this.automaticMessagesManager = new AutomaticMessageManager(this);
|
|
1454
|
+
this.tournaments = new TournamentManager(this);
|
|
1304
1455
|
this.adverts = [];
|
|
1305
1456
|
for (let _adv of data?.adverts || []) {
|
|
1306
1457
|
this.adverts.push({
|
|
@@ -1337,7 +1488,7 @@ var Guild = class {
|
|
|
1337
1488
|
url: route,
|
|
1338
1489
|
payload: { channels }
|
|
1339
1490
|
});
|
|
1340
|
-
this.
|
|
1491
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
|
|
1341
1492
|
return response.channels.find((t) => t.type === type);
|
|
1342
1493
|
}
|
|
1343
1494
|
}
|
|
@@ -1352,7 +1503,7 @@ var Guild = class {
|
|
|
1352
1503
|
url: route,
|
|
1353
1504
|
payload: { permissions }
|
|
1354
1505
|
});
|
|
1355
|
-
this.
|
|
1506
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
|
|
1356
1507
|
return response.permissions.find((t) => t.type === type);
|
|
1357
1508
|
}
|
|
1358
1509
|
}
|
|
@@ -1361,26 +1512,26 @@ var Guild = class {
|
|
|
1361
1512
|
const route = Routes.guilds.get(this.id);
|
|
1362
1513
|
const payload = { adverts: this.adverts };
|
|
1363
1514
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
1364
|
-
return this.
|
|
1515
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
|
|
1365
1516
|
}
|
|
1366
1517
|
async removeAdvert(advertId) {
|
|
1367
1518
|
const route = Routes.guilds.get(this.id);
|
|
1368
1519
|
const payload = { adverts: this.adverts.filter((a) => a._id !== advertId) };
|
|
1369
1520
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
1370
|
-
return this.
|
|
1521
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
|
|
1371
1522
|
}
|
|
1372
1523
|
async createCode(data) {
|
|
1373
1524
|
this.codes.push(data);
|
|
1374
1525
|
const route = Routes.guilds.get(this.id);
|
|
1375
1526
|
const payload = { codes: this.codes };
|
|
1376
1527
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
1377
|
-
return this.
|
|
1528
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
|
|
1378
1529
|
}
|
|
1379
1530
|
async removeCode(codeId) {
|
|
1380
1531
|
const route = Routes.guilds.get(this.id);
|
|
1381
1532
|
const payload = { codes: this.codes.filter((a) => a._id !== codeId) };
|
|
1382
1533
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
1383
|
-
return this.
|
|
1534
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
|
|
1384
1535
|
}
|
|
1385
1536
|
async addIdToChannel(type, id) {
|
|
1386
1537
|
const channel = this.channels.find((c) => c.type === type);
|
|
@@ -1399,7 +1550,7 @@ var Guild = class {
|
|
|
1399
1550
|
url: route,
|
|
1400
1551
|
payload
|
|
1401
1552
|
});
|
|
1402
|
-
return this.
|
|
1553
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
|
|
1403
1554
|
}
|
|
1404
1555
|
async setChannelIds(type, ...ids) {
|
|
1405
1556
|
const channel = this.channels.find((c) => c.type === type);
|
|
@@ -1418,7 +1569,7 @@ var Guild = class {
|
|
|
1418
1569
|
url: route,
|
|
1419
1570
|
payload
|
|
1420
1571
|
});
|
|
1421
|
-
return this.
|
|
1572
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
|
|
1422
1573
|
}
|
|
1423
1574
|
async removeIdInChannel(type, id) {
|
|
1424
1575
|
const chIndex = this.channels.findIndex((c) => c.type === type);
|
|
@@ -1440,7 +1591,7 @@ var Guild = class {
|
|
|
1440
1591
|
url: route,
|
|
1441
1592
|
payload
|
|
1442
1593
|
});
|
|
1443
|
-
return this.
|
|
1594
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
|
|
1444
1595
|
}
|
|
1445
1596
|
async updateRouletteSettings(data) {
|
|
1446
1597
|
const _data = {
|
|
@@ -1497,58 +1648,21 @@ var Guild = class {
|
|
|
1497
1648
|
this.logEntries.fetch(),
|
|
1498
1649
|
this.betusers.fetch(),
|
|
1499
1650
|
this.bets.fetch(),
|
|
1500
|
-
this.mediators.fetch()
|
|
1651
|
+
this.mediators.fetch(),
|
|
1652
|
+
this.tournaments.fetch()
|
|
1501
1653
|
]);
|
|
1502
1654
|
return this;
|
|
1503
1655
|
}
|
|
1504
|
-
_updateInternals(data) {
|
|
1505
|
-
for (let key in data) {
|
|
1506
|
-
if (key === "id" || key === "createdAt") continue;
|
|
1507
|
-
if (key in this) {
|
|
1508
|
-
this[key] = data[key];
|
|
1509
|
-
}
|
|
1510
|
-
if (key === "adverts") {
|
|
1511
|
-
this.adverts = [];
|
|
1512
|
-
for (let _adv of data.adverts) {
|
|
1513
|
-
this.adverts.push({
|
|
1514
|
-
_id: _adv._id,
|
|
1515
|
-
admin_id: _adv.admin_id,
|
|
1516
|
-
points_to_remove: _adv.points_to_remove,
|
|
1517
|
-
role_id: _adv.role_id,
|
|
1518
|
-
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
1519
|
-
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
1520
|
-
});
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
if (key === "code") {
|
|
1524
|
-
this.codes = [];
|
|
1525
|
-
for (let _adv of data.codes) {
|
|
1526
|
-
this.codes.push({
|
|
1527
|
-
_id: _adv._id,
|
|
1528
|
-
admin_id: _adv.admin_id,
|
|
1529
|
-
type: _adv.type,
|
|
1530
|
-
add: _adv.add,
|
|
1531
|
-
code: _adv.code,
|
|
1532
|
-
expire: _adv.expire ? new Date(_adv.expire) : /* @__PURE__ */ new Date(),
|
|
1533
|
-
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
1534
|
-
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
1535
|
-
});
|
|
1536
|
-
}
|
|
1537
|
-
}
|
|
1538
|
-
}
|
|
1539
|
-
this.automaticMessagesManager.set(this.automatic_messages);
|
|
1540
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1541
|
-
this.rest.guilds.cache.set(this.id, this);
|
|
1542
|
-
this.rest.emit("guildUpdate", this);
|
|
1543
|
-
return this;
|
|
1544
|
-
}
|
|
1545
1656
|
async fetch() {
|
|
1546
1657
|
const route = Routes.guilds.get(this.id);
|
|
1547
1658
|
const response = await this.rest.request({
|
|
1548
1659
|
method: "get",
|
|
1549
1660
|
url: route
|
|
1550
1661
|
});
|
|
1551
|
-
return this.
|
|
1662
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
|
|
1663
|
+
}
|
|
1664
|
+
async reset() {
|
|
1665
|
+
return this.update({ reset: true });
|
|
1552
1666
|
}
|
|
1553
1667
|
async update(data) {
|
|
1554
1668
|
const route = Routes.guilds.get(this.id);
|
|
@@ -1557,16 +1671,7 @@ var Guild = class {
|
|
|
1557
1671
|
url: route,
|
|
1558
1672
|
payload: data
|
|
1559
1673
|
});
|
|
1560
|
-
|
|
1561
|
-
if (k === "id" || k == "createdAt") continue;
|
|
1562
|
-
if (k in this) {
|
|
1563
|
-
this[k] = response[k];
|
|
1564
|
-
}
|
|
1565
|
-
}
|
|
1566
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1567
|
-
this.rest.guilds.cache.set(this.id, this);
|
|
1568
|
-
this.rest.emit("guildUpdate", this);
|
|
1569
|
-
return this;
|
|
1674
|
+
return __privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
|
|
1570
1675
|
}
|
|
1571
1676
|
async setStatus(key, status) {
|
|
1572
1677
|
Assertion.assertString(key);
|
|
@@ -1591,16 +1696,27 @@ var Guild = class {
|
|
|
1591
1696
|
await this.update({ prices: this.prices });
|
|
1592
1697
|
return this;
|
|
1593
1698
|
}
|
|
1594
|
-
async
|
|
1595
|
-
|
|
1596
|
-
const
|
|
1597
|
-
const payload = { set:
|
|
1699
|
+
async addPrefix(prefixes) {
|
|
1700
|
+
const route = Routes.fields(Routes.guilds.resource(this.id, "prefixes"));
|
|
1701
|
+
const _p = Array.isArray(prefixes) ? prefixes : [prefixes];
|
|
1702
|
+
const payload = { set: [.../* @__PURE__ */ new Set([...this.prefixes, ..._p])] };
|
|
1703
|
+
const response = await this.rest.request({
|
|
1704
|
+
method: "PATCH",
|
|
1705
|
+
url: route,
|
|
1706
|
+
payload
|
|
1707
|
+
});
|
|
1708
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
|
|
1709
|
+
return this;
|
|
1710
|
+
}
|
|
1711
|
+
async setPrefix(prefixes) {
|
|
1712
|
+
const route = Routes.fields(Routes.guilds.resource(this.id, "prefixes"));
|
|
1713
|
+
const payload = { set: Array.isArray(prefixes) ? prefixes : [prefixes] };
|
|
1598
1714
|
const response = await this.rest.request({
|
|
1599
1715
|
method: "PATCH",
|
|
1600
1716
|
url: route,
|
|
1601
1717
|
payload
|
|
1602
1718
|
});
|
|
1603
|
-
this.
|
|
1719
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
|
|
1604
1720
|
return this;
|
|
1605
1721
|
}
|
|
1606
1722
|
async toggleDailyCategory(category) {
|
|
@@ -1620,7 +1736,7 @@ var Guild = class {
|
|
|
1620
1736
|
url: route,
|
|
1621
1737
|
payload
|
|
1622
1738
|
});
|
|
1623
|
-
this.
|
|
1739
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
|
|
1624
1740
|
return this;
|
|
1625
1741
|
}
|
|
1626
1742
|
async setScores(name, amount) {
|
|
@@ -1633,7 +1749,7 @@ var Guild = class {
|
|
|
1633
1749
|
url: route,
|
|
1634
1750
|
payload
|
|
1635
1751
|
});
|
|
1636
|
-
this.
|
|
1752
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
|
|
1637
1753
|
return this;
|
|
1638
1754
|
}
|
|
1639
1755
|
async toggleMode(mode) {
|
|
@@ -1658,10 +1774,52 @@ var Guild = class {
|
|
|
1658
1774
|
url: route,
|
|
1659
1775
|
payload
|
|
1660
1776
|
});
|
|
1661
|
-
this.
|
|
1777
|
+
__privateMethod(this, _Guild_instances, updateInternals_fn4).call(this, response);
|
|
1662
1778
|
return this;
|
|
1663
1779
|
}
|
|
1664
1780
|
};
|
|
1781
|
+
_Guild_instances = new WeakSet();
|
|
1782
|
+
updateInternals_fn4 = function(data) {
|
|
1783
|
+
for (let key in data) {
|
|
1784
|
+
if (key === "id" || key === "createdAt") continue;
|
|
1785
|
+
if (key in this) {
|
|
1786
|
+
this[key] = data[key];
|
|
1787
|
+
}
|
|
1788
|
+
if (key === "adverts") {
|
|
1789
|
+
this.adverts = [];
|
|
1790
|
+
for (let _adv of data.adverts) {
|
|
1791
|
+
this.adverts.push({
|
|
1792
|
+
_id: _adv._id,
|
|
1793
|
+
admin_id: _adv.admin_id,
|
|
1794
|
+
points_to_remove: _adv.points_to_remove,
|
|
1795
|
+
role_id: _adv.role_id,
|
|
1796
|
+
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
1797
|
+
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
1798
|
+
});
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
if (key === "code") {
|
|
1802
|
+
this.codes = [];
|
|
1803
|
+
for (let _adv of data.codes) {
|
|
1804
|
+
this.codes.push({
|
|
1805
|
+
_id: _adv._id,
|
|
1806
|
+
admin_id: _adv.admin_id,
|
|
1807
|
+
type: _adv.type,
|
|
1808
|
+
add: _adv.add,
|
|
1809
|
+
code: _adv.code,
|
|
1810
|
+
expire: _adv.expire ? new Date(_adv.expire) : /* @__PURE__ */ new Date(),
|
|
1811
|
+
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
1812
|
+
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
1813
|
+
});
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1817
|
+
this.automaticMessagesManager.set(this.automatic_messages);
|
|
1818
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1819
|
+
this.rest.guilds.cache.set(this.id, this);
|
|
1820
|
+
this.rest.emit("guildUpdate", this);
|
|
1821
|
+
return this;
|
|
1822
|
+
};
|
|
1665
1823
|
|
|
1666
1824
|
// src/managers/guild/GuildManager.ts
|
|
1667
1825
|
var GuildManager = class {
|
|
@@ -1691,7 +1849,7 @@ var GuildManager = class {
|
|
|
1691
1849
|
method: "get",
|
|
1692
1850
|
url: route2
|
|
1693
1851
|
});
|
|
1694
|
-
const guild = new
|
|
1852
|
+
const guild = new Guild2(response2, this.rest);
|
|
1695
1853
|
await guild._start().then((g) => {
|
|
1696
1854
|
this.cache.set(g.id, g);
|
|
1697
1855
|
});
|
|
@@ -1705,13 +1863,22 @@ var GuildManager = class {
|
|
|
1705
1863
|
});
|
|
1706
1864
|
for (let _guild of response) {
|
|
1707
1865
|
if (!_guild.id) continue;
|
|
1708
|
-
const guild = new
|
|
1866
|
+
const guild = new Guild2(_guild, this.rest);
|
|
1709
1867
|
await guild._start().then((g) => {
|
|
1710
1868
|
this.cache.set(g.id, g);
|
|
1711
1869
|
});
|
|
1712
1870
|
}
|
|
1713
1871
|
return this.cache;
|
|
1714
1872
|
}
|
|
1873
|
+
async reset(guildId) {
|
|
1874
|
+
if (guildId) {
|
|
1875
|
+
return await this.cache.get(guildId).reset();
|
|
1876
|
+
}
|
|
1877
|
+
for (let [_, g] of this.cache) {
|
|
1878
|
+
await g.reset();
|
|
1879
|
+
}
|
|
1880
|
+
return this.cache;
|
|
1881
|
+
}
|
|
1715
1882
|
async delete(options) {
|
|
1716
1883
|
if (options && options.guildId) {
|
|
1717
1884
|
Assertion.assertString(options.guildId);
|
|
@@ -1738,12 +1905,12 @@ var GuildManager = class {
|
|
|
1738
1905
|
if (!data) return this.cache;
|
|
1739
1906
|
if (Array.isArray(data)) {
|
|
1740
1907
|
for (let _guild of data) {
|
|
1741
|
-
const guild = new
|
|
1908
|
+
const guild = new Guild2(_guild, this.rest);
|
|
1742
1909
|
this.cache.set(guild.id, guild);
|
|
1743
1910
|
}
|
|
1744
1911
|
return this.cache;
|
|
1745
1912
|
} else {
|
|
1746
|
-
const guild = new
|
|
1913
|
+
const guild = new Guild2(data, this.rest);
|
|
1747
1914
|
this.cache.set(guild.id, guild);
|
|
1748
1915
|
return guild;
|
|
1749
1916
|
}
|
|
@@ -1754,8 +1921,10 @@ var GuildManager = class {
|
|
|
1754
1921
|
import_dotenv.default.config();
|
|
1755
1922
|
|
|
1756
1923
|
// src/structures/bet/GuildBet.ts
|
|
1924
|
+
var _GuildBet_instances, updateInternals_fn5;
|
|
1757
1925
|
var GuildBet = class {
|
|
1758
1926
|
constructor(data, manager) {
|
|
1927
|
+
__privateAdd(this, _GuildBet_instances);
|
|
1759
1928
|
/** The bet's type */
|
|
1760
1929
|
__publicField(this, "type");
|
|
1761
1930
|
/** The bet's mode */
|
|
@@ -1834,7 +2003,7 @@ var GuildBet = class {
|
|
|
1834
2003
|
async fetch() {
|
|
1835
2004
|
const route = Routes.guilds.bets.get(this.guild.id, this._id);
|
|
1836
2005
|
const response = await this.rest.request({ url: route, method: "GET" });
|
|
1837
|
-
return this.
|
|
2006
|
+
return __privateMethod(this, _GuildBet_instances, updateInternals_fn5).call(this, response);
|
|
1838
2007
|
}
|
|
1839
2008
|
async addPlayer(player, queue_type) {
|
|
1840
2009
|
if (this.players.length === 2) return this;
|
|
@@ -1871,7 +2040,7 @@ var GuildBet = class {
|
|
|
1871
2040
|
const payload = data;
|
|
1872
2041
|
const route = Routes.guilds.bets.update(this.guild.id, this._id);
|
|
1873
2042
|
const response = await this.rest.request({ method: "patch", url: route, payload });
|
|
1874
|
-
return this.
|
|
2043
|
+
return __privateMethod(this, _GuildBet_instances, updateInternals_fn5).call(this, response);
|
|
1875
2044
|
}
|
|
1876
2045
|
async delete() {
|
|
1877
2046
|
const route = Routes.guilds.bets.delete(this.manager.guild.id, this._id);
|
|
@@ -1883,33 +2052,6 @@ var GuildBet = class {
|
|
|
1883
2052
|
this.manager.cache.delete(this._id);
|
|
1884
2053
|
return response;
|
|
1885
2054
|
}
|
|
1886
|
-
_updateInternals(data) {
|
|
1887
|
-
for (let key in data) {
|
|
1888
|
-
if (key === "_id" || key === "createdAt") continue;
|
|
1889
|
-
if (key === "messages") {
|
|
1890
|
-
this.messages.set(data[key]);
|
|
1891
|
-
continue;
|
|
1892
|
-
}
|
|
1893
|
-
if (key === "players") {
|
|
1894
|
-
this.players._set(data[key]);
|
|
1895
|
-
continue;
|
|
1896
|
-
}
|
|
1897
|
-
if (key in this) {
|
|
1898
|
-
this[key] = data[key];
|
|
1899
|
-
}
|
|
1900
|
-
}
|
|
1901
|
-
if (data?.messages?.length !== 0) {
|
|
1902
|
-
if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
|
|
1903
|
-
else {
|
|
1904
|
-
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
1905
|
-
this.messages.set(data.messages);
|
|
1906
|
-
}
|
|
1907
|
-
}
|
|
1908
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1909
|
-
this.createdAt = new Date(data.createdAt);
|
|
1910
|
-
this.manager.set(this);
|
|
1911
|
-
return this;
|
|
1912
|
-
}
|
|
1913
2055
|
toJSON() {
|
|
1914
2056
|
let json = {};
|
|
1915
2057
|
for (const [key, value] of Object.entries(this)) {
|
|
@@ -1926,10 +2068,40 @@ var GuildBet = class {
|
|
|
1926
2068
|
};
|
|
1927
2069
|
}
|
|
1928
2070
|
};
|
|
2071
|
+
_GuildBet_instances = new WeakSet();
|
|
2072
|
+
updateInternals_fn5 = function(data) {
|
|
2073
|
+
for (let key in data) {
|
|
2074
|
+
if (key === "_id" || key === "createdAt") continue;
|
|
2075
|
+
if (key === "messages") {
|
|
2076
|
+
this.messages.set(data[key]);
|
|
2077
|
+
continue;
|
|
2078
|
+
}
|
|
2079
|
+
if (key === "players") {
|
|
2080
|
+
this.players._set(data[key]);
|
|
2081
|
+
continue;
|
|
2082
|
+
}
|
|
2083
|
+
if (key in this) {
|
|
2084
|
+
this[key] = data[key];
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
if (data?.messages?.length !== 0) {
|
|
2088
|
+
if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
|
|
2089
|
+
else {
|
|
2090
|
+
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
2091
|
+
this.messages.set(data.messages);
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2095
|
+
this.createdAt = new Date(data.createdAt);
|
|
2096
|
+
this.manager.set(this);
|
|
2097
|
+
return this;
|
|
2098
|
+
};
|
|
1929
2099
|
|
|
1930
2100
|
// src/structures/logentry/LogEntry.ts
|
|
2101
|
+
var _LogEntry_instances, updateInternals_fn6;
|
|
1931
2102
|
var LogEntry = class {
|
|
1932
2103
|
constructor(data, manager) {
|
|
2104
|
+
__privateAdd(this, _LogEntry_instances);
|
|
1933
2105
|
__publicField(this, "_id");
|
|
1934
2106
|
__publicField(this, "guild_id");
|
|
1935
2107
|
__publicField(this, "user_id");
|
|
@@ -1965,9 +2137,9 @@ var LogEntry = class {
|
|
|
1965
2137
|
this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
|
|
1966
2138
|
}
|
|
1967
2139
|
async fetch() {
|
|
1968
|
-
const route = Routes.guilds
|
|
2140
|
+
const route = Routes.fields("guilds", this.guild.id, "logentries", this._id);
|
|
1969
2141
|
const response = await this.rest.request({ url: route, method: "GET" });
|
|
1970
|
-
return this.
|
|
2142
|
+
return __privateMethod(this, _LogEntry_instances, updateInternals_fn6).call(this, response);
|
|
1971
2143
|
}
|
|
1972
2144
|
toJSON() {
|
|
1973
2145
|
const json = {};
|
|
@@ -1978,21 +2150,23 @@ var LogEntry = class {
|
|
|
1978
2150
|
}
|
|
1979
2151
|
return json;
|
|
1980
2152
|
}
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
2153
|
+
};
|
|
2154
|
+
_LogEntry_instances = new WeakSet();
|
|
2155
|
+
updateInternals_fn6 = function(data) {
|
|
2156
|
+
for (let key in data) {
|
|
2157
|
+
if (key === "id" || key === "createdAt") continue;
|
|
2158
|
+
if (key in this) {
|
|
2159
|
+
this[key] = data[key];
|
|
1987
2160
|
}
|
|
1988
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
1989
|
-
this.manager.set(this);
|
|
1990
|
-
return this;
|
|
1991
2161
|
}
|
|
2162
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2163
|
+
this.manager.set(this);
|
|
2164
|
+
return this;
|
|
1992
2165
|
};
|
|
1993
2166
|
|
|
1994
2167
|
// src/structures/match/GuildMatch.ts
|
|
1995
|
-
var
|
|
2168
|
+
var _GuildMatch_instances, updateInternals_fn7;
|
|
2169
|
+
var _GuildMatch = class _GuildMatch {
|
|
1996
2170
|
/**
|
|
1997
2171
|
* GuildMatch match
|
|
1998
2172
|
* @param data The match's data
|
|
@@ -2000,6 +2174,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
2000
2174
|
* @param rest The rest client
|
|
2001
2175
|
*/
|
|
2002
2176
|
constructor(data, manager) {
|
|
2177
|
+
__privateAdd(this, _GuildMatch_instances);
|
|
2003
2178
|
__publicField(this, "_id");
|
|
2004
2179
|
__publicField(this, "selections");
|
|
2005
2180
|
/** Match's type */
|
|
@@ -2083,7 +2258,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
2083
2258
|
method: "get",
|
|
2084
2259
|
url: route
|
|
2085
2260
|
});
|
|
2086
|
-
return await this.
|
|
2261
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
|
|
2087
2262
|
}
|
|
2088
2263
|
async addConfirmed(type, id) {
|
|
2089
2264
|
const confirmed = this.confirmed.find((c) => c.type === type);
|
|
@@ -2105,7 +2280,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
2105
2280
|
url: route,
|
|
2106
2281
|
payload: set
|
|
2107
2282
|
});
|
|
2108
|
-
return await this.
|
|
2283
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
|
|
2109
2284
|
}
|
|
2110
2285
|
async setStatus(status) {
|
|
2111
2286
|
Assertion.assertString(status);
|
|
@@ -2116,7 +2291,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
2116
2291
|
url: route,
|
|
2117
2292
|
payload
|
|
2118
2293
|
});
|
|
2119
|
-
return await this.
|
|
2294
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
|
|
2120
2295
|
}
|
|
2121
2296
|
async setWinners(players) {
|
|
2122
2297
|
if (!Array.isArray(players)) players = [players];
|
|
@@ -2127,7 +2302,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
2127
2302
|
url: route,
|
|
2128
2303
|
payload
|
|
2129
2304
|
});
|
|
2130
|
-
return await this.
|
|
2305
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
|
|
2131
2306
|
}
|
|
2132
2307
|
async setLoser(players) {
|
|
2133
2308
|
if (!Array.isArray(players)) players = [players];
|
|
@@ -2138,7 +2313,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
2138
2313
|
url: route,
|
|
2139
2314
|
payload
|
|
2140
2315
|
});
|
|
2141
|
-
return await this.
|
|
2316
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
|
|
2142
2317
|
}
|
|
2143
2318
|
async setMvps(...usersId) {
|
|
2144
2319
|
const payload = { set: usersId };
|
|
@@ -2148,7 +2323,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
2148
2323
|
url: route,
|
|
2149
2324
|
payload
|
|
2150
2325
|
});
|
|
2151
|
-
return await this.
|
|
2326
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
|
|
2152
2327
|
}
|
|
2153
2328
|
async setRoomCreatorId(userId) {
|
|
2154
2329
|
Assertion.assertString(userId);
|
|
@@ -2159,7 +2334,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
2159
2334
|
url: route,
|
|
2160
2335
|
payload
|
|
2161
2336
|
});
|
|
2162
|
-
return await this.
|
|
2337
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
|
|
2163
2338
|
}
|
|
2164
2339
|
async setRoomAdminId(userId) {
|
|
2165
2340
|
Assertion.assertString(userId);
|
|
@@ -2170,7 +2345,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
2170
2345
|
url: route,
|
|
2171
2346
|
payload
|
|
2172
2347
|
});
|
|
2173
|
-
return await this.
|
|
2348
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
|
|
2174
2349
|
}
|
|
2175
2350
|
async kick(player) {
|
|
2176
2351
|
this.players = this.players.filter((p) => p.id !== player.id);
|
|
@@ -2194,7 +2369,7 @@ var GuildMatch = class _GuildMatch {
|
|
|
2194
2369
|
payload: data
|
|
2195
2370
|
});
|
|
2196
2371
|
this.rest.emit("matchUpdate", this, new _GuildMatch(response, this.manager));
|
|
2197
|
-
return await this.
|
|
2372
|
+
return await __privateMethod(this, _GuildMatch_instances, updateInternals_fn7).call(this, response);
|
|
2198
2373
|
}
|
|
2199
2374
|
async delete() {
|
|
2200
2375
|
const route = Routes.guilds.matches.resource(this.guild.id, this._id);
|
|
@@ -2220,35 +2395,38 @@ var GuildMatch = class _GuildMatch {
|
|
|
2220
2395
|
messages: this?.messages instanceof MessagesManager ? this.messages?.cache?.toArray() : []
|
|
2221
2396
|
};
|
|
2222
2397
|
}
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
this.bet = this.guild.bets.set(data.bet);
|
|
2232
|
-
}
|
|
2398
|
+
};
|
|
2399
|
+
_GuildMatch_instances = new WeakSet();
|
|
2400
|
+
updateInternals_fn7 = async function(data) {
|
|
2401
|
+
if (!data) return;
|
|
2402
|
+
for (let key in data) {
|
|
2403
|
+
if (key === "id" || key === "createdAt" || key === "messages") continue;
|
|
2404
|
+
if (key in this) {
|
|
2405
|
+
this[key] = data[key];
|
|
2233
2406
|
}
|
|
2234
|
-
if (
|
|
2235
|
-
|
|
2236
|
-
else {
|
|
2237
|
-
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
2238
|
-
this.messages.set(data.messages);
|
|
2239
|
-
}
|
|
2407
|
+
if (key === "bet") {
|
|
2408
|
+
this.bet = this.guild.bets.set(data.bet);
|
|
2240
2409
|
}
|
|
2241
|
-
|
|
2242
|
-
|
|
2410
|
+
}
|
|
2411
|
+
if (data?.messages?.length !== 0) {
|
|
2412
|
+
if (this?.messages instanceof MessagesManager) this.messages.set(data.messages);
|
|
2413
|
+
else {
|
|
2414
|
+
this.messages = new MessagesManager(this, Routes.guilds.matches.resource(this.guild_id, this._id, "messages"));
|
|
2415
|
+
this.messages.set(data.messages);
|
|
2243
2416
|
}
|
|
2244
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2245
|
-
this.manager.set(this);
|
|
2246
|
-
return this;
|
|
2247
2417
|
}
|
|
2418
|
+
if (!(this.bet instanceof GuildBet) && data?.bet) {
|
|
2419
|
+
this.bet = this.guild.bets.cache.get(data._id) ?? await this.guild.bets.fetch({ betId: data?.bet?._id });
|
|
2420
|
+
}
|
|
2421
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2422
|
+
this.manager.set(this);
|
|
2423
|
+
return this;
|
|
2248
2424
|
};
|
|
2425
|
+
var GuildMatch = _GuildMatch;
|
|
2249
2426
|
|
|
2250
2427
|
// src/structures/user/GuildUser.ts
|
|
2251
|
-
var
|
|
2428
|
+
var _GuildUser_instances, updateInternals_fn8;
|
|
2429
|
+
var _GuildUser = class _GuildUser {
|
|
2252
2430
|
/**
|
|
2253
2431
|
* Bet user
|
|
2254
2432
|
* @param data The user's data
|
|
@@ -2256,6 +2434,7 @@ var GuildUser = class _GuildUser {
|
|
|
2256
2434
|
* @param rest The rest client
|
|
2257
2435
|
*/
|
|
2258
2436
|
constructor(data, manager) {
|
|
2437
|
+
__privateAdd(this, _GuildUser_instances);
|
|
2259
2438
|
/** User's id */
|
|
2260
2439
|
__publicField(this, "id");
|
|
2261
2440
|
__publicField(this, "guild_id");
|
|
@@ -2368,7 +2547,7 @@ var GuildUser = class _GuildUser {
|
|
|
2368
2547
|
url: route,
|
|
2369
2548
|
payload
|
|
2370
2549
|
});
|
|
2371
|
-
this.
|
|
2550
|
+
__privateMethod(this, _GuildUser_instances, updateInternals_fn8).call(this, response);
|
|
2372
2551
|
return this;
|
|
2373
2552
|
}
|
|
2374
2553
|
async updateProfile(data) {
|
|
@@ -2389,43 +2568,14 @@ var GuildUser = class _GuildUser {
|
|
|
2389
2568
|
url: route,
|
|
2390
2569
|
payload: _data
|
|
2391
2570
|
});
|
|
2392
|
-
this.
|
|
2393
|
-
return this;
|
|
2394
|
-
}
|
|
2395
|
-
_updateInternals(data) {
|
|
2396
|
-
for (let key in data) {
|
|
2397
|
-
if (key === "id" || key === "createdAt") continue;
|
|
2398
|
-
if (key in this) {
|
|
2399
|
-
this[key] = data[key];
|
|
2400
|
-
}
|
|
2401
|
-
if (key === "adverts") {
|
|
2402
|
-
this.adverts = [];
|
|
2403
|
-
for (let _adv of data.adverts) {
|
|
2404
|
-
this.adverts.push({
|
|
2405
|
-
_id: _adv._id,
|
|
2406
|
-
admin_id: _adv.admin_id,
|
|
2407
|
-
role_id: _adv.role_id,
|
|
2408
|
-
reason: _adv.reason,
|
|
2409
|
-
points_removed: _adv.points_removed,
|
|
2410
|
-
proof: _adv.proof,
|
|
2411
|
-
proof_ext: _adv.proof_ext,
|
|
2412
|
-
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
2413
|
-
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
2414
|
-
});
|
|
2415
|
-
}
|
|
2416
|
-
}
|
|
2417
|
-
}
|
|
2418
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2419
|
-
this.createdAt = new Date(data.createdAt);
|
|
2420
|
-
this.manager.set(this);
|
|
2421
|
-
this.rest.emit("userUpdate", this);
|
|
2571
|
+
__privateMethod(this, _GuildUser_instances, updateInternals_fn8).call(this, response);
|
|
2422
2572
|
return this;
|
|
2423
2573
|
}
|
|
2424
2574
|
async addAdvert(data) {
|
|
2425
2575
|
const route = Routes.guilds.users.resource(this.manager.guild.id, this.id, "adverts");
|
|
2426
2576
|
const payload = data;
|
|
2427
2577
|
const response = await this.rest.request({ method: "POST", url: route, payload });
|
|
2428
|
-
return this.
|
|
2578
|
+
return __privateMethod(this, _GuildUser_instances, updateInternals_fn8).call(this, response);
|
|
2429
2579
|
}
|
|
2430
2580
|
async removeAdvert(advertId) {
|
|
2431
2581
|
let advs = this.adverts;
|
|
@@ -2434,7 +2584,7 @@ var GuildUser = class _GuildUser {
|
|
|
2434
2584
|
const payload = { adverts: advs };
|
|
2435
2585
|
const route = Routes.guilds.users.update(this.manager.guild.id, this.id);
|
|
2436
2586
|
const response = await this.rest.request({ method: "PATCH", url: route, payload });
|
|
2437
|
-
return this.
|
|
2587
|
+
return __privateMethod(this, _GuildUser_instances, updateInternals_fn8).call(this, response);
|
|
2438
2588
|
}
|
|
2439
2589
|
/**
|
|
2440
2590
|
* Update certain property
|
|
@@ -2485,7 +2635,7 @@ var GuildUser = class _GuildUser {
|
|
|
2485
2635
|
url: route,
|
|
2486
2636
|
payload
|
|
2487
2637
|
});
|
|
2488
|
-
this.
|
|
2638
|
+
__privateMethod(this, _GuildUser_instances, updateInternals_fn8).call(this, response);
|
|
2489
2639
|
return this;
|
|
2490
2640
|
}
|
|
2491
2641
|
async delete() {
|
|
@@ -2510,6 +2660,37 @@ var GuildUser = class _GuildUser {
|
|
|
2510
2660
|
return json;
|
|
2511
2661
|
}
|
|
2512
2662
|
};
|
|
2663
|
+
_GuildUser_instances = new WeakSet();
|
|
2664
|
+
updateInternals_fn8 = function(data) {
|
|
2665
|
+
for (let key in data) {
|
|
2666
|
+
if (key === "id" || key === "createdAt") continue;
|
|
2667
|
+
if (key in this) {
|
|
2668
|
+
this[key] = data[key];
|
|
2669
|
+
}
|
|
2670
|
+
if (key === "adverts") {
|
|
2671
|
+
this.adverts = [];
|
|
2672
|
+
for (let _adv of data.adverts) {
|
|
2673
|
+
this.adverts.push({
|
|
2674
|
+
_id: _adv._id,
|
|
2675
|
+
admin_id: _adv.admin_id,
|
|
2676
|
+
role_id: _adv.role_id,
|
|
2677
|
+
reason: _adv.reason,
|
|
2678
|
+
points_removed: _adv.points_removed,
|
|
2679
|
+
proof: _adv.proof,
|
|
2680
|
+
proof_ext: _adv.proof_ext,
|
|
2681
|
+
createdAt: _adv.createdAt ? new Date(_adv.createdAt) : /* @__PURE__ */ new Date(),
|
|
2682
|
+
updatedAt: _adv.updatedAt ? new Date(_adv.updatedAt) : /* @__PURE__ */ new Date()
|
|
2683
|
+
});
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2687
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2688
|
+
this.createdAt = new Date(data.createdAt);
|
|
2689
|
+
this.manager.set(this);
|
|
2690
|
+
this.rest.emit("userUpdate", this);
|
|
2691
|
+
return this;
|
|
2692
|
+
};
|
|
2693
|
+
var GuildUser = _GuildUser;
|
|
2513
2694
|
|
|
2514
2695
|
// src/structures/vipmember/VipMember.ts
|
|
2515
2696
|
var _VipMember_instances, updateData_fn;
|
|
@@ -2648,8 +2829,10 @@ updateData_fn = function(data) {
|
|
|
2648
2829
|
var VipMember = _VipMember;
|
|
2649
2830
|
|
|
2650
2831
|
// src/structures/ticket/Ticket.ts
|
|
2832
|
+
var _GuildTicket_instances, updateInternals_fn9;
|
|
2651
2833
|
var GuildTicket = class {
|
|
2652
2834
|
constructor(data, manager) {
|
|
2835
|
+
__privateAdd(this, _GuildTicket_instances);
|
|
2653
2836
|
__publicField(this, "_id");
|
|
2654
2837
|
__publicField(this, "guild_id");
|
|
2655
2838
|
__publicField(this, "type");
|
|
@@ -2686,7 +2869,7 @@ var GuildTicket = class {
|
|
|
2686
2869
|
method: "GET",
|
|
2687
2870
|
url: route
|
|
2688
2871
|
});
|
|
2689
|
-
return this.
|
|
2872
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
|
|
2690
2873
|
}
|
|
2691
2874
|
async setCustomerRating(rating) {
|
|
2692
2875
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "customer_rating");
|
|
@@ -2696,7 +2879,7 @@ var GuildTicket = class {
|
|
|
2696
2879
|
url: route,
|
|
2697
2880
|
payload
|
|
2698
2881
|
});
|
|
2699
|
-
return this.
|
|
2882
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
|
|
2700
2883
|
}
|
|
2701
2884
|
async setAdminId(id) {
|
|
2702
2885
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "admin_id");
|
|
@@ -2706,7 +2889,7 @@ var GuildTicket = class {
|
|
|
2706
2889
|
url: route,
|
|
2707
2890
|
payload
|
|
2708
2891
|
});
|
|
2709
|
-
return this.
|
|
2892
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
|
|
2710
2893
|
}
|
|
2711
2894
|
async setChannelId(id) {
|
|
2712
2895
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "channel_id");
|
|
@@ -2716,7 +2899,7 @@ var GuildTicket = class {
|
|
|
2716
2899
|
url: route,
|
|
2717
2900
|
payload
|
|
2718
2901
|
});
|
|
2719
|
-
return this.
|
|
2902
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
|
|
2720
2903
|
}
|
|
2721
2904
|
async setClosedById(id) {
|
|
2722
2905
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "closed_by_id");
|
|
@@ -2726,7 +2909,7 @@ var GuildTicket = class {
|
|
|
2726
2909
|
url: route,
|
|
2727
2910
|
payload
|
|
2728
2911
|
});
|
|
2729
|
-
return this.
|
|
2912
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
|
|
2730
2913
|
}
|
|
2731
2914
|
async setStatus(status) {
|
|
2732
2915
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "status");
|
|
@@ -2736,7 +2919,7 @@ var GuildTicket = class {
|
|
|
2736
2919
|
url: route,
|
|
2737
2920
|
payload
|
|
2738
2921
|
});
|
|
2739
|
-
return this.
|
|
2922
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
|
|
2740
2923
|
}
|
|
2741
2924
|
async addMessage(message) {
|
|
2742
2925
|
const route = Routes.guilds.tickets.resource(this.guild.id, this._id, "messages");
|
|
@@ -2746,25 +2929,28 @@ var GuildTicket = class {
|
|
|
2746
2929
|
url: route,
|
|
2747
2930
|
payload
|
|
2748
2931
|
});
|
|
2749
|
-
return this.
|
|
2750
|
-
}
|
|
2751
|
-
_updateInternals(data) {
|
|
2752
|
-
for (let key in data) {
|
|
2753
|
-
if (key === "id" || key === "createdAt") continue;
|
|
2754
|
-
if (key in this) {
|
|
2755
|
-
this[key] = data[key];
|
|
2756
|
-
}
|
|
2757
|
-
}
|
|
2758
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2759
|
-
this.createdAt = new Date(data.createdAt);
|
|
2760
|
-
this.manager.set(this);
|
|
2761
|
-
return this;
|
|
2932
|
+
return __privateMethod(this, _GuildTicket_instances, updateInternals_fn9).call(this, response);
|
|
2762
2933
|
}
|
|
2763
2934
|
};
|
|
2935
|
+
_GuildTicket_instances = new WeakSet();
|
|
2936
|
+
updateInternals_fn9 = function(data) {
|
|
2937
|
+
for (let key in data) {
|
|
2938
|
+
if (key === "id" || key === "createdAt") continue;
|
|
2939
|
+
if (key in this) {
|
|
2940
|
+
this[key] = data[key];
|
|
2941
|
+
}
|
|
2942
|
+
}
|
|
2943
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2944
|
+
this.createdAt = new Date(data.createdAt);
|
|
2945
|
+
this.manager.set(this);
|
|
2946
|
+
return this;
|
|
2947
|
+
};
|
|
2764
2948
|
|
|
2765
2949
|
// src/structures/minesgame/MinesGame.ts
|
|
2950
|
+
var _MinesGame_instances, updateInternals_fn10;
|
|
2766
2951
|
var MinesGame = class {
|
|
2767
2952
|
constructor(data, manager) {
|
|
2953
|
+
__privateAdd(this, _MinesGame_instances);
|
|
2768
2954
|
__publicField(this, "guild_id");
|
|
2769
2955
|
__publicField(this, "_id");
|
|
2770
2956
|
__publicField(this, "creatorId");
|
|
@@ -2798,7 +2984,7 @@ var MinesGame = class {
|
|
|
2798
2984
|
method: "GET",
|
|
2799
2985
|
url: route
|
|
2800
2986
|
});
|
|
2801
|
-
return this.
|
|
2987
|
+
return __privateMethod(this, _MinesGame_instances, updateInternals_fn10).call(this, response);
|
|
2802
2988
|
}
|
|
2803
2989
|
async delete() {
|
|
2804
2990
|
const route = `/${Routes.fields("minesgames", this._id)}`;
|
|
@@ -2806,7 +2992,7 @@ var MinesGame = class {
|
|
|
2806
2992
|
method: "delete",
|
|
2807
2993
|
url: route
|
|
2808
2994
|
});
|
|
2809
|
-
return this.
|
|
2995
|
+
return __privateMethod(this, _MinesGame_instances, updateInternals_fn10).call(this, response);
|
|
2810
2996
|
}
|
|
2811
2997
|
async update(data) {
|
|
2812
2998
|
const route = `/${Routes.fields("minesgames", this._id)}`;
|
|
@@ -2815,25 +3001,27 @@ var MinesGame = class {
|
|
|
2815
3001
|
url: route,
|
|
2816
3002
|
payload: data
|
|
2817
3003
|
});
|
|
2818
|
-
return this.
|
|
3004
|
+
return __privateMethod(this, _MinesGame_instances, updateInternals_fn10).call(this, response);
|
|
2819
3005
|
}
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
3006
|
+
};
|
|
3007
|
+
_MinesGame_instances = new WeakSet();
|
|
3008
|
+
updateInternals_fn10 = function(data) {
|
|
3009
|
+
for (let key in data) {
|
|
3010
|
+
if (key === "id" || key === "createdAt") continue;
|
|
3011
|
+
if (key in this) {
|
|
3012
|
+
this[key] = data[key];
|
|
2826
3013
|
}
|
|
2827
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2828
|
-
this.manager.set(this);
|
|
2829
|
-
return this;
|
|
2830
3014
|
}
|
|
3015
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
3016
|
+
this.manager.set(this);
|
|
3017
|
+
return this;
|
|
2831
3018
|
};
|
|
2832
3019
|
|
|
2833
3020
|
// src/structures/automaticmessage/AutomaticMessage.ts
|
|
3021
|
+
var _AutomaticMessage_instances, updateInternals_fn11;
|
|
2834
3022
|
var AutomaticMessage = class {
|
|
2835
3023
|
constructor(data, manager) {
|
|
2836
|
-
|
|
3024
|
+
__privateAdd(this, _AutomaticMessage_instances);
|
|
2837
3025
|
__publicField(this, "id");
|
|
2838
3026
|
__publicField(this, "type");
|
|
2839
3027
|
__publicField(this, "admin_id");
|
|
@@ -2852,7 +3040,6 @@ var AutomaticMessage = class {
|
|
|
2852
3040
|
this.manager = manager;
|
|
2853
3041
|
this.guild = manager.guild;
|
|
2854
3042
|
this.rest = manager.rest;
|
|
2855
|
-
this._id = data?._id;
|
|
2856
3043
|
this.id = data?.id;
|
|
2857
3044
|
this.type = data?.type;
|
|
2858
3045
|
this.admin_id = data?.admin_id;
|
|
@@ -2867,12 +3054,7 @@ var AutomaticMessage = class {
|
|
|
2867
3054
|
this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : /* @__PURE__ */ new Date();
|
|
2868
3055
|
}
|
|
2869
3056
|
async fetch() {
|
|
2870
|
-
|
|
2871
|
-
const response = await this.rest.request({
|
|
2872
|
-
method: "get",
|
|
2873
|
-
url: route
|
|
2874
|
-
});
|
|
2875
|
-
return this._updateInternals(response);
|
|
3057
|
+
return this.manager.fetch(this.id);
|
|
2876
3058
|
}
|
|
2877
3059
|
async addChannelId(...id) {
|
|
2878
3060
|
const ids = [.../* @__PURE__ */ new Set([...this.channel_ids, ...id])];
|
|
@@ -2884,39 +3066,28 @@ var AutomaticMessage = class {
|
|
|
2884
3066
|
return this.update({ channel_ids: ids });
|
|
2885
3067
|
}
|
|
2886
3068
|
async update(data) {
|
|
3069
|
+
this.manager.cache.set(this.id, { ...this, ...data, id: this.id });
|
|
2887
3070
|
const route = Routes.guilds.get(this.guild.id);
|
|
2888
3071
|
const response = await this.rest.request({
|
|
2889
3072
|
method: "patch",
|
|
2890
3073
|
url: route,
|
|
2891
|
-
payload: { automatic_messages: this.manager.
|
|
3074
|
+
payload: { automatic_messages: this.manager.toJSON() }
|
|
2892
3075
|
});
|
|
2893
|
-
return this.
|
|
3076
|
+
return __privateMethod(this, _AutomaticMessage_instances, updateInternals_fn11).call(this, response);
|
|
2894
3077
|
}
|
|
2895
3078
|
async delete() {
|
|
2896
|
-
this.manager.cache.delete(this.
|
|
3079
|
+
this.manager.cache.delete(this.id);
|
|
3080
|
+
this.guild.automatic_messages = this.manager.cache.toArray();
|
|
2897
3081
|
const route = Routes.guilds.get(this.guild.id);
|
|
2898
3082
|
const response = await this.rest.request({
|
|
2899
3083
|
method: "patch",
|
|
2900
3084
|
url: route,
|
|
2901
|
-
payload: { automatic_messages: this.manager.
|
|
3085
|
+
payload: { automatic_messages: this.manager.toJSON() }
|
|
2902
3086
|
});
|
|
2903
3087
|
return this.manager.set(response.automatic_messages);
|
|
2904
3088
|
}
|
|
2905
|
-
_updateInternals(data) {
|
|
2906
|
-
for (let key in data) {
|
|
2907
|
-
if (key === "_id" || key === "createdAt") continue;
|
|
2908
|
-
if (key in this) {
|
|
2909
|
-
this[key] = data[key];
|
|
2910
|
-
}
|
|
2911
|
-
}
|
|
2912
|
-
this.updatedAt = /* @__PURE__ */ new Date();
|
|
2913
|
-
this.createdAt = new Date(data.createdAt);
|
|
2914
|
-
this.manager._add(this);
|
|
2915
|
-
return this;
|
|
2916
|
-
}
|
|
2917
3089
|
toJSON() {
|
|
2918
3090
|
return {
|
|
2919
|
-
_id: this._id,
|
|
2920
3091
|
id: this.id,
|
|
2921
3092
|
type: this.type,
|
|
2922
3093
|
admin_id: this.admin_id,
|
|
@@ -2932,6 +3103,20 @@ var AutomaticMessage = class {
|
|
|
2932
3103
|
};
|
|
2933
3104
|
}
|
|
2934
3105
|
};
|
|
3106
|
+
_AutomaticMessage_instances = new WeakSet();
|
|
3107
|
+
updateInternals_fn11 = function(data) {
|
|
3108
|
+
const _this = data?.automatic_messages?.find((m) => m.id === this.id);
|
|
3109
|
+
for (let key in _this) {
|
|
3110
|
+
if (key === "id" || key === "createdAt") continue;
|
|
3111
|
+
if (key in this) {
|
|
3112
|
+
this[key] = _this[key];
|
|
3113
|
+
}
|
|
3114
|
+
}
|
|
3115
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
3116
|
+
this.createdAt = new Date(data.createdAt);
|
|
3117
|
+
this.manager._add(data.automatic_messages);
|
|
3118
|
+
return this;
|
|
3119
|
+
};
|
|
2935
3120
|
|
|
2936
3121
|
// src/utils/randomKeyGenerator.ts
|
|
2937
3122
|
import { randomBytes } from "crypto";
|
|
@@ -2945,25 +3130,19 @@ var AutomaticMessageManager = class extends BaseManager {
|
|
|
2945
3130
|
super(guild);
|
|
2946
3131
|
this.guild = guild;
|
|
2947
3132
|
this.rest = guild.rest;
|
|
2948
|
-
this.base_url = Routes.guilds.resource(guild.id
|
|
3133
|
+
this.base_url = Routes.guilds.resource(guild.id);
|
|
2949
3134
|
this.cache = new Collection();
|
|
2950
3135
|
if (guild.automatic_messages && guild.automatic_messages.length !== 0) this.set(guild.automatic_messages);
|
|
2951
3136
|
else this.guild.automatic_messages = [];
|
|
2952
3137
|
}
|
|
2953
3138
|
async fetch(messageId) {
|
|
2954
3139
|
const route = this.base_url;
|
|
2955
|
-
if (messageId) {
|
|
2956
|
-
const response2 = await this.rest.request({
|
|
2957
|
-
method: "get",
|
|
2958
|
-
url: `${route}`
|
|
2959
|
-
});
|
|
2960
|
-
return this._add(response2).find((m) => m.id === messageId);
|
|
2961
|
-
}
|
|
2962
3140
|
const response = await this.rest.request({
|
|
2963
3141
|
method: "get",
|
|
2964
3142
|
url: route
|
|
2965
3143
|
});
|
|
2966
|
-
|
|
3144
|
+
this._add(response.automatic_messages);
|
|
3145
|
+
return this.cache;
|
|
2967
3146
|
}
|
|
2968
3147
|
async create(data) {
|
|
2969
3148
|
if (!data.type) throw new Error(`Missing message's type.`);
|
|
@@ -2990,6 +3169,7 @@ var AutomaticMessageManager = class extends BaseManager {
|
|
|
2990
3169
|
if (data instanceof AutomaticMessage) this.cache.set(data.id, data);
|
|
2991
3170
|
else this.cache.set(data.id, new AutomaticMessage(data, this));
|
|
2992
3171
|
}
|
|
3172
|
+
this.guild.automatic_messages = this.cache.toArray();
|
|
2993
3173
|
return this.cache;
|
|
2994
3174
|
}
|
|
2995
3175
|
set(data) {
|
|
@@ -3018,6 +3198,10 @@ var AutomaticMessageManager = class extends BaseManager {
|
|
|
3018
3198
|
});
|
|
3019
3199
|
return response;
|
|
3020
3200
|
}
|
|
3201
|
+
toJSON() {
|
|
3202
|
+
[...this.cache.values()].map((m) => console.log(m instanceof AutomaticMessage));
|
|
3203
|
+
return this.cache.toArray();
|
|
3204
|
+
}
|
|
3021
3205
|
};
|
|
3022
3206
|
|
|
3023
3207
|
// src/managers/bet/GuildBetManager.ts
|
|
@@ -3438,15 +3622,14 @@ var GuildTicketManager = class {
|
|
|
3438
3622
|
} else {
|
|
3439
3623
|
categories.push(data);
|
|
3440
3624
|
}
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3625
|
+
return this.guild.update({
|
|
3626
|
+
tickets_configuration: {
|
|
3627
|
+
categories,
|
|
3628
|
+
creationCategory: this.guild.tickets_configuration.creationCategory,
|
|
3629
|
+
deletionCategory: this.guild.tickets_configuration.deletionCategory,
|
|
3630
|
+
rating_channel_id: this.guild.tickets_configuration.rating_channel_id
|
|
3631
|
+
}
|
|
3447
3632
|
});
|
|
3448
|
-
this.guild._updateInternals(response);
|
|
3449
|
-
return response;
|
|
3450
3633
|
}
|
|
3451
3634
|
async deleteTicketCategory(data) {
|
|
3452
3635
|
let categories = this.guild.tickets_configuration.categories;
|
|
@@ -3460,8 +3643,14 @@ var GuildTicketManager = class {
|
|
|
3460
3643
|
url: route,
|
|
3461
3644
|
payload
|
|
3462
3645
|
});
|
|
3463
|
-
this.guild.
|
|
3464
|
-
|
|
3646
|
+
return this.guild.update({
|
|
3647
|
+
tickets_configuration: {
|
|
3648
|
+
categories,
|
|
3649
|
+
creationCategory: this.guild.tickets_configuration.creationCategory,
|
|
3650
|
+
deletionCategory: this.guild.tickets_configuration.deletionCategory,
|
|
3651
|
+
rating_channel_id: this.guild.tickets_configuration.rating_channel_id
|
|
3652
|
+
}
|
|
3653
|
+
});
|
|
3465
3654
|
}
|
|
3466
3655
|
async fetch(options) {
|
|
3467
3656
|
if (options && options.cache) return this.cache;
|