@duque.edits/sdk 0.1.4 → 0.1.6

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.
Files changed (119) hide show
  1. package/dist/index.js +4 -27
  2. package/dist/managers/base.js +26 -0
  3. package/dist/managers/buffer/BufferManager.js +8 -2
  4. package/dist/managers/guild/GuildManager.js +42 -25
  5. package/dist/managers/index.js +23 -0
  6. package/dist/managers/match/GuildMatchManager.js +42 -29
  7. package/dist/managers/message/MessagesManager.js +48 -0
  8. package/dist/managers/permission/GuildPermissionManager.js +29 -52
  9. package/dist/managers/ticket/TicketManager.js +77 -0
  10. package/dist/managers/user/GuildUserManager.js +73 -85
  11. package/dist/managers/vipmember/VipMemberManager.js +124 -0
  12. package/dist/rest/REST.js +40 -21
  13. package/dist/rest/Routes.js +31 -17
  14. package/dist/rest/index.js +19 -0
  15. package/dist/structures/Collection.js +1 -1
  16. package/dist/structures/guild/Guild.js +72 -90
  17. package/dist/structures/index.js +22 -0
  18. package/dist/structures/match/GuildMatch.js +64 -111
  19. package/dist/structures/ticket/Ticket.js +119 -0
  20. package/dist/structures/user/GuildUser.js +48 -40
  21. package/dist/structures/vipmember/VipMember.js +137 -0
  22. package/dist/types/api/APIGiveaway.js +2 -0
  23. package/dist/types/api/APILogMessage.js +2 -0
  24. package/dist/types/api/APIVipMember.js +2 -0
  25. package/dist/types/api/index.js +36 -0
  26. package/dist/types/index.js +1 -20
  27. package/dist/utils/getRandomNumber.js +6 -0
  28. package/package.json +11 -18
  29. package/types/index.d.ts +4 -0
  30. package/types/managers/base.d.ts +17 -0
  31. package/types/managers/buffer/BufferManager.d.ts +19 -0
  32. package/{dist → types}/managers/guild/GuildManager.d.ts +12 -4
  33. package/types/managers/index.d.ts +7 -0
  34. package/{dist → types}/managers/match/GuildMatchManager.d.ts +10 -12
  35. package/types/managers/message/MessagesManager.d.ts +17 -0
  36. package/types/managers/permission/GuildPermissionManager.d.ts +8 -0
  37. package/types/managers/ticket/TicketManager.d.ts +22 -0
  38. package/types/managers/user/GuildUserManager.d.ts +19 -0
  39. package/types/managers/vipmember/VipMemberManager.d.ts +33 -0
  40. package/types/rest/APIEndpoints.d.ts +11 -0
  41. package/{dist → types}/rest/REST.d.ts +9 -16
  42. package/{dist → types}/rest/Routes.d.ts +18 -2
  43. package/types/rest/index.d.ts +3 -0
  44. package/{dist → types}/structures/guild/Guild.d.ts +17 -29
  45. package/types/structures/index.d.ts +6 -0
  46. package/{dist → types}/structures/match/GuildMatch.d.ts +12 -22
  47. package/types/structures/ticket/Ticket.d.ts +30 -0
  48. package/{dist → types}/structures/user/GuildUser.d.ts +5 -3
  49. package/types/structures/vipmember/VipMember.d.ts +54 -0
  50. package/types/types/RestTypes.d.ts +34 -0
  51. package/types/types/api/APIGiveaway.d.ts +27 -0
  52. package/{dist → types}/types/api/APIGuild.d.ts +9 -2
  53. package/{dist → types}/types/api/APIGuildMatch.d.ts +9 -7
  54. package/types/types/api/APIGuildTicket.d.ts +16 -0
  55. package/{dist → types}/types/api/APIGuildUser.d.ts +3 -1
  56. package/types/types/api/APILogMessage.d.ts +7 -0
  57. package/types/types/api/APIMessage.d.ts +11 -0
  58. package/{dist → types}/types/api/APIPlayer.d.ts +1 -1
  59. package/types/types/api/APIVipMember.d.ts +20 -0
  60. package/{dist → types}/types/api/index.d.ts +23 -1
  61. package/types/types/index.d.ts +2 -0
  62. package/types/utils/getRandomNumber.d.ts +1 -0
  63. package/dist/index.d.ts +0 -27
  64. package/dist/managers/bet/GuildBetManager.d.ts +0 -35
  65. package/dist/managers/bet/GuildBetManager.js +0 -126
  66. package/dist/managers/betuser/GuildBetUserManager.d.ts +0 -36
  67. package/dist/managers/betuser/GuildBetUserManager.js +0 -151
  68. package/dist/managers/buffer/BufferManager.d.ts +0 -14
  69. package/dist/managers/channel/ChannelManager.d.ts +0 -39
  70. package/dist/managers/channel/ChannelManager.js +0 -148
  71. package/dist/managers/groupedchannel/GroupedChannelManager.d.ts +0 -34
  72. package/dist/managers/groupedchannel/GroupedChannelManager.js +0 -92
  73. package/dist/managers/mediator/GuildMediatorManager.d.ts +0 -32
  74. package/dist/managers/mediator/GuildMediatorManager.js +0 -98
  75. package/dist/managers/messages/MessagesManager.d.ts +0 -32
  76. package/dist/managers/messages/MessagesManager.js +0 -89
  77. package/dist/managers/permission/GuildPermissionManager.d.ts +0 -26
  78. package/dist/managers/product/GuildProductManager.d.ts +0 -32
  79. package/dist/managers/product/GuildProductManager.js +0 -103
  80. package/dist/managers/ticket/GuildTicketManager.d.ts +0 -32
  81. package/dist/managers/ticket/GuildTicketManager.js +0 -100
  82. package/dist/managers/user/GuildUserManager.d.ts +0 -33
  83. package/dist/rest/APIEndpoints.d.ts +0 -11
  84. package/dist/structures/bet/GuildBet.d.ts +0 -87
  85. package/dist/structures/bet/GuildBet.js +0 -284
  86. package/dist/structures/betuser/GuildBetUser.d.ts +0 -85
  87. package/dist/structures/betuser/GuildBetUser.js +0 -211
  88. package/dist/structures/channel/Channel.d.ts +0 -31
  89. package/dist/structures/channel/Channel.js +0 -57
  90. package/dist/structures/groupedchannel/GroupedChannel.d.ts +0 -34
  91. package/dist/structures/groupedchannel/GroupedChannel.js +0 -121
  92. package/dist/structures/mediator/GuildMediator.d.ts +0 -41
  93. package/dist/structures/mediator/GuildMediator.js +0 -131
  94. package/dist/structures/product/GuildProduct.d.ts +0 -52
  95. package/dist/structures/product/GuildProduct.js +0 -175
  96. package/dist/structures/shop/GuildShop.d.ts +0 -34
  97. package/dist/structures/shop/GuildShop.js +0 -80
  98. package/dist/structures/ticket/GuildTicket.d.ts +0 -52
  99. package/dist/structures/ticket/GuildTicket.js +0 -172
  100. package/dist/types/api/APIGuildTicket.d.ts +0 -26
  101. package/dist/types/api/APIMessage.d.ts +0 -12
  102. package/dist/types/index.d.ts +0 -21
  103. /package/dist/types/{api/APIGuildMessage.js → RestTypes.js} +0 -0
  104. /package/{dist → types}/structures/Collection.d.ts +0 -0
  105. /package/{dist → types}/types/api/APIBaseChannel.d.ts +0 -0
  106. /package/{dist → types}/types/api/APIBetChannel.d.ts +0 -0
  107. /package/{dist → types}/types/api/APIBetMessage.d.ts +0 -0
  108. /package/{dist → types}/types/api/APIGuildBet.d.ts +0 -0
  109. /package/{dist → types}/types/api/APIGuildBetUser.d.ts +0 -0
  110. /package/{dist → types}/types/api/APIGuildChannel.d.ts +0 -0
  111. /package/{dist → types}/types/api/APIGuildEmoji.d.ts +0 -0
  112. /package/{dist → types}/types/api/APIGuildGroupedChannel.d.ts +0 -0
  113. /package/{dist → types}/types/api/APIGuildMediator.d.ts +0 -0
  114. /package/{dist → types}/types/api/APIGuildMessage.d.ts +0 -0
  115. /package/{dist → types}/types/api/APIGuildPermissions.d.ts +0 -0
  116. /package/{dist → types}/types/api/APIGuildRole.d.ts +0 -0
  117. /package/{dist → types}/types/api/APIGuildShop.d.ts +0 -0
  118. /package/{dist → types}/types/api/APIProduct.d.ts +0 -0
  119. /package/{dist → types}/utils/Assertion.d.ts +0 -0
