@duque.edits/sdk 0.2.22 → 1.0.1

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.
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GuildBetUserManager = void 0;
4
+ const Routes_1 = require("../../rest/Routes");
5
+ const GuildBetUser_1 = require("../../structures/betuser/GuildBetUser");
6
+ const Collection_1 = require("../../structures/Collection");
7
+ const base_1 = require("../base");
8
+ class GuildBetUserManager extends base_1.BaseManager {
9
+ constructor(guild) {
10
+ super(guild);
11
+ this.guild = guild;
12
+ this.rest = guild.rest;
13
+ this.base_url = Routes_1.Routes.guilds.betusers.getAll(guild.id);
14
+ this.cache = new Collection_1.Collection("betusers");
15
+ }
16
+ async fetch(options) {
17
+ if (options && options.cache)
18
+ return this.cache;
19
+ if (options && options.userId) {
20
+ const route = Routes_1.Routes.fields(this.base_url, options.userId);
21
+ const response = await this.rest.request({
22
+ method: "GET",
23
+ url: route,
24
+ });
25
+ const user = new GuildBetUser_1.GuildBetUser(response, this);
26
+ this.set(user);
27
+ return user;
28
+ }
29
+ const route = this.base_url;
30
+ const response = await this.rest.request({
31
+ method: "GET",
32
+ url: route,
33
+ });
34
+ this.set(response);
35
+ return this.cache;
36
+ }
37
+ async updateMany(...betusers) {
38
+ const route = this.base_url;
39
+ const response = await this.rest.request({
40
+ method: "PATCH",
41
+ url: route,
42
+ payload: { betusers },
43
+ });
44
+ for (const userData of response) {
45
+ const user = new GuildBetUser_1.GuildBetUser(userData, this);
46
+ this.set(user);
47
+ }
48
+ return this.cache;
49
+ }
50
+ async deleteAll() {
51
+ const route = this.base_url;
52
+ await this.rest.request({
53
+ method: "DELETE",
54
+ url: route,
55
+ });
56
+ this.cache.clear();
57
+ }
58
+ async resetAll() {
59
+ const route = this.base_url;
60
+ const response = await this.rest.request({
61
+ method: "put",
62
+ url: route,
63
+ });
64
+ this.cache.clear();
65
+ this.set(response);
66
+ return this.cache;
67
+ }
68
+ set(data) {
69
+ if (!data)
70
+ return this.cache;
71
+ if (Array.isArray(data)) {
72
+ for (let _user of data) {
73
+ if (!_user.id)
74
+ return;
75
+ const user = new GuildBetUser_1.GuildBetUser(_user, this);
76
+ this.cache.set(user.id, user);
77
+ this.rest.betusers.set(user.id, user);
78
+ }
79
+ return this.cache;
80
+ }
81
+ else {
82
+ if (!data.id)
83
+ return;
84
+ const user = new GuildBetUser_1.GuildBetUser(data, this);
85
+ this.cache.set(user.id, user);
86
+ this.rest.betusers.set(user.id, user);
87
+ return user;
88
+ }
89
+ }
90
+ }
91
+ exports.GuildBetUserManager = GuildBetUserManager;
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./betuser/GuildBetUserManager"), exports);
17
18
  __exportStar(require("./buffer/BufferManager"), exports);
18
19
  __exportStar(require("./guild/GuildManager"), exports);
19
20
  __exportStar(require("./logs/LogManager"), exports);
@@ -10,13 +10,15 @@ class GuildPermissionManager extends base_1.BaseManager {
10
10
  this.rest = guild.rest;
11
11
  this.base_url = Routes_1.Routes.guilds.resource(guild.id, "permissions");
12
12
  }
13
- async addRole(type, roleId) {
14
- const perm = this.guild.permissions.find((p) => p.type === type) || { ids: [roleId], type };
15
- // if (perm.ids.includes(roleId)) return this.guild;
16
- perm.ids.push(roleId);
17
- const perms = { ...this.guild.permissions };
13
+ async addRole(type, ...ids) {
14
+ const perm = this.guild.permissions.find((p) => p.type === type) || { ids: [], type };
15
+ const _ids = [...new Set([...perm.ids, ...ids])];
16
+ const perms = [...this.guild.permissions];
18
17
  let permsIndex = this.guild.permissions.findIndex((p) => p.type === type);
19
- perms[permsIndex] = perm;
18
+ if (permsIndex === -1)
19
+ perms.push({ type, ids: _ids });
20
+ else
21
+ perms[permsIndex] = { type, ids: _ids };
20
22
  const payload = { set: perms };
21
23
  const response = await this.rest.request({
22
24
  method: "PATCH",
@@ -27,14 +29,19 @@ class GuildPermissionManager extends base_1.BaseManager {
27
29
  this.rest.guilds.cache.set(this.guild.id, this.guild);
28
30
  return response;
29
31
  }
30
- async removeRole(type, roleId) {
32
+ async removeRole(type, ...ids) {
31
33
  const perm = this.guild.permissions.find((p) => p.type === type) || { ids: [], type };
32
- if (!perm.ids.includes(roleId))
33
- return this.guild;
34
- perm.ids = perm.ids.filter((i) => i !== roleId);
35
- let perms = { ...this.guild.permissions };
34
+ // Remove matching ids
35
+ const _ids = [...new Set([...perm.ids.filter((i) => !ids.includes(i))])];
36
+ const perms = [...this.guild.permissions];
36
37
  let permsIndex = this.guild.permissions.findIndex((p) => p.type === type);
37
- perms[permsIndex] = perm;
38
+ if (permsIndex === -1) {
39
+ // no existing permission, just push empty version
40
+ perms.push({ type, ids: _ids });
41
+ }
42
+ else {
43
+ perms[permsIndex] = { type, ids: _ids };
44
+ }
38
45
  const payload = { set: perms };
39
46
  const response = await this.rest.request({
40
47
  method: "PATCH",
@@ -13,6 +13,43 @@ class GuildTicketManager {
13
13
  this.rest = guild.rest;
14
14
  this.cache = new Collection_1.Collection("tickets");
15
15
  }
16
+ async createTicketCategory(data) {
17
+ const categories = this.guild.tickets_configuration.categories;
18
+ let hasCategory = categories.find((c) => c.type === data?.type);
19
+ if (hasCategory) {
20
+ hasCategory = data;
21
+ const index = categories.findIndex((c) => c.type === data?.type);
22
+ categories[index] = hasCategory;
23
+ }
24
+ else {
25
+ categories.push(data);
26
+ }
27
+ const payload = { tickets_configuration: { categories } };
28
+ const route = rest_1.Routes.guilds.get(this.guild.id);
29
+ const response = await this.rest.request({
30
+ method: "PATCH",
31
+ url: route,
32
+ payload,
33
+ });
34
+ this.guild._updateInternals(response);
35
+ return response;
36
+ }
37
+ async deleteTicketCategory(data) {
38
+ let categories = this.guild.tickets_configuration.categories;
39
+ let categoryIndex = categories.findIndex((c) => c.type === data?.type);
40
+ if (categoryIndex === -1)
41
+ return this.guild;
42
+ categories = categories.filter((c) => c.type !== data.type);
43
+ const payload = { tickets_configuration: { categories } };
44
+ const route = rest_1.Routes.guilds.get(this.guild.id);
45
+ const response = await this.rest.request({
46
+ method: "PATCH",
47
+ url: route,
48
+ payload,
49
+ });
50
+ this.guild._updateInternals(response);
51
+ return response;
52
+ }
16
53
  async fetch(options) {
17
54
  if (options && options.cache)
18
55
  return this.cache;
package/dist/rest/REST.js CHANGED
@@ -31,6 +31,7 @@ class REST extends events_1.default {
31
31
  guilds;
32
32
  minesGames;
33
33
  users;
34
+ betusers;
34
35
  matches;
35
36
  /**
36
37
  *
@@ -23,7 +23,7 @@ exports.Routes = {
23
23
  deleteAll: (guildId) => `/guilds/${guildId}/users`,
24
24
  resource: (guildId, userId, ...resource) => `/guilds/${guildId}/users/${userId}/${resource.join("/")}`,
25
25
  },
26
- betUsers: {
26
+ betusers: {
27
27
  getAll: (guildId) => `/guilds/${guildId}/betusers`,
28
28
  get: (guildId, userId) => `/guilds/${guildId}/betusers/${userId}`,
29
29
  create: (guildId) => `/guilds/${guildId}/betusers`,
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GuildBetUser = void 0;
4
+ const Routes_1 = require("../../rest/Routes");
5
+ class GuildBetUser {
6
+ /** User daily */
7
+ daily;
8
+ profile;
9
+ /** User's name */
10
+ id;
11
+ guild_id;
12
+ /** User's credit */
13
+ credit;
14
+ /** User's wins */
15
+ wins;
16
+ /** User's mvps */
17
+ mvps;
18
+ /** User's losses */
19
+ losses;
20
+ /** User's games */
21
+ games;
22
+ /** User's blacklist */
23
+ blacklist;
24
+ /** User's coins */
25
+ coins;
26
+ /** Creation Date */
27
+ createdAt;
28
+ /** Updated Date */
29
+ updatedAt;
30
+ /** The given manager */
31
+ manager;
32
+ /** The rest client */
33
+ rest;
34
+ /**
35
+ * Bet user
36
+ * @param data The user's data
37
+ * @param manager The manager
38
+ * @param rest The rest client
39
+ */
40
+ constructor(data, manager) {
41
+ this.id = data?.id;
42
+ this.guild_id = data?.guild_id;
43
+ this.manager = manager;
44
+ this.rest = manager.rest;
45
+ this.wins = data?.wins;
46
+ this.losses = data?.losses;
47
+ this.mvps = data?.mvps;
48
+ this.daily = data?.daily;
49
+ this.games = data?.games;
50
+ this.blacklist = data?.blacklist;
51
+ this.profile = data?.profile;
52
+ this.createdAt = data?.createdAt ? new Date(data?.createdAt) : new Date();
53
+ this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : new Date();
54
+ }
55
+ /** String representation of this user */
56
+ toString() {
57
+ return `<@${this.id}>`;
58
+ }
59
+ /**
60
+ * Fetches the user
61
+ * @returns New Instance of the user
62
+ */
63
+ async fetch() {
64
+ const route = Routes_1.Routes.guilds.betusers.get(this.manager.guild.id, this.id);
65
+ const response = await this.rest.request({
66
+ method: "get",
67
+ url: route,
68
+ });
69
+ const user = new GuildBetUser(response, this.manager);
70
+ this.manager.cache.set(user.id, user);
71
+ this.rest.betusers.set(user.id, user);
72
+ return user;
73
+ }
74
+ /**
75
+ * Set the user blacklist
76
+ * @param value Value to set to
77
+ * @returns GuildBetUser
78
+ */
79
+ async setBlacklist(value) {
80
+ const route = Routes_1.Routes.guilds.betusers.resource(this.manager.guild.id, this.id, "blacklist");
81
+ const payload = { set: value };
82
+ await this.rest.request({
83
+ method: "patch",
84
+ url: route,
85
+ payload,
86
+ });
87
+ this.blacklist = value;
88
+ this.manager.cache.set(this.id, this);
89
+ this.rest.betusers.set(this.id, this);
90
+ return this;
91
+ }
92
+ async reset() {
93
+ const route = Routes_1.Routes.guilds.betusers.get(this.manager.guild.id, this.id);
94
+ const payload = { reset: true };
95
+ const response = await this.rest.request({
96
+ method: "DELETE",
97
+ url: route,
98
+ payload,
99
+ });
100
+ this._updateInternals(response);
101
+ return this;
102
+ }
103
+ async updateProfile(data) {
104
+ const _data = {
105
+ profile: {
106
+ avatarUrl: data.avatarUrl || this.profile.avatarUrl || "",
107
+ bannerUrl: data.bannerUrl || this.profile.bannerUrl || "",
108
+ bio: data.bio || this.profile.bio || "Melhor da minha aldeia (use !bio para alterar)",
109
+ name: data.name || this.profile.name || "",
110
+ textColor: data.textColor || this.profile.textColor || "#ffffff",
111
+ primaryColor: data.primaryColor || this.profile.primaryColor || "#272727",
112
+ secondaryColor: data.secondaryColor || this.profile.secondaryColor || "#151515",
113
+ },
114
+ };
115
+ const route = Routes_1.Routes.guilds.betusers.update(this.manager.guild.id, this.id);
116
+ const response = await this.rest.request({
117
+ method: "patch",
118
+ url: route,
119
+ payload: _data,
120
+ });
121
+ this._updateInternals(response);
122
+ return this;
123
+ }
124
+ _updateInternals(data) {
125
+ for (let key in data) {
126
+ if (key === "id" || key === "createdAt")
127
+ continue;
128
+ if (key in this) {
129
+ this[key] = data[key];
130
+ }
131
+ }
132
+ this.updatedAt = new Date();
133
+ this.createdAt = new Date(data.createdAt);
134
+ this.manager.set(this);
135
+ this.rest.emit("betuserUpdate", this);
136
+ return this;
137
+ }
138
+ /**
139
+ * Update certain property
140
+ * @param data The new data to update with
141
+ * @returns
142
+ */
143
+ async update(data) {
144
+ if (!data?.type)
145
+ data.type = "add";
146
+ const route = Routes_1.Routes.guilds.betusers.get(this.manager.guild.id, this.id);
147
+ let payload = {};
148
+ const numericFields = ["wins", "credit", "losses", "mvps", "games"];
149
+ const arrayFields = ["items", "original_channels", "adverts", "accessories"];
150
+ if (data?.type === "add" || data?.type === "remove") {
151
+ for (const key in data) {
152
+ if (key === "type")
153
+ continue;
154
+ const value = data[key];
155
+ if (numericFields.includes(key)) {
156
+ const current = (this[key] || 0);
157
+ const num = (value || 0);
158
+ payload[key] = Math.max(0, data?.type === "add" ? current + num : current - num);
159
+ }
160
+ else if (key === "blacklist") {
161
+ payload["blacklist"] = value;
162
+ }
163
+ else if (key === "profile") {
164
+ payload["profile"] = value;
165
+ }
166
+ else if (arrayFields.includes(key)) {
167
+ const current = this[key];
168
+ const incoming = value;
169
+ payload[key] =
170
+ data?.type === "add"
171
+ ? [...new Set([...current, ...incoming])]
172
+ : current.filter((x) => !incoming.includes(x));
173
+ }
174
+ }
175
+ }
176
+ const response = await this.rest.request({
177
+ method: "patch",
178
+ url: route,
179
+ payload,
180
+ });
181
+ this._updateInternals(response);
182
+ return this;
183
+ }
184
+ async delete() {
185
+ const route = Routes_1.Routes.guilds.betusers.delete(this.manager.guild.id, this.id);
186
+ const response = await this.rest.request({
187
+ method: "DELETE",
188
+ url: route,
189
+ });
190
+ this.rest.emit("betuserDelete", this);
191
+ this.manager.cache.delete(this.id);
192
+ return response;
193
+ }
194
+ toJSON() {
195
+ let json = {};
196
+ for (const [key, value] of Object.entries(this)) {
197
+ const exclude = ["rest", "guilds", "manager"];
198
+ if (exclude.includes(key))
199
+ continue;
200
+ if (typeof value !== "function") {
201
+ json[key] = value;
202
+ }
203
+ }
204
+ return json;
205
+ }
206
+ }
207
+ exports.GuildBetUser = GuildBetUser;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Guild = void 0;
4
4
  const managers_1 = require("../../managers");
5
+ const GuildBetUserManager_1 = require("../../managers/betuser/GuildBetUserManager");
5
6
  const Routes_1 = require("../../rest/Routes");
6
7
  const Assertion_1 = require("../../utils/Assertion");
7
8
  class Guild {
@@ -43,6 +44,7 @@ class Guild {
43
44
  users;
44
45
  logEntries;
45
46
  shop;
47
+ betusers;
46
48
  adverts;
47
49
  codes;
48
50
  /**
@@ -75,6 +77,7 @@ class Guild {
75
77
  this.tickets = new managers_1.GuildTicketManager(this);
76
78
  this.vipMembers = new managers_1.VipMemberManager(this);
77
79
  this.logEntries = new managers_1.LogManager(this);
80
+ this.betusers = new GuildBetUserManager_1.GuildBetUserManager(this);
78
81
  this.adverts = [];
79
82
  for (let _adv of data?.adverts || []) {
80
83
  this.adverts.push({
@@ -116,6 +119,22 @@ class Guild {
116
119
  return response.channels.find((t) => t.type === type);
117
120
  }
118
121
  }
122
+ async getPermission(type) {
123
+ const permission = this.permissions.find((c) => c.type === type);
124
+ if (permission)
125
+ return permission;
126
+ else {
127
+ const permissions = [...this.permissions, { type, ids: [] }];
128
+ const route = Routes_1.Routes.guilds.get(this.id);
129
+ const response = await this.rest.request({
130
+ method: "PATCH",
131
+ url: route,
132
+ payload: { permissions },
133
+ });
134
+ this._updateInternals(response);
135
+ return response.permissions.find((t) => t.type === type);
136
+ }
137
+ }
119
138
  async createAdvert(data) {
120
139
  this.adverts.push(data);
121
140
  const route = Routes_1.Routes.guilds.get(this.id);
@@ -220,6 +239,7 @@ class Guild {
220
239
  this.tickets.fetch(),
221
240
  this.vipMembers.fetch(),
222
241
  this.logEntries.fetch(),
242
+ // this.betusers.fetch(),
223
243
  ]);
224
244
  return this;
225
245
  }
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./betuser/GuildBetUser"), exports);
17
18
  __exportStar(require("./guild/Guild"), exports);
18
19
  __exportStar(require("./logentry/LogEntry"), exports);
19
20
  __exportStar(require("./match/GuildMatch"), exports);
@@ -27,7 +27,6 @@ class GuildUser {
27
27
  profile;
28
28
  creations;
29
29
  /** User's items */
30
- items;
31
30
  adverts;
32
31
  /** Creation Date */
33
32
  createdAt;
@@ -58,7 +57,6 @@ class GuildUser {
58
57
  this.blacklist = data?.blacklist;
59
58
  this.accessories = data?.accessories;
60
59
  this.original_channels = data?.original_channels;
61
- this.items = data?.items;
62
60
  this.profile = data?.profile;
63
61
  this.createdAt = data?.createdAt ? new Date(data?.createdAt) : new Date();
64
62
  this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : new Date();
@@ -96,25 +94,6 @@ class GuildUser {
96
94
  this.rest.users.set(user.id, user);
97
95
  return user;
98
96
  }
99
- /**
100
- * Add a propery
101
- * @param key The desired key
102
- * @param value The desired value
103
- * @returns GuildUser
104
- */
105
- async add(key, value) {
106
- const route = Routes_1.Routes.guilds.users.resource(this.manager.guild.id, this.id, key);
107
- const payload = { set: value };
108
- const resp = await this.rest.request({
109
- method: "patch",
110
- url: route,
111
- payload,
112
- });
113
- this[key] = resp[key];
114
- this.manager.cache.set(this.id, this);
115
- this.rest.users.set(this.id, this);
116
- return this;
117
- }
118
97
  /**
119
98
  * Set the user blacklist
120
99
  * @param value Value to set to
@@ -15,4 +15,5 @@ var GuildChannelsType;
15
15
  GuildChannelsType["ChallengeQueue"] = "challenge_queue";
16
16
  GuildChannelsType["MatchTextChannelParent"] = "match_text_channel_parent";
17
17
  GuildChannelsType["VoiceChannelMatchCreation"] = "voice_channel_match_creation";
18
+ GuildChannelsType["WaitingVC"] = "waiting_vc";
18
19
  })(GuildChannelsType || (exports.GuildChannelsType = GuildChannelsType = {}));
@@ -4,4 +4,7 @@ exports.GuildPermissionsTypes = void 0;
4
4
  var GuildPermissionsTypes;
5
5
  (function (GuildPermissionsTypes) {
6
6
  GuildPermissionsTypes["ManageBot"] = "manage_bot";
7
+ GuildPermissionsTypes["ManageQueues"] = "manage_queues";
8
+ GuildPermissionsTypes["ManageUsers"] = "manage_users";
9
+ GuildPermissionsTypes["ViewQueueChannels"] = "view_queue_channels";
7
10
  })(GuildPermissionsTypes || (exports.GuildPermissionsTypes = GuildPermissionsTypes = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duque.edits/sdk",
3
- "version": "0.2.22",
3
+ "version": "1.0.1",
4
4
  "main": "dist/index",
5
5
  "types": "./types/index.d.ts",
6
6
  "typings": "./types/index.d.ts",
@@ -0,0 +1,18 @@
1
+ import { GuildBetUser } from "../../structures/betuser/GuildBetUser";
2
+ import { Collection } from "../../structures/Collection";
3
+ import { Guild } from "../../structures/guild/Guild";
4
+ import { Optional, APIGuildBetUser } from "../../types";
5
+ import { BaseManager } from "../base";
6
+ type FetchOptions = {
7
+ userId?: string;
8
+ cache?: boolean;
9
+ };
10
+ export declare class GuildBetUserManager extends BaseManager<GuildBetUser> {
11
+ constructor(guild: Guild);
12
+ fetch(options?: FetchOptions): Promise<Collection<string, GuildBetUser> | GuildBetUser>;
13
+ updateMany(...betusers: Optional<APIGuildBetUser>[]): Promise<Collection<string, GuildBetUser>>;
14
+ deleteAll(): Promise<void>;
15
+ resetAll(): Promise<Collection<string, GuildBetUser>>;
16
+ set(data: APIGuildBetUser | APIGuildBetUser[]): GuildBetUser | Collection<string, GuildBetUser>;
17
+ }
18
+ export {};
@@ -1,3 +1,4 @@
1
+ export * from "./betuser/GuildBetUserManager";
1
2
  export * from "./buffer/BufferManager";
2
3
  export * from "./guild/GuildManager";
3
4
  export * from "./logs/LogManager";
@@ -3,6 +3,6 @@ import { APIGuild, APIGuildPermissions, GuildPermissionsTypes } from "../../type
3
3
  import { BaseManager } from "../base";
4
4
  export declare class GuildPermissionManager extends BaseManager<APIGuildPermissions> {
5
5
  constructor(guild: Guild);
6
- addRole(type: GuildPermissionsTypes, roleId: string): Promise<APIGuild>;
7
- removeRole(type: GuildPermissionsTypes, roleId: string): Promise<APIGuild | Guild>;
6
+ addRole(type: GuildPermissionsTypes, ...ids: string[]): Promise<APIGuild>;
7
+ removeRole(type: GuildPermissionsTypes, ...ids: string[]): Promise<APIGuild>;
8
8
  }
@@ -1,7 +1,7 @@
1
1
  import { REST } from "../../rest";
2
2
  import { Guild, GuildTicket } from "../../structures";
3
3
  import { Collection } from "../../structures/Collection";
4
- import { APIGuildTicket, Optional } from "../../types";
4
+ import { APIGuild, APIGuildTicket, APITicketCategory, Optional } from "../../types";
5
5
  type FecthOptions = {
6
6
  ticketId?: string;
7
7
  cache?: boolean;
@@ -14,6 +14,8 @@ export declare class GuildTicketManager {
14
14
  readonly guild: Guild;
15
15
  readonly rest: REST;
16
16
  constructor(guild: Guild);
17
+ createTicketCategory(data: Optional<APITicketCategory>): Promise<APIGuild>;
18
+ deleteTicketCategory(data: Optional<APITicketCategory>): Promise<APIGuild | Guild>;
17
19
  fetch(options?: FecthOptions): Promise<GuildTicket | Collection<string, GuildTicket>>;
18
20
  create(data: Optional<APIGuildTicket>): Promise<GuildTicket>;
19
21
  delete(options?: DeleteOptions): Promise<boolean>;
@@ -6,6 +6,7 @@ import { GuildUser } from "../structures/user/GuildUser";
6
6
  import { RestEvents, RequestOptions } from "../types/RestTypes";
7
7
  import { MinesGameManager } from "../managers";
8
8
  import { StatusResponse } from "../types";
9
+ import { GuildBetUser } from "../structures/betuser/GuildBetUser";
9
10
  interface ClientOptions {
10
11
  clientKey: string;
11
12
  authKey: string;
@@ -23,6 +24,7 @@ export declare class REST extends EventEmitter {
23
24
  guilds: GuildManager;
24
25
  minesGames: MinesGameManager;
25
26
  users: Collection<string, GuildUser>;
27
+ betusers: Collection<string, GuildBetUser>;
26
28
  matches: Collection<string, GuildMatch>;
27
29
  /**
28
30
  *
@@ -20,7 +20,7 @@ export declare const Routes: {
20
20
  deleteAll: (guildId: string) => string;
21
21
  resource: (guildId: string, userId: string, ...resource: string[]) => string;
22
22
  };
23
- betUsers: {
23
+ betusers: {
24
24
  getAll: (guildId: string) => string;
25
25
  get: (guildId: string, userId: string) => string;
26
26
  create: (guildId: string) => string;
@@ -0,0 +1,67 @@
1
+ import { REST } from "../../rest/REST";
2
+ import { Daily, Optional, Profile } from "../../types/api";
3
+ import { APIGuildBetUser } from "../../types/api/APIGuildBetUser";
4
+ import { GuildBetUserManager } from "../../managers/betuser/GuildBetUserManager";
5
+ export declare class GuildBetUser implements APIGuildBetUser {
6
+ /** User daily */
7
+ daily: Omit<Daily, "points">;
8
+ profile: Profile;
9
+ /** User's name */
10
+ id: string;
11
+ guild_id: string;
12
+ /** User's credit */
13
+ credit: number;
14
+ /** User's wins */
15
+ wins: number;
16
+ /** User's mvps */
17
+ mvps: number;
18
+ /** User's losses */
19
+ losses: number;
20
+ /** User's games */
21
+ games: number;
22
+ /** User's blacklist */
23
+ blacklist: boolean;
24
+ /** User's coins */
25
+ coins: number;
26
+ /** Creation Date */
27
+ createdAt: Date;
28
+ /** Updated Date */
29
+ updatedAt: Date;
30
+ /** The given manager */
31
+ readonly manager: GuildBetUserManager;
32
+ /** The rest client */
33
+ readonly rest: REST;
34
+ /**
35
+ * Bet user
36
+ * @param data The user's data
37
+ * @param manager The manager
38
+ * @param rest The rest client
39
+ */
40
+ constructor(data: APIGuildBetUser, manager: GuildBetUserManager);
41
+ /** String representation of this user */
42
+ toString(): string;
43
+ /**
44
+ * Fetches the user
45
+ * @returns New Instance of the user
46
+ */
47
+ fetch(): Promise<GuildBetUser>;
48
+ /**
49
+ * Set the user blacklist
50
+ * @param value Value to set to
51
+ * @returns GuildBetUser
52
+ */
53
+ setBlacklist(value: boolean): Promise<this>;
54
+ reset(): Promise<this>;
55
+ updateProfile(data: Optional<Profile>): Promise<this>;
56
+ _updateInternals(data: Optional<APIGuildBetUser>): this;
57
+ /**
58
+ * Update certain property
59
+ * @param data The new data to update with
60
+ * @returns
61
+ */
62
+ update(data: Omit<Optional<APIGuildBetUser>, "daily"> & {
63
+ type?: "add" | "remove";
64
+ }): Promise<this>;
65
+ delete(): Promise<boolean>;
66
+ toJSON(): Optional<APIGuildBetUser>;
67
+ }
@@ -1,6 +1,7 @@
1
1
  import { BufferManager, GuildMatchManager, GuildPermissionManager, GuildTicketManager, GuildUserManager, LogManager, VipMemberManager } from "../../managers";
2
+ import { GuildBetUserManager } from "../../managers/betuser/GuildBetUserManager";
2
3
  import { REST } from "../../rest/REST";
3
- import { APICode, APIGuildAdvert, APIGuildGroupedChannel, APIGuildPermissions, APIGuildShop, Daily, Optional } from "../../types/api";
4
+ import { APICode, APIGuildAdvert, APIGuildGroupedChannel, APIGuildPermissions, APIGuildShop, Daily, GuildPermissionsTypes, Optional, Permission } from "../../types/api";
4
5
  import { APIGuild, DailyCategories, GuildChannelsType, GuildModes, GuildPrices, GuildScores, GuildStatus, GuildTicketConfiguration } from "../../types/api/APIGuild";
5
6
  export declare class Guild {
6
7
  /** The data of this guild */
@@ -41,6 +42,7 @@ export declare class Guild {
41
42
  users: GuildUserManager;
42
43
  logEntries: LogManager;
43
44
  shop: APIGuildShop;
45
+ betusers: GuildBetUserManager;
44
46
  adverts: APIGuildAdvert[];
45
47
  codes: APICode[];
46
48
  /**
@@ -50,6 +52,7 @@ export declare class Guild {
50
52
  */
51
53
  constructor(data: APIGuild, rest: REST);
52
54
  getChannel(type: GuildChannelsType): Promise<APIGuildGroupedChannel>;
55
+ getPermission(type: GuildPermissionsTypes): Promise<Permission>;
53
56
  createAdvert(data: Optional<APIGuildAdvert>): Promise<this>;
54
57
  removeAdvert(advertId: string): Promise<this>;
55
58
  createCode(data: Optional<APICode>): Promise<this>;
@@ -1,3 +1,4 @@
1
+ export * from "./betuser/GuildBetUser";
1
2
  export * from "./guild/Guild";
2
3
  export * from "./logentry/LogEntry";
3
4
  export * from "./match/GuildMatch";
@@ -1,5 +1,5 @@
1
1
  import { REST } from "../../rest/REST";
2
- import { Accessory, APIAdvert, Daily, Items, Optional, OriginalChannels } from "../../types/api";
2
+ import { Accessory, APIAdvert, Daily, Optional, OriginalChannels } from "../../types/api";
3
3
  import { APIGuildUser, Profile } from "../../types/api/APIGuildUser";
4
4
  import { GuildUserManager } from "../../managers/user/GuildUserManager";
5
5
  export declare class GuildUser implements APIGuildUser {
@@ -27,7 +27,6 @@ export declare class GuildUser implements APIGuildUser {
27
27
  profile: Profile;
28
28
  creations: number;
29
29
  /** User's items */
30
- items: Items;
31
30
  adverts: APIAdvert[];
32
31
  /** Creation Date */
33
32
  createdAt: Date;
@@ -51,13 +50,6 @@ export declare class GuildUser implements APIGuildUser {
51
50
  * @returns New Instance of the user
52
51
  */
53
52
  fetch(): Promise<GuildUser>;
54
- /**
55
- * Add a propery
56
- * @param key The desired key
57
- * @param value The desired value
58
- * @returns GuildUser
59
- */
60
- add<K extends keyof UserAddOptions, V extends UserAddOptions[K]>(key: K, value: V): Promise<this>;
61
53
  /**
62
54
  * Set the user blacklist
63
55
  * @param value Value to set to
@@ -80,10 +72,3 @@ export declare class GuildUser implements APIGuildUser {
80
72
  delete(): Promise<boolean>;
81
73
  toJSON(): Optional<APIGuildUser>;
82
74
  }
83
- export interface UserAddOptions extends APIGuildUser {
84
- coins: number;
85
- points: number;
86
- wins: number;
87
- losses: number;
88
- mvps: number;
89
- }
@@ -1,4 +1,5 @@
1
1
  import { LogEntry } from "../structures";
2
+ import { GuildBetUser } from "../structures/betuser/GuildBetUser";
2
3
  import { Collection } from "../structures/Collection";
3
4
  import { Guild } from "../structures/guild/Guild";
4
5
  import { GuildMatch } from "../structures/match/GuildMatch";
@@ -32,5 +33,8 @@ export interface RestEvents {
32
33
  userDelete: [GuildUser];
33
34
  userUpdate: [GuildUser];
34
35
  usersDelete: [Collection<string, GuildUser>];
36
+ betuserDelete: [GuildBetUser];
37
+ betuserUpdate: [GuildBetUser];
38
+ betusersDelete: [Collection<string, GuildBetUser>];
35
39
  logEntryCreate: [LogEntry, Guild];
36
40
  }
@@ -6,6 +6,8 @@ import { APIGuildShop } from "./APIGuildShop";
6
6
  export interface GuildTicketConfiguration {
7
7
  /** Guild's categories */
8
8
  categories: APITicketCategory[];
9
+ creationCategory: string;
10
+ rating_channel_id: string;
9
11
  }
10
12
  export interface GuildStatus {
11
13
  /** Matches status */
@@ -90,5 +92,6 @@ export declare enum GuildChannelsType {
90
92
  NormalQueue = "normal_queue",
91
93
  ChallengeQueue = "challenge_queue",
92
94
  MatchTextChannelParent = "match_text_channel_parent",
93
- VoiceChannelMatchCreation = "voice_channel_match_creation"
95
+ VoiceChannelMatchCreation = "voice_channel_match_creation",
96
+ WaitingVC = "waiting_vc"
94
97
  }
@@ -1,12 +1,12 @@
1
- import { Daily, Items, ProfileCard } from ".";
1
+ import { Daily, Profile } from ".";
2
2
  /** Bet user */
3
3
  export interface APIGuildBetUser {
4
4
  /** User daily */
5
5
  daily: Omit<Daily, "points">;
6
- /** User's name */
7
- name: string;
6
+ profile: Profile;
8
7
  /** User's name */
9
8
  id: string;
9
+ guild_id: string;
10
10
  /** User's credit */
11
11
  credit: number;
12
12
  /** User's wins */
@@ -17,16 +17,10 @@ export interface APIGuildBetUser {
17
17
  losses: number;
18
18
  /** User's games */
19
19
  games: number;
20
- /** User's bets played */
21
- betsPlayed: string[];
22
20
  /** User's blacklist */
23
21
  blacklist: boolean;
24
22
  /** User's coins */
25
23
  coins: number;
26
- /** User's items */
27
- items: Items;
28
- /** User's profile card */
29
- profileCard: ProfileCard;
30
24
  /** Creation Date */
31
25
  createdAt: Date;
32
26
  /** Updated Date */
@@ -4,5 +4,8 @@ export interface Permission {
4
4
  }
5
5
  export type APIGuildPermissions = Permission[];
6
6
  export declare enum GuildPermissionsTypes {
7
- ManageBot = "manage_bot"
7
+ ManageBot = "manage_bot",
8
+ ManageQueues = "manage_queues",
9
+ ManageUsers = "manage_users",
10
+ ViewQueueChannels = "view_queue_channels"
8
11
  }
@@ -1,4 +1,4 @@
1
- import { Accessory, APIAdvert, Daily, Items, OriginalChannels } from ".";
1
+ import { Accessory, APIAdvert, Daily, OriginalChannels } from ".";
2
2
  export interface Profile {
3
3
  bannerUrl?: string;
4
4
  avatarUrl?: string;
@@ -33,8 +33,6 @@ export interface APIGuildUser {
33
33
  accessories: Accessory[];
34
34
  /** User's original channels */
35
35
  original_channels: OriginalChannels;
36
- /** User's items */
37
- items: Items;
38
36
  /** Creation Date */
39
37
  createdAt: Date;
40
38
  /** Updated Date */
@@ -36,8 +36,6 @@ export type OriginalChannel = {
36
36
  /** Match id */
37
37
  matchId: string;
38
38
  };
39
- /** Items */
40
- export type Items = string[];
41
39
  /** Original Channels */
42
40
  export type OriginalChannels = OriginalChannel[];
43
41
  /** Accessories */