@duque.edits/sdk 1.0.2 → 1.0.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/managers/bet/GuildBetManager.js +5 -0
- package/dist/managers/match/GuildMatchManager.js +4 -0
- package/dist/managers/ticket/TicketManager.js +2 -1
- package/dist/rest/Routes.js +2 -2
- package/dist/structures/bet/GuildBet.js +11 -0
- package/dist/types/api/APIGuildBet.js +5 -0
- package/package.json +1 -1
- package/types/managers/bet/GuildBetManager.d.ts +1 -0
- package/types/structures/bet/GuildBet.d.ts +2 -1
- package/types/types/api/APIGuildBet.d.ts +11 -0
|
@@ -26,6 +26,11 @@ class GuildBetManager extends base_1.BaseManager {
|
|
|
26
26
|
const response = await this.rest.request({ url: route, method: "GET" });
|
|
27
27
|
return this.set(response);
|
|
28
28
|
}
|
|
29
|
+
async create(data) {
|
|
30
|
+
const route = rest_1.Routes.guilds.bets.create(this.guild.id);
|
|
31
|
+
const response = await this.rest.request({ url: route, method: "POST", payload: data });
|
|
32
|
+
return this.set(response);
|
|
33
|
+
}
|
|
29
34
|
async delete(betId) {
|
|
30
35
|
const route = rest_1.Routes.fields(this.base_url, betId);
|
|
31
36
|
const response = await this.rest.request({ url: route, method: "DELETE" });
|
|
@@ -69,12 +69,16 @@ class GuildMatchManager extends base_1.BaseManager {
|
|
|
69
69
|
return this.cache;
|
|
70
70
|
if (Array.isArray(data)) {
|
|
71
71
|
for (let _match of data) {
|
|
72
|
+
if (!_match._id)
|
|
73
|
+
continue;
|
|
72
74
|
const match = new GuildMatch_1.GuildMatch(_match, this);
|
|
73
75
|
this.cache.set(match._id, match);
|
|
74
76
|
}
|
|
75
77
|
return this.cache;
|
|
76
78
|
}
|
|
77
79
|
else {
|
|
80
|
+
if (!data._id)
|
|
81
|
+
return this.cache;
|
|
78
82
|
const match = new GuildMatch_1.GuildMatch(data, this);
|
|
79
83
|
this.cache.set(match._id, match);
|
|
80
84
|
return match;
|
|
@@ -76,6 +76,7 @@ class GuildTicketManager {
|
|
|
76
76
|
payload: data,
|
|
77
77
|
});
|
|
78
78
|
const ticket = this.set(response);
|
|
79
|
+
console.log({ response, ticket });
|
|
79
80
|
this.rest.emit("ticketCreate", ticket);
|
|
80
81
|
return ticket;
|
|
81
82
|
}
|
|
@@ -113,7 +114,7 @@ class GuildTicketManager {
|
|
|
113
114
|
return this.cache;
|
|
114
115
|
}
|
|
115
116
|
else {
|
|
116
|
-
if (data._id)
|
|
117
|
+
if (!data._id)
|
|
117
118
|
return;
|
|
118
119
|
const ticket = new structures_1.GuildTicket(data, this);
|
|
119
120
|
this.cache.set(ticket._id, ticket);
|
package/dist/rest/Routes.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Routes = void 0;
|
|
4
4
|
exports.Routes = {
|
|
5
|
-
|
|
6
|
-
base:
|
|
5
|
+
base: "http://localhost:80/api/v1",
|
|
6
|
+
//base: "https://duque-api.up.railway.app/api/v1",
|
|
7
7
|
field: (field) => `/${field}`,
|
|
8
8
|
fields: (...fields) => `${fields.join("/")}`,
|
|
9
9
|
guilds: {
|
|
@@ -36,6 +36,7 @@ class GuildBet {
|
|
|
36
36
|
updatedAt;
|
|
37
37
|
/** Bet's id */
|
|
38
38
|
_id;
|
|
39
|
+
queues;
|
|
39
40
|
rest;
|
|
40
41
|
guild;
|
|
41
42
|
manager;
|
|
@@ -60,6 +61,16 @@ class GuildBet {
|
|
|
60
61
|
this.confirmed = data?.confirmed;
|
|
61
62
|
this.createdAt = data?.createdAt ? new Date(data?.createdAt) : new Date();
|
|
62
63
|
this.updatedAt = data?.updatedAt ? new Date(data?.updatedAt) : new Date();
|
|
64
|
+
this.queues = [];
|
|
65
|
+
for (let queue of data.queues ?? []) {
|
|
66
|
+
this.queues.push({
|
|
67
|
+
_id: queue?._id,
|
|
68
|
+
type: queue?.type,
|
|
69
|
+
players: queue?.players,
|
|
70
|
+
updatedAt: queue?.updatedAt ? new Date(queue?.updatedAt) : new Date(),
|
|
71
|
+
createdAt: queue?.createdAt ? new Date(queue?.createdAt) : new Date(),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
63
74
|
}
|
|
64
75
|
toString() {
|
|
65
76
|
return this._id;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BetChannelTypes = void 0;
|
|
4
|
+
var BetChannelTypes;
|
|
5
|
+
(function (BetChannelTypes) {
|
|
6
|
+
BetChannelTypes["CreationChannel"] = "creation_channel";
|
|
7
|
+
})(BetChannelTypes || (exports.BetChannelTypes = BetChannelTypes = {}));
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ export declare class GuildBetManager extends BaseManager<GuildBet> {
|
|
|
9
9
|
constructor(guild: Guild);
|
|
10
10
|
toString(): number;
|
|
11
11
|
fetch(options?: FetchOptions): Promise<GuildBet | Collection<string, GuildBet>>;
|
|
12
|
+
create(data: Optional<APIGuildBet>): Promise<GuildBet>;
|
|
12
13
|
delete(betId?: string): Promise<GuildBet>;
|
|
13
14
|
set(data: Optional<APIGuildBet> | Optional<APIGuildBet>[]): GuildBet;
|
|
14
15
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GuildBetManager } from "../../managers";
|
|
2
2
|
import { REST } from "../../rest";
|
|
3
|
-
import { APIBetChannel, APIGuildBet, APIMessage, APIPlayer, BaseMatchModes, Confirm, Optional } from "../../types";
|
|
3
|
+
import { APIBetChannel, APIGuildBet, APIMessage, APIPlayer, BaseMatchModes, BetQueue, Confirm, Optional } from "../../types";
|
|
4
4
|
import { Guild } from "../guild/Guild";
|
|
5
5
|
export declare class GuildBet {
|
|
6
6
|
/** The bet's type */
|
|
@@ -36,6 +36,7 @@ export declare class GuildBet {
|
|
|
36
36
|
updatedAt: Date;
|
|
37
37
|
/** Bet's id */
|
|
38
38
|
_id: string;
|
|
39
|
+
queues: BetQueue[];
|
|
39
40
|
rest: REST;
|
|
40
41
|
guild: Guild;
|
|
41
42
|
manager: GuildBetManager;
|
|
@@ -2,6 +2,16 @@ import { BaseMatchModes, Confirm } from ".";
|
|
|
2
2
|
import { APIBetChannel } from "./APIBetChannel";
|
|
3
3
|
import { APIMessage } from "./APIMessage";
|
|
4
4
|
import { APIPlayer } from "./APIPlayer";
|
|
5
|
+
export interface BetQueue {
|
|
6
|
+
_id: string;
|
|
7
|
+
type: string;
|
|
8
|
+
players: APIPlayer[];
|
|
9
|
+
createdAt: Date;
|
|
10
|
+
updatedAt: Date;
|
|
11
|
+
}
|
|
12
|
+
export declare enum BetChannelTypes {
|
|
13
|
+
CreationChannel = "creation_channel"
|
|
14
|
+
}
|
|
5
15
|
export interface APIGuildBet {
|
|
6
16
|
/** The bet's type */
|
|
7
17
|
type: Omit<BaseMatchModes, "5x5" | "6x6" | "5v5" | "6v6">;
|
|
@@ -36,4 +46,5 @@ export interface APIGuildBet {
|
|
|
36
46
|
updatedAt: Date;
|
|
37
47
|
/** Bet's id */
|
|
38
48
|
_id: string;
|
|
49
|
+
queues: BetQueue[];
|
|
39
50
|
}
|