@@ -1,175 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GuildProduct = void 0;
4
- const Routes_1 = require("../../rest/Routes");
5
- const Assertion_1 = require("../../utils/Assertion");
6
- class GuildProduct {
7
- /** Product's name */
8
- name;
9
- /** Product's description */
10
- description;
11
- /** Product's id */
12
- id;
13
- /** Product's price */
14
- price;
15
- /** Product's buyers */
16
- buyers;
17
- /** Product's emoji */
18
- emoji;
19
- /** Creation Date */
20
- createdAt;
21
- /** Updated Date */
22
- updatedAt;
23
- /** The given manager */
24
- manager;
25
- /** The rest client */
26
- rest;
27
- /**
28
- * Bet product
29
- * @param data The product's data
30
- * @param manager The manager
31
- * @param rest The rest client
32
- */
33
- constructor(data, manager, rest) {
34
- this.name = data?.name;
35
- this.id = data?.id;
36
- this.price = data?.price;
37
- this.buyers = data?.buyers;
38
- this.emoji = data?.emoji;
39
- this.description = data?.description;
40
- this.createdAt = data?.createdAt ? new Date(data?.createdAt) : new Date();
41
- this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : new Date();
42
- this.manager = manager;
43
- this.rest = rest;
44
- }
45
- /** String representation of this product */
46
- toString() {
47
- return `<@${this.id}>`;
48
- }
49
- /**
50
- * Fetches the product
51
- * @returns New Instance of the product
52
- */
53
- async fetch() {
54
- const route = Routes_1.Routes.guilds.shop.products.get(this.manager.guild.id, this.id);
55
- const response = await this.rest.request({
56
- method: "get",
57
- url: route,
58
- });
59
- const product = new GuildProduct(response, this.manager, this.rest);
60
- this.manager.cache.set(product.id, product);
61
- return product;
62
- }
63
- async setPrice(price) {
64
- Assertion_1.Assertion.assertNumber(price);
65
- const route = Routes_1.Routes.guilds.shop.products.resource(this.id, this.manager.guild.id, "price");
66
- const payload = { price };
67
- const response = await this.rest.request({
68
- method: "PATCH",
69
- url: route,
70
- });
71
- this.price = response.price;
72
- this.manager.cache.set(this.id, this);
73
- return this;
74
- }
75
- async addBuyer(id, name, type) {
76
- Assertion_1.Assertion.assertString(id);
77
- Assertion_1.Assertion.assertString(name);
78
- Assertion_1.Assertion.assertString(type);
79
- const payload = { id, name, type };
80
- const route = Routes_1.Routes.guilds.shop.products.resource(this.id, this.manager.guild.id, "buyers");
81
- const response = await this.rest.request({
82
- method: "POST",
83
- url: route,
84
- payload,
85
- });
86
- let user;
87
- if (type == "bet") {
88
- user = this.manager.guild.betUsers.cache.get(id);
89
- user.items = [...new Set([...user.items, this.id])];
90
- this.manager.guild.betUsers.cache.set(user.id, user);
91
- this.rest.betUsers.set(user.id, user);
92
- }
93
- else if (type == "match") {
94
- user = this.manager.guild.users.cache.get(id);
95
- user.items = [...new Set([...user.items, this.id])];
96
- this.manager.guild.users.cache.set(user.id, user);
97
- this.rest.users.set(user.id, user);
98
- }
99
- this.buyers = response.buyers;
100
- this.manager.cache.set(this.id, this);
101
- return this;
102
- }
103
- async removeBuyer(id, name, type) {
104
- Assertion_1.Assertion.assertString(id);
105
- Assertion_1.Assertion.assertString(name);
106
- Assertion_1.Assertion.assertString(type);
107
- const payload = { id, name, type };
108
- const route = Routes_1.Routes.guilds.shop.products.resource(this.id, this.manager.guild.id, "buyers", id);
109
- const response = await this.rest.request({
110
- method: "DELETE",
111
- url: route,
112
- payload,
113
- });
114
- let user;
115
- if (type == "bet") {
116
- user = this.manager.guild.betUsers.cache.get(id);
117
- user.items = [
118
- ...new Set(user.items.filter((item) => item != this.id)),
119
- ];
120
- this.manager.guild.betUsers.cache.set(user.id, user);
121
- }
122
- else if (type == "match") {
123
- user = this.manager.guild.users.cache.get(id);
124
- user.items = [
125
- ...new Set(user.items.filter((item) => item != this.id)),
126
- ];
127
- this.manager.guild.users.cache.set(user.id, user);
128
- }
129
- this.buyers = response.buyers;
130
- this.manager.cache.set(this.id, this);
131
- return this;
132
- }
133
- /**
134
- * Update certain property
135
- * @param data The new data to update with
136
- * @returns
137
- */
138
- async update(payload) {
139
- const route = Routes_1.Routes.guilds.shop.products.get(this.manager.guild.id, this.id);
140
- const response = await this.rest.request({
141
- method: "patch",
142
- url: route,
143
- payload,
144
- });
145
- for (const k in response) {
146
- if (k === "id")
147
- continue;
148
- if (Object.hasOwn(this, k)) {
149
- this[k] = response[k];
150
- }
151
- }
152
- this.manager.cache.set(this.id, this);
153
- return this;
154
- }
155
- async delete() {
156
- const route = Routes_1.Routes.guilds.shop.products.delete(this.manager.guild.id, this.id);
157
- const response = await this.rest.request({
158
- method: "DELETE",
159
- url: route,
160
- });
161
- this.rest.emit("betproductDelete", this);
162
- this.manager.cache.delete(this.id);
163
- return response;
164
- }
165
- toJSON() {
166
- const json = {};
167
- for (const [key, value] of Object.entries(this)) {
168
- if (typeof value !== "function") {
169
- json[key] = value;
170
- }
171
- }
172
- return json;
173
- }
174
- }
175
- exports.GuildProduct = GuildProduct;
@@ -1,34 +0,0 @@
1
- import { REST } from "../../rest/REST";
2
- import { Guild } from "../guild/Guild";
3
- import { Optional } from "../../types/api";
4
- import { APIGuildShop } from "../../types/api/APIGuildShop";
5
- import { GuildProductManager } from "../../managers/product/GuildProductManager";
6
- export declare class GuildShop {
7
- /**shop's product */
8
- products: GuildProductManager;
9
- /** Bought count */
10
- boughtCount: number;
11
- /** Creation Date */
12
- createdAt: Date;
13
- /** Updated Date */
14
- updatedAt: Date;
15
- /** The given guild */
16
- readonly guild: Guild;
17
- /** The rest client */
18
- readonly rest: REST;
19
- /**
20
- * GuildShopshop
21
- * @param data Theshop's data
22
- * @param guild The guild
23
- * @param rest The rest client
24
- */
25
- constructor(data: APIGuildShop, guild: Guild, rest: REST);
26
- toString(): string;
27
- /**
28
- * Fetches theshop
29
- * @returns New Instance of theshop
30
- */
31
- fetch(): Promise<GuildShop>;
32
- update(data: Optional<APIGuildShop>): Promise<this>;
33
- toJSON(): Record<string, unknown>;
34
- }
@@ -1,80 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GuildShop = void 0;
4
- const Routes_1 = require("../../rest/Routes");
5
- const GuildProductManager_1 = require("../../managers/product/GuildProductManager");
6
- class GuildShop {
7
- /**shop's product */
8
- products;
9
- /** Bought count */
10
- boughtCount;
11
- /** Creation Date */
12
- createdAt;
13
- /** Updated Date */
14
- updatedAt;
15
- /** The given guild */
16
- guild;
17
- /** The rest client */
18
- rest;
19
- /**
20
- * GuildShopshop
21
- * @param data Theshop's data
22
- * @param guild The guild
23
- * @param rest The rest client
24
- */
25
- constructor(data, guild, rest) {
26
- this.boughtCount = data?.boughtCount;
27
- this.products = new GuildProductManager_1.GuildProductManager(guild, rest);
28
- this.createdAt = data?.createdAt ? new Date(data?.createdAt) : new Date();
29
- this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : new Date();
30
- this.guild = guild;
31
- this.rest = rest;
32
- this.products.setAll(data?.products);
33
- }
34
- toString() {
35
- return this.boughtCount.toString();
36
- }
37
- /**
38
- * Fetches theshop
39
- * @returns New Instance of theshop
40
- */
41
- async fetch() {
42
- const route = Routes_1.Routes.guilds.shop.get(this.guild.id);
43
- const response = await this.rest.request({
44
- method: "get",
45
- url: route,
46
- });
47
- const shp = new GuildShop(response, this.guild, this.rest);
48
- this.guild.shop = shp;
49
- return shp;
50
- }
51
- async update(data) {
52
- const route = Routes_1.Routes.guilds.shop.get(this.guild.id);
53
- const payload = data;
54
- const response = await this.rest.request({
55
- method: "patch",
56
- url: route,
57
- payload,
58
- });
59
- this.rest.emit("shopUpdate", this, new GuildShop(response, this.guild, this.rest));
60
- for (const k in response) {
61
- if (k === "id")
62
- continue;
63
- if (Object.hasOwn(this, k)) {
64
- this[k] = response[k];
65
- }
66
- }
67
- this.guild.shop = this;
68
- return this;
69
- }
70
- toJSON() {
71
- const json = {};
72
- for (const [key, value] of Object.entries(this)) {
73
- if (typeof value !== "function") {
74
- json[key] = value;
75
- }
76
- }
77
- return json;
78
- }
79
- }
80
- exports.GuildShop = GuildShop;
@@ -1,52 +0,0 @@
1
- import { REST } from "../../rest/REST";
2
- import { Guild } from "../guild/Guild";
3
- import { APIGuildTicket } from "../../types/api/APIGuildTicket";
4
- import { GuildTicketManager } from "../../managers/ticket/GuildTicketManager";
5
- import { MessagesManager } from "../../managers/messages/MessagesManager";
6
- export declare class GuildTicket {
7
- /** Ticket's id */
8
- id: string;
9
- _id: string;
10
- /** Ticket's creator id */
11
- creatorId: string;
12
- /** Ticket's admin id */
13
- adminId: string;
14
- /** Ticket's rating that customer gave */
15
- customerRating: number;
16
- /** Ticket's channel id */
17
- channelId: string;
18
- /** Ticket's closed by who */
19
- closedById: string;
20
- /** Ticket's type */
21
- type: string;
22
- /** Ticket's status */
23
- status: "on" | "off";
24
- /** Ticket's messages */
25
- messages: MessagesManager;
26
- /** Creation Date */
27
- createdAt: Date;
28
- /** Updated Date */
29
- updatedAt: Date;
30
- /** The given guild */
31
- readonly guild: Guild;
32
- /** The rest client */
33
- readonly rest: REST;
34
- readonly manager: GuildTicketManager;
35
- /**
36
- * GuildMediator mediator
37
- * @param data The mediator's data
38
- * @param guild The guild
39
- * @param rest The rest client
40
- */
41
- constructor(data: APIGuildTicket, guild: Guild, manager: GuildTicketManager, rest: REST);
42
- fetch(): Promise<GuildTicket>;
43
- setChannelId(id: string): Promise<this>;
44
- setAdminId(id: string): Promise<this>;
45
- setClosedById(id: string): Promise<this>;
46
- setCustomerRating(rating: string): Promise<this>;
47
- setType(type: string): Promise<this>;
48
- setStatus(status: string): Promise<this>;
49
- delete(): Promise<boolean>;
50
- toJSON(): Record<string, unknown>;
51
- toString(): string;
52
- }
@@ -1,172 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GuildTicket = void 0;
4
- const Routes_1 = require("../../rest/Routes");
5
- const Assertion_1 = require("../../utils/Assertion");
6
- const MessagesManager_1 = require("../../managers/messages/MessagesManager");
7
- class GuildTicket {
8
- /** Ticket's id */
9
- id;
10
- _id;
11
- /** Ticket's creator id */
12
- creatorId;
13
- /** Ticket's admin id */
14
- adminId;
15
- /** Ticket's rating that customer gave */
16
- customerRating;
17
- /** Ticket's channel id */
18
- channelId;
19
- /** Ticket's closed by who */
20
- closedById;
21
- /** Ticket's type */
22
- type;
23
- /** Ticket's status */
24
- status;
25
- /** Ticket's messages */
26
- messages;
27
- /** Creation Date */
28
- createdAt;
29
- /** Updated Date */
30
- updatedAt;
31
- /** The given guild */
32
- guild;
33
- /** The rest client */
34
- rest;
35
- manager;
36
- /**
37
- * GuildMediator mediator
38
- * @param data The mediator's data
39
- * @param guild The guild
40
- * @param rest The rest client
41
- */
42
- constructor(data, guild, manager, rest) {
43
- this.id = data?.id?.toString();
44
- this._id = data?._id?.toString();
45
- this.creatorId = data?.creatorId;
46
- this.adminId = data?.adminId;
47
- this.customerRating = data.customerRating;
48
- this.closedById = data?.closedById;
49
- this.type = data?.type;
50
- this.status = data?.status;
51
- this.channelId = data?.channelId;
52
- this.messages = new MessagesManager_1.MessagesManager(guild, `tickets/${data?.id}`, rest);
53
- this.createdAt = data?.createdAt ? new Date(data?.createdAt) : new Date();
54
- this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : new Date();
55
- this.guild = guild;
56
- this.rest = rest;
57
- this.manager = manager;
58
- this.messages.setAll(data?.messages);
59
- }
60
- async fetch() {
61
- const route = Routes_1.Routes.guilds.tickets.get(this.id, this.guild.id);
62
- const response = await this.rest.request({
63
- method: "DELETE",
64
- url: route,
65
- });
66
- const ticket = new GuildTicket(response, this.guild, this.manager, this.rest);
67
- this.manager.cache.set(response.id, ticket);
68
- return ticket;
69
- }
70
- async setChannelId(id) {
71
- Assertion_1.Assertion.assertString(id);
72
- const route = Routes_1.Routes.guilds.tickets.resource(this.guild.id, this.id, "channelId");
73
- const payload = { channelId: id };
74
- const response = await this.rest.request({
75
- method: "PATCH",
76
- url: route,
77
- payload,
78
- });
79
- this.channelId = response.channelId;
80
- this.manager.cache.set(this.id, this);
81
- return this;
82
- }
83
- async setAdminId(id) {
84
- Assertion_1.Assertion.assertString(id);
85
- const route = Routes_1.Routes.guilds.tickets.resource(this.guild.id, this.id, "adminId");
86
- const payload = { adminId: id };
87
- const response = await this.rest.request({
88
- method: "PATCH",
89
- url: route,
90
- payload,
91
- });
92
- this.adminId = response.adminId;
93
- this.manager.cache.set(this.id, this);
94
- return this;
95
- }
96
- async setClosedById(id) {
97
- Assertion_1.Assertion.assertString(id);
98
- const route = Routes_1.Routes.guilds.tickets.resource(this.guild.id, this.id, "closedById");
99
- const payload = { closedById: id };
100
- const response = await this.rest.request({
101
- method: "PATCH",
102
- url: route,
103
- payload,
104
- });
105
- this.closedById = response.closedById;
106
- this.manager.cache.set(this.id, this);
107
- return this;
108
- }
109
- async setCustomerRating(rating) {
110
- Assertion_1.Assertion.assertString(rating);
111
- const route = Routes_1.Routes.guilds.tickets.resource(this.guild.id, this.id, "customerRating");
112
- const payload = {
113
- customerRating: rating,
114
- };
115
- const response = await this.rest.request({
116
- method: "PATCH",
117
- url: route,
118
- payload,
119
- });
120
- this.customerRating = response.customerRating;
121
- this.manager.cache.set(this.id, this);
122
- return this;
123
- }
124
- async setType(type) {
125
- Assertion_1.Assertion.assertString(type);
126
- const route = Routes_1.Routes.guilds.tickets.resource(this.guild.id, this.id, "type");
127
- const payload = { type };
128
- const response = await this.rest.request({
129
- method: "PATCH",
130
- url: route,
131
- payload,
132
- });
133
- this.type = response.type;
134
- this.manager.cache.set(this.id, this);
135
- return this;
136
- }
137
- async setStatus(status) {
138
- Assertion_1.Assertion.assertString(status);
139
- const route = Routes_1.Routes.guilds.tickets.resource(this.guild.id, this.id, "status");
140
- const payload = { status };
141
- const response = await this.rest.request({
142
- method: "PATCH",
143
- url: route,
144
- payload,
145
- });
146
- this.status = response.status;
147
- this.manager.cache.set(this.id, this);
148
- return this;
149
- }
150
- async delete() {
151
- const route = Routes_1.Routes.guilds.tickets.delete(this.id, this.guild.id);
152
- const response = await this.rest.request({
153
- method: "DELETE",
154
- url: route,
155
- });
156
- this.manager.cache.delete(this.id);
157
- return response;
158
- }
159
- toJSON() {
160
- const json = {};
161
- for (const [key, value] of Object.entries(this)) {
162
- if (typeof value !== "function") {
163
- json[key] = value;
164
- }
165
- }
166
- return json;
167
- }
168
- toString() {
169
- return this.id || "1";
170
- }
171
- }
172
- exports.GuildTicket = GuildTicket;
@@ -1,26 +0,0 @@
1
- import { APIMessage } from "./APIMessage";
2
- export interface APIGuildTicket {
3
- /** Ticket's id */
4
- id: string;
5
- _id: string;
6
- /** Ticket's creator id */
7
- creatorId: string;
8
- /** Ticket's admin id */
9
- adminId: string;
10
- /** Ticket's rating that customer gave */
11
- customerRating: number;
12
- /** Ticket's channel id */
13
- channelId: string;
14
- /** Ticket's closed by who */
15
- closedById: string;
16
- /** Ticket's type */
17
- type: string;
18
- /** Ticket's status */
19
- status: "on" | "off";
20
- /** Ticket's messages */
21
- messages: APIMessage[];
22
- /** Creation Date */
23
- createdAt: Date;
24
- /** Updated Date */
25
- updatedAt: Date;
26
- }
@@ -1,12 +0,0 @@
1
- export interface APIMessage {
2
- /** Message's content */
3
- content: string | object;
4
- /** Message's creator id */
5
- userId: string;
6
- /** Message's type */
7
- type: "text" | "img" | ".png" | ".gif" | ".jpg";
8
- /** Creation Date */
9
- createdAt: Date;
10
- /** Updated Date */
11
- updatedAt: Date;
12
- }
@@ -1,21 +0,0 @@
1
- export * from "./api/APIBaseChannel";
2
- export * from "./api/APIBetChannel";
3
- export * from "./api/APIBetMessage";
4
- export * from "./api/APIGuild";
5
- export * from "./api/APIGuildBet";
6
- export * from "./api/APIGuildBetUser";
7
- export * from "./api/APIGuildChannel";
8
- export * from "./api/APIGuildEmoji";
9
- export * from "./api/APIGuildGroupedChannel";
10
- export * from "./api/APIGuildMatch";
11
- export * from "./api/APIGuildMediator";
12
- export * from "./api/APIGuildMessage";
13
- export * from "./api/APIGuildPermissions";
14
- export * from "./api/APIGuildRole";
15
- export * from "./api/APIGuildShop";
16
- export * from "./api/APIGuildTicket";
17
- export * from "./api/APIGuildUser";
18
- export * from "./api/APIMessage";
19
- export * from "./api/APIPlayer";
20
- export * from "./api/APIProduct";
21
- export * from "./api/index";
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes